Default move constructor
<p>I have a database class and the explicit constructor tries to connect to the database based on flags passed in, if it fails then it throws. This is not desired (the database may not of been created by another app) so I added a blank constructor and default move constructors. In a utility class I wait until the database is created and move a new one in.</p>

<p>In unit tests I see that the <code>database_utils::connected()</code> returns false before I move and true after the move. However if I call a function that uses the database I get a <code>library routine called out of sequence</code> error. This would suggest I haven't opened the database or a malformed select statement but the constructors and destructor are called in the correct order and I have unit tests for the database itself where it creates the database, populates it and the select statement works.</p>

<p>So my question: <strong>Is the default move actually moving it or not? If not what do I need to do to obtain the expected behaviour?</strong></p>

<p>Sample code:</p>

<pre><code>class database
{
    database() : connected_(false), database_(nullptr) { }
    database(/* params */) : connected_(false), database_(nullptr) { 
        /* attempt connection, throw on fail */
        connected_ = true;
    }
    database(database&amp; other) = default;
    database(database&amp;&amp; other) = default;
    database&amp; operator=(database&amp;&amp; other) = default;
    ~database() { /* clean up */ }
    operator bool() const { return connected_; }

    bool connected_;
    sqlite3* database_;
};

class database_utils
{
    database_utils() : db_() { }
    void connect() {
        db_ = std::move(database(/*params*/));
    }
    bool connected() { return db_; }
    void example_select(/* params */) {
        /* use db_ */
    }
    database db_;
};
</code></pre>