1

で使っfor_eachてみましたboost::trim。そもそも間違ったコードを使った

 std::for_each(v.begin(),v.end(),&boost::trim<std::string>));
 // error: too few arguments to function

それから私はこれで(オンラインで読んで)修正しました

 std::for_each(v.begin(),v.end()
              ,boost::bind(&boost::trim<std::string>,_1,std::locale()));

この関数を に渡す必要がある場合のコンパイラの動作for_eachstd::localeコードの 2 番目の入力引数の既定のパラメーターなので、機能するはずboost::trimだと思いました。

4

2 に答える 2