A simpler way: add the following member functions to your StringPointerLess
comparison predicate:
struct StringPointerLess{
...
bool operator()(boost::shared_ptr<QString> const& x,const QString& y)const{
return *x<y;
}
bool operator()(const QString& x,boost::shared_ptr<QString> const& y)const{
return x<*y;
}
...
};
and now you can lookup by simply providing the desired QString
:
IteratorType find( MyContainerType const& container, QString const& key )
{
return container.find( key );
}
The magic behind this is explained at the special lookup operations section in Boost.MultiIndex documentation.