title: Using a std::tuple as key for std::unordered_map
body: <p>With the code below, I get a very confusing error in MSVC that seems to suggest the key type (an std::tuple) is being converted to an std::string.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;tuple&gt;
  #include &lt;utility&gt;
  #include &lt;unordered_map&gt;
  
  typedef std::tuple&lt;std::string,int,char&gt; key_t;
  
  struct key_hash : public std::unary_function&lt;key_t, std::size_t&gt;
  {
     std::size_t operator()(const key_t&amp; k) const
     {
        return std::get&lt;0&gt;(k)[0] ^ std::get&lt;1&gt;(k) ^ std::get&lt;2&gt;(k);
     }
  };
  
  struct key_equal : public std::binary_function&lt;key_t, key_t, bool&gt;
  {
     bool operator()(const key_t&amp; v0, const key_t&amp; v1) const
     {
        return (
                 std::get&lt;0&gt;(v0) == std::get&lt;0&gt;(v1) &amp;&amp;
                 std::get&lt;1&gt;(v0) == std::get&lt;1&gt;(v1) &amp;&amp;
                 std::get&lt;2&gt;(v0) == std::get&lt;2&gt;(v1)
               );
     }
  };
  
  struct data
  {
     std::string x;
  };
  
  typedef std::unordered_map&lt;key_t,data,key_hash,key_equal&gt; map_t;
  
  
  int main()
  {
     map_t m;
     data d;
     d.x = "test data";
     m[std::make_tuple("abc",1,'X')] = d;
     auto itr = m.find(std::make_tuple(std::string("abc"),1,'X'));
     if (m.end() != itr)
     {
        std::cout &lt;&lt; "x: " &lt;&lt; itr-&gt;second.x;
     }
     return 0;
  }
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>Error   1   error C2664: 'std::basic_string&lt;_Elem,_Traits,_Ax&gt;::basic_string(const std::basic_string&lt;_Elem,_Traits,_Ax&gt; &amp;)' : cannot convert parameter 1 from 'const std::tr1::tuple&lt;_Arg0,_Arg1,_Arg2&gt;' to 'const std::basic_string&lt;_Elem,_Traits,_Ax&gt; &amp;'  c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\tuple    127 1   
  </code></pre>
  
  <p>Compiler: MS Visual Studio 2010</p>
  
  <p>On ideone, I get the following even more convoluted error:</p>
  
  <p><a href="http://ideone.com/yEv2j" rel="noreferrer">http://ideone.com/yEv2j</a></p>
  
  <p>I can't seem to figure out where I've gone wrong.</p>