unique_ptr in member initialization list
<p><strong>EDIT:</strong> I understand unique_ptr is non-copyable and can be only moved. i do not understand what happens with the initialization list.</p>

<p>Why unique_ptr in member initialization list can work as in the code snipt?</p>

<pre><code>#include &lt;memory&gt;

class MyObject
{
public:
    MyObject() : ptr(new int) // this works.
    MyObject() : ptr(std::unique_ptr&lt;int&gt;(new int)) 
    // i found this in many examples. but why this also work? 
    // i think this is using copy constructor as the bottom.        
    {
    }

    MyObject(MyObject&amp;&amp; other) : ptr(std::move(other.ptr))
    {
    }

    MyObject&amp; operator=(MyObject&amp;&amp; other)
    {
        ptr = std::move(other.ptr);
        return *this;
    }

private:
    std::unique_ptr&lt;int&gt; ptr;
};

int main() {
    MyObject o;
    std::unique_ptr&lt;int&gt; ptr (new int);
    // compile error, of course, since copy constructor is not allowed. 
    // but what is happening with member initialization list in above?
    std::unique_ptr&lt;int&gt; ptr2(ptr); 
}
</code></pre>