title: std::map<int, int> vs. vector of vector
body: <p>I need a container to store a value (int) according to two attributes, source (int) and destination (int) i.e. when a source sends something to a destination, I need to store it as an element in a container. The source is identified by a unique int ID (an integer from 0-M), where M is in the tens to hundreds, and so is the destination (0-N). The container will be updated by iterations of another function.</p>
  
  <p>I have been using a <code>vector(vector(int))</code> which means goes in the order of source(destination(value)). A subsequent process needs to check this container, to see if an element exists in for a particular source, and a particular destination - it will need to differentiate between an empty 'space' and a filled one. The container has the possibility of being very sparse.</p>
  
  <p>The value to be stored CAN be 0 so I haven't had success trying to find out if the space is empty, since I can't seem to do something like container[M][N].empty(). </p>
  
  <p>I have no experience with maps, but I have seen another <a href="https://stackoverflow.com/questions/9006230/check-to-see-if-vector-index-is-empty">post</a> that suggests a map might be useful, and an <code>std::map&lt;int, int&gt;</code> seems to be similar to a <code>vector&lt;vector&lt;int&gt;&gt;</code>.</p>
  
  <p>To summarise:</p>
  
  <ol>
  <li>Is there a way to check if a specific vector of vector 'space' is empty (since I can't compare it to 0)</li>
  <li>Is a <code>std::map&lt;int, int&gt;</code> better for this purpose, and how do I use one?</li>
  </ol>