title: Having a composite key for hash map in c++
body: <p>I have a data structure which has,</p>
  
  <pre><code>&lt;Book title&gt;, &lt;Author&gt;, and &lt;rate&gt;
  </code></pre>
  
  <p>Since Book title or Author can be duplicated, I'd like to build a composite key.
  (let's say I cannot make extra unique key, such as ID)</p>
  
  <p>Since data is pretty huge, I'm using GCC unordered_map for the sake of speed,
  and I built my structure like this:</p>
  
  <pre><code>typedef pair&lt;string, string&gt; keys_t
  typedef unordered_map&lt;keys_t, double&gt; map_t;
  </code></pre>
  
  <p>Everything works okay in general,
  But the problem happens when I want to refer one specific key.</p>
  
  <p>For example, let's suppose I'd like to find the best-rated book among books titled as "math", or  I'd like to find the average rate of "Tolstoy"'s books. <br />
  In this case, this becomes very bothersome, since I cannot only refer only one of the key pair.</p>
  
  <p>I happened to find <code>boost::multi_index</code> but I'm having some trouble understanding the documents. 
  Does anyone have some idea or guideline for this?</p>
  
  <p>Solution to make multiple indices, succinct example for multi_index, any other approach, etc.. any help will be appreciated. </p>
  
  <p>Thank you.</p>