Add a move constructor to Database

This makes it possible to e.g. return Databases from functions. Gated behind a __cplusplus >= 201103L check for compatibility with older C++ versions.
This commit is contained in:
hubslave 2018-03-29 16:48:16 +03:00 committed by GitHub
parent b454170da1
commit 65f719d82b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -120,6 +120,20 @@ public:
const int aBusyTimeoutMs = 0,
const std::string& aVfs = "");
#if __cplusplus >= 201103L
/**
* @brief Move an SQLite database connection.
*
* @param[in] aDb Database to move
*/
inline Database(Database&& aDb) noexcept :
mpSQLite(aDb.mpSQLite),
mFilename(std::move(aDb.mFilename))
{
aDb.mpSQLite = nullptr;
}
#endif
/**
* @brief Close the SQLite database connection.
*