
Compiling the folowing using is_iless as the predicate for a multi index container results in errors. When is_less is used instead, it compiles fine. typedef mi::multi_index_container< GTLayer, mi::indexed_by< mi::sequenced<>, // list-like index mi::ordered_unique< mi::tag<name>, mi::const_mem_fun<GTLayer, std::string, >Layer::GetLayerName>, //std::greater<std::string> ::boost::algorithm::is_iless // names sorted > > > layer_container; The error messages are - Error 4 error C2440: 'type cast' : cannot convert from 'std::basic_string<_Elem,_Traits,_Ax>' to 'unsigned char' C:\Program Files\Microsoft Visual Studio 8\VC\include\xlocale 561 Error 3 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 583 Is this an include problem? I have tried the following includes - #include <boost/multi_index_container.hpp> #include <boost/multi_index/mem_fun.hpp> #include <boost/multi_index/ordered_index.hpp> #include <boost/multi_index/sequenced_index.hpp> #include <boost/algorithm/string/compare.hpp> #include <boost/algorithm/string.hpp> #include <boost/algorithm/string/predicate.hpp> #include <map> #include <string> #include <cwchar> #include <locale> Thanks - Marcia

Hi, I suspect the reason for this is the different constructor of is_less() and is_iless(). is_iless() requres a local: is_iless( const std::locale& Loc=std::locale() ) : You can write a helper class: class iless : std::binary_function< std::string, std::string, bool > { public: iless(); bool operator()( std::string const&, std::string const& ) const; private: std::locale locale_; }; that do the work of initializing the local for you. Pirx! "Marcia Chadly" <mchadly@ansoft.com> schrieb im Newsbeitrag news:24CB4FB4D2414BA9AB161DF13EDB1C68@ansoft.com... Compiling the folowing using is_iless as the predicate for a multi index container results in errors. When is_less is used instead, it compiles fine. typedef mi::multi_index_container< GTLayer, mi::indexed_by< mi::sequenced<>, // list-like index mi::ordered_unique< mi::tag<name>, mi::const_mem_fun<GTLayer, std::string, >Layer::GetLayerName>, //std::greater<std::string> ::boost::algorithm::is_iless // names sorted > > > layer_container; The error messages are - Error 4 error C2440: 'type cast' : cannot convert from 'std::basic_string<_Elem,_Traits,_Ax>' to 'unsigned char' C:\Program Files\Microsoft Visual Studio 8\VC\include\xlocale 561 Error 3 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 583 Is this an include problem? I have tried the following includes - #include <boost/multi_index_container.hpp> #include <boost/multi_index/mem_fun.hpp> #include <boost/multi_index/ordered_index.hpp> #include <boost/multi_index/sequenced_index.hpp> #include <boost/algorithm/string/compare.hpp> #include <boost/algorithm/string.hpp> #include <boost/algorithm/string/predicate.hpp> #include <map> #include <string> #include <cwchar> #include <locale> Thanks - Marcia _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Hello, Marcia Chadly wrote:
Compiling the folowing using is_iless as the predicate for a multi index container results in errors. When is_less is used instead, it compiles fine.
typedef mi::multi_index_container<
GTLayer,
mi::indexed_by<
mi::sequenced<>, // list-like index
mi::ordered_unique<
mi::tag<name>,
mi::const_mem_fun<GTLayer, std::string, >Layer::GetLayerName>,
//std::greater<std::string>
::boost::algorithm::is_iless // names sorted
It's a common misconception, that is_iless is for a string comparison. Its isn't actually. It is designed to compare characters and it is used as as pluging to string processing algorithms, that work on character-by-character basis. And it does not provide unary_function interface, since its operators is template based for convenience. Best Regards, Pavol
participants (3)
-
Commander Pirx
-
Marcia Chadly
-
Pavol Droba