title: How do I use a custom deleter with a std::unique_ptr member?
body: <p>I have a class with a unique_ptr member.</p>
  
  <pre><code>class Foo {
  private:
      std::unique_ptr&lt;Bar&gt; bar;
      ...
  };
  </code></pre>
  
  <p>The Bar is a third party class that has a create() function and a destroy() function.</p>
  
  <p>If I wanted to use a <code>std::unique_ptr</code> with it in a stand alone function I could do:</p>
  
  <pre><code>void foo() {
      std::unique_ptr&lt;Bar, void(*)(Bar*)&gt; bar(create(), [](Bar* b){ destroy(b); });
      ...
  }
  </code></pre>
  
  <p>Is there a way to do this with <code>std::unique_ptr</code> as a member of a class?</p>