boost::trim each string in std::vector

前端 未结 1 1310
长情又很酷
长情又很酷 2020-12-31 11:39

I\'m currently stuck finding the correct syntax for trimming each string in a std::vector.

I tried

std::vector v;
std::for_each(v.be         


        
相关标签:
1条回答
  • 2020-12-31 12:15

    You need to bind as well the second parameter of trim (the locale):

    std::vector<std::string> v;
    std::for_each(v.begin(), v.end(), 
                  boost::bind(&boost::trim<std::string>,
                              _1, std::locale() ));
    
    0 讨论(0)
提交回复
热议问题