title: C++ map using pair as key
body: <p>I am using a map (which seemed the best implementation after a <a href="https://stackoverflow.com/questions/15016197/stdmapint-int-vs-vector-of-vector">previous question</a>, with a pair key, as a 'container' for incoming messages that can be sorted according to sourceID and priority i.e. key: (sourceID, priority) which points to an int value.
  Processing will happen 'on' this map.</p>
  
  <p>I've just come against a problem - I need to do something like this pseudo code to subsequently retrieve messages:</p>
  
  <pre><code>map&lt;pair&lt;int, int&gt;, int&gt; mymap;
  
  if (!mymap[make_pair(nodeID,i)].empty()) //i refers to all the priority levels
      //processing occurs here to retrieve a value
  </code></pre>
  
  <p>but I can't seem to do it easily. Is there a way to do this simply without running an iterator e.g. <code>for (i = 0; i &lt;priority ; i++)</code>? I know that if I used an equivalent <code>vector&lt;vector&lt;int&gt;&gt;</code> I would be able to do this easily, but a map works better for my program at the moment.</p>
  
  <p>edit:</p>
  
  <p>The messages are sorted into the map by (sourceID, priority level), and then processed before being mapped into another map by (destID, priority level). I need to check there there are messages available for any particular destID, regardless of priority level, so I am looking for an easy way to check this.</p>
  
  <p>I know that if I use a <code>vector&lt;vector&lt;int&gt;&gt;</code>, I will be able to do something like <code>node[2].empty()</code>, if I want to check that node 2 has no available messages. Is there an equivalent for maps?</p>