Why does using std::move on a unique_ptr destroy it? : <p>So my understanding of move semantics is that this code:</p>

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

class hello {
public:
    ~hello() {
        std::cout &lt;&lt; "destroyed" &lt;&lt; std::endl;
    }
    hello() {
        std::cout &lt;&lt; "constructred" &lt;&lt; std::endl;
    }
};


void takecontrol(std::unique_ptr&lt;hello&gt;&amp;&amp; ptr) {

    ptr.release();
}

int main()
{
    auto ptr = std::make_unique&lt;hello&gt;();


}
</code></pre>

<p>should create a memory leak and only print "constructed."</p>

<p>yet when run (<a href="http://cpp.sh/2upqq" rel="nofollow noreferrer">http://cpp.sh/2upqq</a>) it destroys the object!</p>

<p>To me it seems it should be moved into <code>ptr</code> in <code>takecontrol</code> then released then not deleted so it shouldn't ever be destroyed.</p>

<p>What am I missing?</p>
