#include #include #include #include #include typedef std::string Element; namespace mi=boost::multi_index; typedef mi::multi_index_container< Element, mi::indexed_by< mi::hashed_unique< mi::identity > > > ElementSet; struct ElementEq { bool operator()(const Element &x, size_t y) const { return boost::hash()(x) == y; } bool operator()(size_t x, const Element &y) const { return x == boost::hash()(y); } }; struct ElementHashHasher { std::size_t operator()(size_t x) const { return x; } }; int main() { ElementSet elementSet; elementSet.insert("hello"); elementSet.insert("goodbye"); elementSet.insert("boost"); elementSet.insert("c++"); elementSet.insert("multi_index"); elementSet.insert("programming"); elementSet.insert("code"); std::cout<<*elementSet.find( boost::hash()("c++"),ElementHashHasher(),ElementEq())<()("boost"),ElementHashHasher(),ElementEq()).first<