title: Array of polymorphic unique_ptr
body: <p>Using unique pointers, we can write</p>
  
  <pre><code>class A{};
  class B: public A{};
  class C: public A{};
  std::vector&lt;std::unique_ptr&lt;A&gt;&gt; myArray;
  //
  f()
  {
      std::unique_ptr&lt;B&gt; pB {new B()};
      std::unique_ptr&lt;C&gt; pC {new C()};
      myArray.push_back(std::move(pB));
      myArray.push_back(std::move(pC));
      // nice! now I can use the interface of A without
      // worrying about its subclasses.
  }
  </code></pre>
  
  <p>However, if classes <code>B</code> and <code>C</code> need to have their own type-dependent custom deleter:</p>
  
  <pre><code>class A{};
  class B: public A{};
  class C: public A{};
  
  template&lt;class T&gt;
  struct custom_deleter
  { // roughly the same implementation as std::default_deleter
      void operator()(T* p)
      {
          CustomFree(p);
      }
  };
  //
  std::vector&lt;std::unique_ptr&lt;A&gt;&gt; myArray; 
  //
  f()
  {
      std::unique_ptr&lt;B, custom_deleter&lt;B&gt;&gt; pB {CustomAlloc(B())};
      std::unique_ptr&lt;C, custom_deleter&lt;C&gt;&gt; pC {CustomAlloc(C())};
      myArray.push_back(std::move(pB)); // error: can't convert to default deleter
      myArray.push_back(std::move(pC)); // item dito
  }
  </code></pre>
  
  <p>Is there a way to achieve what I'm trying to do here?</p>