首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Boost: is_any_of生成多个错误

Boost: is_any_of生成多个错误
EN

Stack Overflow用户
提问于 2013-10-01 18:39:00
回答 1查看 2.3K关注 0票数 1

我刚刚安装了boost,到目前为止我使用的所有函数都很好,但是当我使用trim_if时,当您需要使用boost::is_any_of时,它会产生多个错误。

,这是我遇到的一些错误:

代码语言:javascript
复制
error C2868: 'std::iterator_traits<_Iter>::iterator_category' : illegal syntax
for using-declaration; expected qualified-name

代码语言:javascript
复制
error C2825: '_Iter': must be a class or namespace when 
followed by '::'

代码语言:javascript
复制
error C2602: 'boost::range_iterator<C>::type' is not a member of a base class 
of 'boost::range_iterator<C>'

代码语言:javascript
复制
error C2602: 'std::iterator_traits<_Iter>::iterator_category' 
is not a member of a base class of 'std::iterator_traits<_Iter>'

代码语言:javascript
复制
error C2039: 'iterator_category' : is not a member of '`global namespace''

我试着重新安装boost,但没有成功。

代码:

代码语言:javascript
复制
#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;
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-10-01 19:04:36

您的问题在于调用boost::is_any_of('\t')

is_any_of接受一系列字符,您将传递一个字符。

将代码更改为:

代码语言:javascript
复制
     boost::trim_if(string, boost::is_any_of("\t"));

也就是说,用双数代替单引号。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19123492

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档