diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-06-15 18:50:51 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-06-15 18:50:51 +0200 |
commit | 13dd928ae18ef9610bc820b7b3e65629addea1d2 (patch) | |
tree | d9ee8ef03e3ee5a3be9925de08537b03cf29320b /odb/details/transfer-ptr.hxx | |
parent | b33321c4d05c0ac759bf3fcf647a568af8bfca0c (diff) |
Get rid of C++11 deprecation warnings for auto_ptr, exception specs
In particular, std::auto_ptr is no longer mapped in C++11.
Diffstat (limited to 'odb/details/transfer-ptr.hxx')
-rw-r--r-- | odb/details/transfer-ptr.hxx | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/odb/details/transfer-ptr.hxx b/odb/details/transfer-ptr.hxx index 13f113e..0e2d726 100644 --- a/odb/details/transfer-ptr.hxx +++ b/odb/details/transfer-ptr.hxx @@ -23,10 +23,22 @@ namespace odb transfer_ptr (): p_ (0) {} +#ifndef ODB_CXX11 template <typename T1> transfer_ptr (std::auto_ptr<T1> p): p_ (p.release ()) {} -#ifdef ODB_CXX11 + private: + transfer_ptr& operator= (const transfer_ptr&); + + public: + // In our usage transfer_ptr is always created implicitly and + // never const. So while this is not very clean, it is legal. + // Plus it will all go away once we drop C++98 (I can hardly + // wait). + // + transfer_ptr (const transfer_ptr& p) + : p_ (const_cast<transfer_ptr&> (p).transfer ()) {} +#else #ifdef ODB_CXX11_NULLPTR transfer_ptr (std::nullptr_t): p_ (0) {} #endif @@ -39,18 +51,6 @@ namespace odb public: transfer_ptr (transfer_ptr&& p): p_ (p.transfer ()) {} -#else - private: - transfer_ptr& operator= (const transfer_ptr&); - - public: - // In our usage transfer_ptr is always created implicitly and - // never const. So while this is not very clean, it is legal. - // Plus it will all go away once we drop C++98 (I can hardly - // wait). - // - transfer_ptr (const transfer_ptr& p) - : p_ (const_cast<transfer_ptr&> (p).transfer ()) {} #endif ~transfer_ptr () {delete p_;} |