diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-11-09 18:14:37 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-11-09 18:14:37 +0200 |
commit | 644cba591ff6ec046ac4274b7c343dead847736e (patch) | |
tree | 70574b1ca044af28bccb01be7b4126aff3a63b42 /odb/database.hxx | |
parent | f18ea631bbe47a116a6b8ad6da5ab10a5be8158f (diff) |
Make database class move-constructible
This means it can be returned by value from a function in C++11.
Diffstat (limited to 'odb/database.hxx')
-rw-r--r-- | odb/database.hxx | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/odb/database.hxx b/odb/database.hxx index 8ee5c55..510b28b 100644 --- a/odb/database.hxx +++ b/odb/database.hxx @@ -32,6 +32,7 @@ #include <odb/details/export.hxx> #include <odb/details/mutex.hxx> #include <odb/details/c-string.hxx> +#include <odb/details/unique-ptr.hxx> #include <odb/details/function-wrapper.hxx> #include <odb/details/meta/answer.hxx> @@ -45,6 +46,18 @@ namespace odb virtual ~database (); +#ifdef ODB_CXX11 + database (database&&) = default; +#endif + + private: + database (const database&); + database& operator= (const database&); + +#ifdef ODB_CXX11 + database& operator= (const database&&); +#endif + // Object persistence API. // public: @@ -504,10 +517,6 @@ namespace odb protected: database (database_id); - private: - database (const database&); - database& operator= (const database&); - protected: virtual connection_type* connection_ () = 0; @@ -621,7 +630,7 @@ namespace odb tracer_type* tracer_; query_factory_map query_factory_map_; - mutable details::mutex mutex_; + details::unique_ptr<details::mutex> mutex_; // Dynamic for move support. mutable schema_version_map schema_version_map_; std::string schema_version_table_; unsigned int schema_version_seq_; |