title: Initializing a std::unique_ptr by passing the address of the pointer
body: <p>I am creating a class which interops with some Windows API code, now one of the pointers I have to initialize is done by calling a native function which initializes it.</p>
  
  <p>My pointers are of type <code>std::unique_ptr</code> with a custom deleter, which calls the WinAPI deleter function provided, however I cannot pass the unique_ptr with the &amp; address-of operator to the init-function. Why?</p>
  
  <p>I have created a sample that demonstrates my problem:</p>
  
  <pre><code>#include &lt;memory&gt;
  
  struct foo
  {
     int x;
  };
  
  struct custom_deleter {};
  
  void init_foo(foo** init)
  {
    *init = new foo();
  }
  
  int main()
  {
     std::unique_ptr&lt;foo, custom_deleter&gt; foo_ptr;
  
     init_foo(&amp;foo_ptr);
  }
  </code></pre>
  
  <p>The compiler barks and says:</p>
  
  <pre><code>source.cpp: In function 'int main()':
  source.cpp:19:21: error: cannot convert 'std::unique_ptr&lt;foo, custom_deleter&gt;*' to 'foo**' for argument '1' to 'void init_foo(foo**)'
  </code></pre>