diff --git a/include/SQLiteCpp/Statement.h b/include/SQLiteCpp/Statement.h index 199aebd..c5c6e3f 100644 --- a/include/SQLiteCpp/Statement.h +++ b/include/SQLiteCpp/Statement.h @@ -654,6 +654,12 @@ private: Ptr(sqlite3* apSQLite, std::string& aQuery); // Copy constructor increments the ref counter Ptr(const Ptr& aPtr); + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600) + // Move constructor + Ptr(Ptr&& aPtr); +#endif + // Decrement the ref counter and finalize the sqlite3_stmt when it reaches 0 ~Ptr(); diff --git a/src/Statement.cpp b/src/Statement.cpp index a890697..1dd9bdf 100644 --- a/src/Statement.cpp +++ b/src/Statement.cpp @@ -456,6 +456,18 @@ Statement::Ptr::Ptr(const Statement::Ptr& aPtr) : ++(*mpRefCount); } +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600) +Statement::Ptr::Ptr(Ptr&& aPtr) : + mpSQLite(aPtr.mpSQLite), + mpStmt(aPtr.mpStmt), + mpRefCount(aPtr.mpRefCount) +{ + aPtr.mpSQLite = NULL; + aPtr.mpStmt = NULL; + aPtr.mpRefCount = NULL; +} +#endif + /** * @brief Decrement the ref counter and finalize the sqlite3_stmt when it reaches 0 */