Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.stringalgo
From: Commander Pirx (CmdPirx_at_[hidden])
Date: 2009-10-12 06:45:28


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_at_[hidden]> schrieb im Newsbeitrag
news:24CB4FB4D2414BA9AB161DF13EDB1C68_at_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,
&GTLayer::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_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