boost::trim each string in std::vector

前端 未结 1 1308
长情又很酷
长情又很酷 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 v;
    std::for_each(v.begin(), v.end(), 
                  boost::bind(&boost::trim,
                              _1, std::locale() ));
    

    0 讨论(0)
提交回复
热议问题