|
Boost Users : |
From: Pavol Droba (droba_at_[hidden])
Date: 2007-10-07 08:02:21
Hi,
is_iless works with characters, not strings. So you cannot use it to
compare std::string keys.
Regards,
Pavol
Boris wrote:
> Am I supposed to be able to use boost::algorithm::is_iless (see
> http://www.boost.org/doc/html/boost/algorithm/is_iless.html) to create a
> map with case-insensitive keys? I wonder as either it is broken in VS2005
> or I do something wrong:
>
> #include <boost/algorithm/string.hpp>
> #include <string>
> #include <map>
>
> int main()
> {
> std::map<std::string, int, boost::algorithm::is_iless> m;
> m["test"] = 1;
> }
>
> C:\Program Files\Microsoft Visual Studio 8\VC\include\xlocale(583) :
> error C2440: 'type cast' : cannot convert from 'unsigned char' to
> 'std::basic_string<_Elem,_Traits,_Ax>'
> ...
> C:\Program Files\Microsoft Visual Studio 8\VC\include\xlocale(561) :
> error C2440: 'type cast' : cannot convert from
> 'std::basic_string<_Elem,_Traits,_Ax>' to 'unsigned char'
>
> The assignment causes the problem. If you use insert() you get the same
> compiler error. Without the assignment the code compiles fine.
>
> Boris
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
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