problem with std::wstring find_last_not_of

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
hi,all, I have a problem here related to find_last_not_of and find_first_not_of, that
<pre class="prettyprint wstring::size_type pos = str.find_last_not_of( );
wstring::size_type pos1 = str.find_last_not_of(" t");[/code]
the first one is fine, but I got a error msg with the second one:
<pre class="prettyprint XMLDOMFromVCDlg.cpp(6562): error C2664: unsigned int std::basic_string<_Elem,_Traits,_Ax>::find_last_not_of(const std::basic_string<_Elem,_Traits,_Ax> &,unsigned int) const : cannot convert parameter 1 from const char [3] to const std::basic_string<_Elem,_Traits,_Ax> &
1> with
1> [
1> _Elem=wchar_t,
1> _Traits=std::char_traits<wchar_t>,
1> _Ax=std::allocator<wchar_t>
1> ]
1> Reason: cannot convert from const char [3] to const std::basic_string<_Elem,_Traits,_Ax>
1> with
1> [
1> _Elem=wchar_t,
1> _Traits=std::char_traits<wchar_t>,
1> _Ax=std::allocator<wchar_t>
1> ]
1> No constructor could take the source type, or constructor overload resolution was ambiguous
1>[/code]
so whats going on?
ps. the example shown in:
http://www.cplusplus.com/reference/string/string/find_last_not_of/
http://www.cplusplus.com/reference/string/string/find_last_not_of/ http://www.cplusplus.com/reference/string/string/find_last_not_of/
http://www.cplusplus.com/reference/string/string/find_last_not_of/ seems it should work.
cheers


<br/>

View the full article
 
Back
Top