aboutsummaryrefslogtreecommitdiff
path: root/odb/pgsql/database.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-11-09 18:14:37 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-11-09 18:14:37 +0200
commitfc70be62d8698496a20b6947d102757f426c5b3e (patch)
tree92610ee68abf5a1fcc40e8717c4011628865c601 /odb/pgsql/database.ixx
parentf5f515acc2b926eb838b82b457f6b5979db5f309 (diff)
Make database class move-constructible
This means it can be returned by value from a function in C++11.
Diffstat (limited to 'odb/pgsql/database.ixx')
-rw-r--r--odb/pgsql/database.ixx20
1 files changed, 20 insertions, 0 deletions
diff --git a/odb/pgsql/database.ixx b/odb/pgsql/database.ixx
index ab65be0..591a090 100644
--- a/odb/pgsql/database.ixx
+++ b/odb/pgsql/database.ixx
@@ -2,12 +2,32 @@
// copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file
+#include <utility> // move()
+
#include <odb/pgsql/transaction.hxx>
namespace odb
{
namespace pgsql
{
+#ifdef ODB_CXX11
+ inline database::
+ database (database&& db) // Has to be inline.
+ : odb::database (std::move (db)),
+ user_ (std::move (db.user_)),
+ password_ (std::move (db.password_)),
+ db_ (std::move (db.db_)),
+ host_ (std::move (db.host_)),
+ port_ (db.port_),
+ socket_ext_ (std::move (db.socket_ext_)),
+ extra_conninfo_ (std::move (db.extra_conninfo_)),
+ conninfo_ (std::move (db.conninfo_)),
+ factory_ (std::move (db.factory_))
+ {
+ factory_->database (*this); // New database instance.
+ }
+#endif
+
inline connection_ptr database::
connection ()
{