1

ブーストをインストールしたばかりで、これまでに使用したすべての機能は正常に機能しましたが、ブースト:: 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''

ブーストを再インストールしようとしましたが、うまくいきませんでした。

コード:

#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;
}
4

1 に答える 1

3

あなたの問題は通話にありますboost::is_any_of('\t')

is_any_of一連の文字を取り、単一の文字を渡しています。

コードを次のように変更します。

     boost::trim_if(string, boost::is_any_of("\t"));

つまり、単一引用符の代わりに二重引用符を使用します。

于 2013-10-01T19:04:36.880 に答える