title: Custom deallocator with an std::vector doesn't get called
body: <p>I am expecting this code to print "Hello world" - "Hello " when the memory is deallocated and "world" in <code>main</code>. However "Hello" never gets printed, meaning that my deallocator doesn't get called. What's the proper way to implement it?</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  
  class MyAllocator : public std::allocator&lt;uint8_t&gt;
  {
  public:
    void deallocate(uint8_t* data, std::size_t size)
    {
      std::cout &lt;&lt; "Hello ";
      std::allocator&lt;uint8_t&gt;::deallocate(data, size);
    }
  };
  
  
  int main()
  {
    {
      std::vector&lt;uint8_t, MyAllocator&gt; v(100);
    }
    std::cout &lt;&lt; "world\n";
  
    return 0;
  }
  </code></pre>
  
  <p>I assume it just calls the default <code>std::allocator&lt;uint8_t&gt;::deallocate()</code> function, but I am not seeing a way to prevent it and make it call my function.</p>