From 476f21938f75553d6bff5e8780b537f7182c5675 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 9 Nov 2015 18:14:37 +0200 Subject: Make database class move-constructible This means it can be returned by value from a function in C++11. --- odb/oracle/auto-handle.hxx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'odb/oracle/auto-handle.hxx') diff --git a/odb/oracle/auto-handle.hxx b/odb/oracle/auto-handle.hxx index cdbda4f..f764fe2 100644 --- a/odb/oracle/auto-handle.hxx +++ b/odb/oracle/auto-handle.hxx @@ -7,6 +7,8 @@ #include +#include // ODB_CXX11 + #include #include @@ -125,6 +127,16 @@ namespace odb h_ = h; } +#ifdef ODB_CXX11 + auto_handle (auto_handle&& ah): h_ (ah.release ()) {} + auto_handle& operator= (auto_handle&& ah) + { + if (this != &ah) + reset (ah.release ()); + return *this; + } +#endif + private: auto_handle (const auto_handle&); auto_handle& operator= (const auto_handle&); @@ -198,6 +210,10 @@ namespace odb } private: + auto_handle (const auto_handle&); + auto_handle& operator= (const auto_handle&); + + private: OCISvcCtx* h_; OCIError* e_; }; @@ -259,6 +275,10 @@ namespace odb } private: + auto_handle (const auto_handle&); + auto_handle& operator= (const auto_handle&); + + private: OCIStmt* h_; ub4 release_mode_; OCIError* e_; -- cgit v1.1