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
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"
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
, //std::greaterstd::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