title: How to write constructor for a smart pointer
body: <p>I am having some trouble writing the constructor for my UniquePtr class.
  Here is the UniquePtr constructor</p>
  <pre><code>UniquePtr::UniquePtr(Foo *ptr) {
      _ptr = ptr;
      Foo(myStr);
  }
  </code></pre>
  <p>Here is the Foo constructor</p>
  <pre><code>Foo::Foo( const string&amp; tag ) : _serial{++_count}, _tag{tag} {
      // If tag is empty, set it to the serial number
      cout &lt;&lt; &quot;*  c-tor - Foo S#: &quot; &lt;&lt; _serial
                &lt;&lt; ( _tag.length( ) &gt; 0 ? &quot; Tag: &quot; : &quot;&quot; ) &lt;&lt; _tag &lt;&lt; &quot;\n&quot;;
  }
  </code></pre>
  <p>And this is the instruction for what I need to do: &quot;Modify your constructor so that it will actually perform the memory allocation step during construction. Since the Foo class’s constructor takes an optional std::string argument, your new UniquePtr constructor should do the same. This parameter should default to the empty string. Pass the value from the UniquePtr constructor directly into the Foo constructor when you allocate the new object.&quot;
  What I should do with my constructor right now?</p>