Boost logo

Boost Users :

Subject: [Boost-users] issue when using boost::tokensizer with std::wstring.
From: Sean Farrow (sean.farrow_at_[hidden])
Date: 2011-01-17 01:01:06


Hi:
I'm trying to use boost::tokenizer and have included boost/tokenizer.hpp.
I get the errors below when trying to compile the following code:
std::wstring TokensStr(Item);
       boost::tokenizer<> Tokens(TokensStr);
Item, is defined as a BSTR.
the errors are:
     1>c:\program files\boost\boost\tokenizer.hpp(59): error C2664: 'std::_String_const_iterator<_Elem,_Traits,_Alloc>::_String_const_iterator(const std::_String_const_iterator<_Elem,_Traits,_Alloc> &)' : cannot convert parameter 1 from 'std::_String_const_iterator<_Elem,_Traits,_Alloc>' to 'const std::_String_const_iterator<_Elem,_Traits,_Alloc> &'
                 with
                 [
                     _Elem=char,
                     _Traits=std::char_traits<char>,
                     _Alloc=std::allocator<char>
                 ]
                 and
                 [
                     _Elem=wchar_t,
                     _Traits=std::char_traits<wchar_t>,
                     _Alloc=std::allocator<wchar_t>
                 ]
                 and
                 [
                     _Elem=char,
                     _Traits=std::char_traits<char>,
                     _Alloc=std::allocator<char>
                 ]
                 Reason: cannot convert from 'std::_String_const_iterator<_Elem,_Traits,_Alloc>' to 'const std::_String_const_iterator<_Elem,_Traits,_Alloc>'
                 with
                 [
                     _Elem=wchar_t,
                     _Traits=std::char_traits<wchar_t>,
                     _Alloc=std::allocator<wchar_t>
                 ]
                 and
                 [
                     _Elem=char,
                     _Traits=std::char_traits<char>,
                     _Alloc=std::allocator<char>
                 ]
                 No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
                 d:\work\access for everyone\sibelius access\sibeliusaccessserver\sibeliusaccess.cpp(231) : see reference to function template instantiation 'boost::tokenizer<>::tokenizer<std::wstring>(const Container &)' being compiled
                 with
                 [
                     Container=std::wstring
                 ]
     1>c:\program files\boost\boost\tokenizer.hpp(59): error C2664: 'std::_String_const_iterator<_Elem,_Traits,_Alloc>::_String_const_iterator(const std::_String_const_iterator<_Elem,_Traits,_Alloc> &)' : cannot convert parameter 1 from 'std::_String_const_iterator<_Elem,_Traits,_Alloc>' to 'const std::_String_const_iterator<_Elem,_Traits,_Alloc> &'
                 with
                 [
                     _Elem=char,
                     _Traits=std::char_traits<char>,
                     _Alloc=std::allocator<char>
                 ]
                 and
                 [
                     _Elem=wchar_t,
                     _Traits=std::char_traits<wchar_t>,
                     _Alloc=std::allocator<wchar_t>
                 ]
                 and
                 [
                     _Elem=char,
                     _Traits=std::char_traits<char>,
                     _Alloc=std::allocator<char>
                 ]
                 Reason: cannot convert from 'std::_String_const_iterator<_Elem,_Traits,_Alloc>' to 'const std::_String_const_iterator<_Elem,_Traits,_Alloc>'
                 with
                 [
                     _Elem=wchar_t,
                     _Traits=std::char_traits<wchar_t>,
                     _Alloc=std::allocator<wchar_t>
                 ]
                 and
                 [
                     _Elem=char,
                     _Traits=std::char_traits<char>,
                     _Alloc=std::allocator<char>
                 ]
                 No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
Does anyone know how I can solve these errors.
Any help appreciated.
Regards
Sean.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net