Implement Database move constructors for MSVC #190

Added checks to proper _MSC_VER 1600 (VS2010)
This commit is contained in:
Sébastien Rombauts 2019-03-03 21:44:00 +01:00
parent cb6c16aadb
commit 678562e727
3 changed files with 23 additions and 2 deletions

View File

@ -127,4 +127,8 @@ Version 2.3.0 - March 3 2019
- Added tests for all MSVC compilers available on AppVeyor (2013, 2015, 2017) #169
- Update VariadicBind.h #172
- Better CMake compatibility #170
- Add implicit cast operator to char and short types #179 #180
- Add implicit cast operator to char and short types #179 #180
Version ?
- #191 CMake Warning line 299
- #190 Implement move constructors

View File

@ -120,7 +120,7 @@ public:
const int aBusyTimeoutMs = 0,
const std::string& aVfs = "");
#if __cplusplus >= 201103L
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)
/**
* @brief Move an SQLite database connection.
*

View File

@ -63,6 +63,23 @@ TEST(Database, ctorExecCreateDropExist) {
remove("test.db3");
}
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)
TEST(Database, moveConstructor) {
remove("test.db3");
{
// Create a new database
SQLite::Database db("test.db3", SQLite::OPEN_READWRITE | SQLite::OPEN_CREATE);
EXPECT_FALSE(db.tableExists("test"));
EXPECT_TRUE(db.getHandle() != NULL);
SQLite::Database moved = std::move(db);
EXPECT_TRUE(db.getHandle() == NULL);
EXPECT_TRUE(moved.getHandle() != NULL);
EXPECT_FALSE(moved.tableExists("test"));
} // Close DB test.db3
remove("test.db3");
}
#endif
TEST(Database, createCloseReopen) {
remove("test.db3");
{