title: Using pair<int, int> as key for map
body: <p>Based on a <a href="https://stackoverflow.com/questions/15016197/stdmapint-int-vs-vector-of-vector">previous question</a>, I am trying to create a map using a pair of integers as a key i.e. <code>map&lt;pair&lt;int, int&gt;, int&gt;</code> and I've found information on how to insert: </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;map&gt;
  
  using namespace std;
  
  int main ()
  {
  map&lt;pair&lt;int, int&gt;, int&gt; mymap;
  
  mymap.insert(make_pair(make_pair(1,2), 3)); //edited
  }   
  </code></pre>
  
  <p>but I can't seem to access the element! I've tried <code>cout &lt;&lt; mymap[(1,2)] &lt;&lt; endl;</code> but it shows an error, and I can't find information on how to access the element using the key. Am I doing something wrong?</p>