c – boost ::修剪std :: vector中的每个字符串
我目前正在找到正确的语法来修剪std :: vector中的每个字符串.
我试过了 std::vector<std::string> v; std::for_each(v.begin(),v.end(),&boost::trim); 这在MSVC7.1中给了我以下错误消息.
如果我明确地给模板参数修剪第二个参数,编译器无法找到,尽管它默认设置. std::for_each(v.begin(),&boost::trim<std::string>);
我想知道如何使用正确的语法调用v中每个元素的修剪. 解决方法
您还需要绑定trim(语言环境)的第二个参数:
std::vector<std::string> v; std::for_each(v.begin(),boost::bind(&boost::trim<std::string>,_1,std::locale() )); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |