title: unique_ptr with an API that expects raw pointers?
body: <p>After about 10 years of using managed memory and functional languages, I'm finally coming home to C++, and smart pointers are confusing the heck out of me. Half of the documentation out there is still regarding the deprecated <code>auto_ptr</code>.</p>
  
  <p>I'm trying to implement this fairly straightforward Bullet <a href="http://bulletphysics.org/mediawiki-1.5.8/index.php/Hello_World#Initial_Program" rel="nofollow noreferrer">"hello world"</a> program:</p>
  
  <pre><code>int _tmain(int argc, _TCHAR* argv[])
  {
      auto bp = unique_ptr&lt;btBroadphaseInterface&gt;(new btDbvtBroadphase);
      auto cc = unique_ptr&lt;btDefaultCollisionConfiguration&gt;(new btDefaultCollisionConfiguration);
      auto disp = unique_ptr&lt;btDispatcher&gt;(new btCollisionDispatcher(cc));
  }
  </code></pre>
  
  <p>The <code>btCollisionDispatcher</code> constructor wants a <code>btCollisionConfiguration*</code>, but I'm giving it a <code>unique_ptr</code> to one instead.</p>
  
  <p>What do I normally want to do in this case? If there's a way to "de-smart" the pointer, something tells me that <code>unique_ptr</code> isn't the right smart pointer to use.</p>
  
  <p><img src="https://i.stack.imgur.com/4Noy6.png" alt="enter image description here"></p>
  
  <p>C++ was my language of choice before I moved to other things. It's a little shocking coming back and seeing that all the patterns and practices have completely changed.</p>