title: How does std::map make sure all pointers are null?
body: <p>I'm implementing a custom map class similar to the one from std, however I have one problem.In their map, when you do(for instance):</p>
  
  <pre><code>map&lt;string, SomeObject*&gt; container;
  SomeObject* object = container["this doesn't exist"];
  </code></pre>
  
  <p>in the debugger object is <strong>0x0000000</strong>, so invalid values from map are always null.However, in my map invalid values are like uninitialized pointers - they have an invalid value like <strong>0xcdcdcdcd</strong>, however in Release mode its something else, so I cant rely to check for </p>
  
  <pre><code>if(object == 0xcdcdcdcd)
  </code></pre>
  
  <p>So I would like to be able to do this:</p>
  
  <pre><code>MyMap&lt;string, SomeObject*&gt; container;
  SomeObject* object = container["this doesn't exist"]; //and for this to definetely be nullptr
  </code></pre>
  
  <p>so I can then do</p>
  
  <pre><code>if(object == nullptr)
     DoSomething();
  </code></pre>
  
  <p>I have a <strong>bool ContainsKey(KeyType key);</strong> function, but it involves a for loop.Is there some way to ensure what I want in initialization-time for the map, or do I have to make a custom <strong>PointerWrapper</strong> that will contain a pointer of <strong>SomeObject</strong> that is set to <strong>nullptr</strong> in <strong>PointerWrapper</strong>'s constructor?I had a hard time figuring out what is going on in the std headers, they have an enormous amount of macros and typedefs.</p>