title: Passing a std::unique_ptr as a parameter to a function
body: <p>I got a structure and a function like the following:</p>
  
  <pre><code>struct MYOVERLAPPED : public OVERLAPPED
  {
      //...
  };
  
  
  void func1(std::unique_ptr&lt;MYOVERLAPPED&gt; pBuf)
  {
      //...
  };
  </code></pre>
  
  <p>I am obtaining a pointer to MYOVERLAPPED which i want to pass to the func1-function.
  The problem i encounter is, that no matter what i try i get the following errors :</p>
  
  <p>What i did try already are the following:
  Try1:</p>
  
  <pre><code>std::unique_ptr&lt;OVERLAPPED&gt; pOver(//....)
  HandleAcceptIndication(std::move(pOver));
  </code></pre>
  
  <blockquote>
    <p>Error: Error  1   error C2440: 'initializing' : cannot convert from
    '_OVERLAPPED **' to 'MYOVERLAPPED *'</p>
  </blockquote>
  
  <p>Try2:</p>
  
  <pre><code>HandleAcceptIndication(new ACCEPT_OVERLAPPED);
  </code></pre>
  
  <blockquote>
    <p>Error 1   error C2664: 'HandleAcceptIndication' : cannot convert
    parameter 1 from 'MYOVERLAPPED *' to 'std::unique_ptr&lt;_Ty>'</p>
  </blockquote>
  
  <p>Anyone knows how i can pass this casted pointer of OVERLAPPED to MYOVERLAPPED to the function and why Try2 does not work either since i casually use <code>std::unique_ptr&lt;MYOVERLAPPED&gt; pO(new MYOVERLAPPED)</code>  which does work...?</p>