title: Getting std::map allocator to work
body: <p>I've got an extremely basic allocator:</p>
  
  <pre><code>template&lt;typename T&gt;
  struct Allocator : public std::allocator&lt;T&gt; {
      inline typename std::allocator&lt;T&gt;::pointer allocate(typename std::allocator&lt;T&gt;::size_type n, typename std::allocator&lt;void&gt;::const_pointer = 0) {
      std::cout &lt;&lt; "Allocating: " &lt;&lt; n &lt;&lt; " itens." &lt;&lt; std::endl;
      return reinterpret_cast&lt;typename std::allocator&lt;T&gt;::pointer&gt;(::operator new(n * sizeof (T))); 
      }
  
      inline void deallocate(typename std::allocator&lt;T&gt;::pointer p, typename std::allocator&lt;T&gt;::size_type n) {
      std::cout &lt;&lt; "Dealloc: " &lt;&lt;  n &lt;&lt; " itens." &lt;&lt; std::endl;
          ::operator delete(p); 
      }
  
      template&lt;typename U&gt;
      struct rebind {
          typedef Allocator&lt;U&gt; other;
      };
  };
  </code></pre>
  
  <p>Which works fine when I use it with: "std::vector >", however, when I try use it with an std::map like:</p>
  
  <pre><code>int main(int, char**) {
      std::map&lt;int, int, Allocator&lt; std::pair&lt;const int, int&gt; &gt; &gt; map;
  
      for (int i(0); i &lt; 100; ++i) {
          std::cout &lt;&lt; "Inserting the " &lt;&lt; i &lt;&lt; " item. " &lt;&lt; std::endl;
          map.insert(std::make_pair(i*i, 2*i));
      }
  
      return 0;
  }
  </code></pre>
  
  <p>It fails to compile (gcc 4.6) giving an extremely long error ending with: <code>/usr/lib/gcc/x86_64-redhat-linux/4.6.0/../../../../include/c++/4.6.0/bits/stl_tree.h:959:25: error: no match for call to ‘(Allocator&lt;std::pair&lt;const int, int&gt; &gt;) (std::pair&lt;const int, int&gt;::first_type&amp;, const int&amp;)’</code></p>