我刚刚安装了 boost,到目前为止我使用的所有功能都运行良好,但是当我使用 trim_if 时,当你需要使用 boost::is_any_of 时,它会产生多个错误。
这是我遇到的一些错误:
error C2868: 'std::iterator_traits<_Iter>::iterator_category' : illegal syntax
for using-declaration; expected qualified-name
error 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;
}