title: std::map find doesn't work properly
body: <p>std::map.find() is intended to return an map::iterator to an element it found if there is some or to the end() if not. I get BadPtr returned to me. The exactly same construct works fine in the other part of code. What is this?</p>
  
  <pre><code>class OntologyContainer {
      map&lt;string, OntologyClass*&gt; data;
      OntologyClass* last_added;
  public:
      class iterator : public std::iterator&lt;bidirectional_iterator_tag, OntologyClass&gt; {
          map&lt;string, OntologyClass*&gt;::iterator itr;
      public:
          iterator(map&lt;string, OntologyClass*&gt;::iterator it) : itr(it) { }
  
      ...
      }
  
      iterator begin() {
          return iterator(data.begin());
      }
  
      iterator end() {
          return iterator(data.end());
      }
  
      iterator Find(const string &amp; to_find) {
          map&lt;string, OntologyClass*&gt;::iterator it = data.find(to_find);
          // this is where it fails
          return iterator(it);
      }
  </code></pre>
  
  <p>map::iterator is wrapped for the sake of making operators * and -> returning OntologyClass objects and pointers respectively:</p>
  
  <pre><code>            OntologyClass&amp; operator* () {
          return *(itr-&gt;second);
      }
  
      OntologyClass* operator-&gt;() {
          return itr-&gt;second;
      }
  </code></pre>