title: Implementing a QHash-like lookup with multiple keys
body: <p>I'm trying to find the best way to implement a QHash-like lookup table that uses multiple keys to return one value. I have read that the Boost library has similar functionality, but I would like to avoid this if possible. </p>
  
  <p>An example of what I would like to do is as follows (obviously the following pseudo-code is not possible):</p>
  
  <pre><code>//First key (int) - Engine cylinders
  //Second key (int) - Car weight
  //Value (int) - Top speed
  MyLookup&lt;int, int, int&gt; m_Lookup
  m_Lookup.insert(6, 1000, 210);
  m_Lookup.insert(6, 1500, 190);
  m_Lookup.value(6, 1000); //Returns 210
  </code></pre>
  
  <p>My first (and extremely slow) idea was to just create a Struct, and iterate over a list until I find a qualifying item.</p>
  
  <pre><code>Struct Vehicle {
     int cyl;
     int weight;
     int speed'
  }
  
  QList&lt;Vehicle&gt; carList; //Assume this is populated
  for(i = 0; i &lt; carList.length; ++i) { 
  if(carList[i].cyl == 6 &amp;&amp; carList[i].weight == 1000) {
  return carList[i].speed; } }
  </code></pre>
  
  <p>My other idea was to concatenate the two keys into one key, and implement a couple functions to combine and separate the two keys when needed. While this would work, and probably be a lot faster than a full iteration, it seems a bit hacked together.</p>
  
  <pre><code>QHash&lt;QString, int&gt; m_Lookup;
  m_Lookup.insert("6|1000", 210);
  </code></pre>
  
  <p>Does anyone know of a better way to try and achieve this? </p>