mirror of
https://github.com/cuberite/SQLiteCpp.git
synced 2025-08-04 17:56:13 -04:00
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:
parent
b454170da1
commit
65f719d82b
@ -120,6 +120,20 @@ public:
|
|||||||
const int aBusyTimeoutMs = 0,
|
const int aBusyTimeoutMs = 0,
|
||||||
const std::string& aVfs = "");
|
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.
|
* @brief Close the SQLite database connection.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user