std::unique_ptr::release() vs std::move()
<p>I have a class that represents a runtime context and builds a tree, the tree root is held in a <code>unique_ptr</code>. When building the tree is done I want to extract the tree. This is how it looks (not runnable, this is not a debugging question):</p>

<pre><code>class Context {
    private:
    std::unique_ptr&lt;Node&gt; root{new Node{}};
    public:
    // imagine a constructor, attributes and methods to build a tree
    std::unique_ptr&lt;Node&gt; extractTree() {
        return std::move(this-&gt;root);
    }
};
</code></pre>

<p>So I used <code>std::move()</code> to extract the root node from the <code>Context</code> instance. </p>

<p>However there are alternatives to using <code>std::move()</code> e.g.:</p>

<pre><code>std::unique_ptr&lt;Node&gt; extractTree() {
    // This seems less intuitive to me
    return std::unique_ptr&lt;Node&gt;{this-&gt;root.release()};
}
</code></pre>

<p>Is <code>std::move()</code> the best choice?</p>