title: Faster alternative to STL std::map
body: <p>I do have a data structure:</p>
  
  <pre><code>typedef std::pair&lt;boost::shared_ptr&lt;X&gt;, boost::shared_ptr&lt;X&gt; &gt; pair_ptr;
  std::map&lt; pair_ptr, int &gt;
  </code></pre>
  
  <p>that I use in a iterative process. In each iteration I <em>need</em> to copy the the std::map and possibly destroy one copy. However, the std::map can become large, over 100k elements. This significantly slows down the program. I've defined the operator&lt; as:</p>
  
  <pre><code>   inline bool operator&lt;(const pair_ptr&amp; a, const pair_ptr&amp; b) 
     { 
     return (a.first &lt; b.first) or 
          (a.first == b.first and a.second &lt; b.second);
     }
  </code></pre>
  
  <p>I use the std::map copy constructor and destructor. Is there a faster alternative?</p>