我刚刚安装了boost,到目前为止我使用的所有函数都很好,但是当我使用trim_if时,当您需要使用boost::is_any_of时,它会产生多个错误。
,这是我遇到的一些错误:
error C2868: 'std::iterator_traits<_Iter>::iterator_category' : illegal syntax
for using-declaration; expected qualified-nameerror C2825: '_Iter': must be a class or namespace when
followed by '::'error C2602: 'boost::range_iterator<C>::type' is not a member of a base class
of 'boost::range_iterator<C>'error C2602: 'std::iterator_traits<_Iter>::iterator_category'
is not a member of a base class of 'std::iterator_traits<_Iter>'error C2039: 'iterator_category' : is not a member of '`global namespace''我试着重新安装boost,但没有成功。
代码:
#include <iostream>
#include <string>
#include <boost/algorithm/string.hpp>
int main(int argc, char *argv[])
{
std::string string = "\t\tthis is a string\t";
boost::trim_if(string, boost::is_any_of('\t'));
std::cout << string << std::cout;
system("pause");
return 0;
}发布于 2013-10-01 19:04:36
您的问题在于调用boost::is_any_of('\t')。
is_any_of接受一系列字符,您将传递一个字符。
将代码更改为:
boost::trim_if(string, boost::is_any_of("\t"));也就是说,用双数代替单引号。
https://stackoverflow.com/questions/19123492
复制相似问题