title: Initializing an unique_ptr though a constructor
body: <pre><code>class BaseShader {
          std::unique_ptr&lt;HandleInterface&gt; handle_;
      public:
          BaseShader();
          BaseShader(std::unique_ptr&lt;HandleInterface&gt; handle_ptr);
  </code></pre>
  
  <p>.cpp</p>
  
  <pre><code>BaseShader::BaseShader(std::unique_ptr&lt;HandleInterface&gt; handle_ptr) {
      handle_.reset(handle_ptr.get());
  }
  //BaseHandle implements HandleInterface
  BaseShader::BaseShader():BaseShader(std::make_shared&lt;BaseHandle&gt;()) {
  }
  </code></pre>
  
  <p>How would I initialize my unique_ptr <code>handle_</code> correctly?</p>
  
  <p>I want to use it like this <code>BaseShader s(std::make_shared&lt;BaseHandle&gt;());</code></p>
  
  <p>Clang tells me </p>
  
  <pre><code>error: no matching constructor for initialization of 'BaseShader'
  BaseShader::BaseShader():BaseShader(std::make_shared&lt;BaseHandle&gt;()) {
                           ^          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  </code></pre>
  
  <p>I probably messed it up. </p>
  
  <p>1.) Is my constructor argument correct? <code>BaseShader::BaseShader(std::unique_ptr&lt;HandleInterface&gt; handle_ptr)</code></p>
  
  <p>2.) If 1.) is true is <code>handle_.reset(handle_ptr.get());</code> the correct way of initializing my handle_ unique_ptr?</p>