title: Why doesn't this C++ STL allocator allocate?
body: <p>I'm trying to write a custom STL allocator that is derived from <code>std::allocator</code>, but somehow all calls to <code>allocate()</code> go to the base class. I have narrowed it down to this code:</p>
  
  <pre><code>template &lt;typename T&gt; class a : public std::allocator&lt;T&gt; {
  public:
      T* allocate(size_t n, const void* hint = 0) const {
          cout &lt;&lt; "yo!";
          return 0;
      }
  };
  
  int main()
  {
      vector&lt;int, a&lt;int&gt;&gt; v(1000, 42);
      return 0;
  }
  </code></pre>
  
  <p>I expect "Yo!" to get printed, followed by some horrible error because I don't actually allocate anything. Instead, the program runs fine and prints nothing. What am I doing wrong?</p>
  
  <p>I get the same results in gcc and VS2008.</p>