title: Weird behavior with map.find and a pointer to a vector
body: <p>I have a map of pairs to a vector of vectors that looks like this:</p>
  
  <pre><code>std::map&lt;std::pair&lt;uint16, uint16&gt;, std::vector&lt;std::vector&lt;uint32&gt; &gt; &gt;
  </code></pre>
  
  <p>The map is populated in the constructor of a class. This class provides a public method that returns a pointer to <code>std::vector&lt;std::vector&lt;uint32&gt; &gt;</code> (the map value part), with something like this:</p>
  
  <pre><code>typedef std::pair&lt;uint16, uint16&gt; key;
  typedef std::vector&lt;std::vector&lt;uint32&gt; &gt; value;
  
  value* FindValues(key someKey) {
      std::map&lt;key, value&gt;::const_iterator it;
      it = someStore.find(someKey);
      if (it != someStore.end()) 
          return &amp;(value)it-&gt;second;
      return NULL;
  }
  </code></pre>
  
  <p>This is when it gets weird. When iterating over the vector returned by FindValues, all child vectors have a large, negative number (such as -1818161232) as their first value. But if I use a function like:</p>
  
  <pre><code>value FindValues(key someKey) {
      std::map&lt;key, value&gt;::const_iterator it;
      return someStore.find(someKey)-&gt;second;
  }
  </code></pre>
  
  <p>...then the value is normal. This only happens for the value at index 0 of <strong>all</strong> child vectors. With the second method, though, my application segfaults if a key wasn't found (for obvious reasons). What am I doing wrong?</p>