diff options
-rw-r--r-- | odb/object-result.hxx | 32 | ||||
-rw-r--r-- | odb/view-result.hxx | 17 |
2 files changed, 49 insertions, 0 deletions
diff --git a/odb/object-result.hxx b/odb/object-result.hxx index a2cd92d..759c9f5 100644 --- a/odb/object-result.hxx +++ b/odb/object-result.hxx @@ -9,11 +9,13 @@ #include <cstddef> // std::ptrdiff_t, std::size_t #include <iterator> // iterator categories +#include <utility> // std::move #include <odb/forward.hxx> #include <odb/result.hxx> #include <odb/pointer-traits.hxx> +#include <odb/details/config.hxx> // ODB_CXX11 #include <odb/details/shared-ptr.hxx> namespace odb @@ -132,12 +134,27 @@ namespace odb size () = 0; protected: +#ifdef ODB_CXX11 + void + current (pointer_type& p) + { + current_ = std::move (p); + guard_.reset (current_); + } + + void + current (pointer_type&& p) + { + current (p); + } +#else void current (pointer_type p) { current_ = p; guard_.reset (current_); } +#endif bool begin_; bool end_; @@ -231,12 +248,27 @@ namespace odb size () = 0; protected: +#ifdef ODB_CXX11 + void + current (pointer_type& p) + { + current_ = std::move (p); + guard_.reset (current_); + } + + void + current (pointer_type&& p) + { + current (p); + } +#else void current (pointer_type p) { current_ = p; guard_.reset (current_); } +#endif bool begin_; bool end_; diff --git a/odb/view-result.hxx b/odb/view-result.hxx index e6de6cb..dbe77a8 100644 --- a/odb/view-result.hxx +++ b/odb/view-result.hxx @@ -9,11 +9,13 @@ #include <cstddef> // std::ptrdiff_t, std::size_t #include <iterator> // iterator categories +#include <utility> // std::move #include <odb/forward.hxx> #include <odb/result.hxx> #include <odb/pointer-traits.hxx> +#include <odb/details/config.hxx> // ODB_CXX11 #include <odb/details/shared-ptr.hxx> namespace odb @@ -96,12 +98,27 @@ namespace odb size () = 0; protected: +#ifdef ODB_CXX11 + void + current (pointer_type& p) + { + current_ = std::move (p); + guard_.reset (current_); + } + + void + current (pointer_type&& p) + { + current (p); + } +#else void current (pointer_type p) { current_ = p; guard_.reset (current_); } +#endif bool begin_; bool end_; |