As I find myself replacing all kind of C++ standard containers with
multi_index_container (a really very useful container) I've been defining
key extractors quite a lot and wonder if there is any shortcut like using
lambda expressions or function objects. Here's some pseudo-code to explain
what I mean:
struct foo
{
std::string s;
foo(std::string s) : s(s) { }
};
typedef multi_index_container<
foo,
indexed_by<
hashed_unique<
boost::bind
mi_t;
The idea is to call another function on the object which is returned by the key extractor member. Here in this example the multi_index_container would only store strings with a unique size. However I'm lost how to define the key extractor. The difficulty is probably that I normally don't need to specify types when I use boost::bind or lambda expressions. Now I need to figure out how to use them with multi_index_container - is there any trick or I better go on defining key extractors? Boris