#include <boost/multi_index_container.hpp>
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/identity.hpp>
#include <string>
#include <iostream>

typedef std::string Element;

namespace mi=boost::multi_index;

typedef mi::multi_index_container<
  Element,
  mi::indexed_by<
    mi::hashed_unique<
      mi::identity<Element>
    >
  >
> ElementSet;

struct ElementEq
{
  bool operator()(const Element &x, size_t y) const
  {
    return boost::hash<Element>()(x) == y;
  }

  bool operator()(size_t x, const Element &y) const
  {
    return x == boost::hash<Element>()(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<Element>()("c++"),ElementHashHasher(),ElementEq())<<std::endl;

  std::cout<<*elementSet.equal_range(
    boost::hash<Element>()("boost"),ElementHashHasher(),ElementEq()).first<<std::endl;
}

