diff options
-rw-r--r-- | odb/connection.hxx | 8 | ||||
-rw-r--r-- | odb/connection.ixx | 12 | ||||
-rw-r--r-- | odb/database.hxx | 8 | ||||
-rw-r--r-- | odb/database.ixx | 12 | ||||
-rw-r--r-- | odb/details/config-vc.h | 3 | ||||
-rw-r--r-- | odb/details/config.hxx | 10 | ||||
-rw-r--r-- | odb/details/meta/polymorphic-p.hxx | 3 | ||||
-rw-r--r-- | odb/details/posix/exceptions.cxx | 2 | ||||
-rw-r--r-- | odb/details/posix/exceptions.hxx | 3 | ||||
-rw-r--r-- | odb/details/shared-ptr/base.cxx | 8 | ||||
-rw-r--r-- | odb/details/shared-ptr/base.hxx | 20 | ||||
-rw-r--r-- | odb/details/shared-ptr/base.ixx | 18 | ||||
-rw-r--r-- | odb/details/shared-ptr/exception.hxx | 4 | ||||
-rw-r--r-- | odb/details/transfer-ptr.hxx | 26 | ||||
-rw-r--r-- | odb/details/win32/exceptions.cxx | 2 | ||||
-rw-r--r-- | odb/details/win32/exceptions.hxx | 5 | ||||
-rw-r--r-- | odb/exception.hxx | 3 | ||||
-rw-r--r-- | odb/exceptions.cxx | 56 | ||||
-rw-r--r-- | odb/exceptions.hxx | 57 | ||||
-rw-r--r-- | odb/lazy-pointer-traits.hxx | 2 | ||||
-rw-r--r-- | odb/lazy-ptr.hxx | 23 | ||||
-rw-r--r-- | odb/lazy-ptr.ixx | 120 | ||||
-rw-r--r-- | odb/pointer-traits.hxx | 2 | ||||
-rw-r--r-- | odb/wrapper-traits.hxx | 2 |
24 files changed, 235 insertions, 174 deletions
diff --git a/odb/connection.hxx b/odb/connection.hxx index f1f8c3b..cbf9f6e 100644 --- a/odb/connection.hxx +++ b/odb/connection.hxx @@ -78,14 +78,14 @@ namespace odb void cache_query (const prepared_query<T>&); - template <typename T, typename P> - void - cache_query (const prepared_query<T>&, std::auto_ptr<P> params); - #ifdef ODB_CXX11 template <typename T, typename P> void cache_query (const prepared_query<T>&, std::unique_ptr<P> params); +#else + template <typename T, typename P> + void + cache_query (const prepared_query<T>&, std::auto_ptr<P> params); #endif template <typename T> diff --git a/odb/connection.ixx b/odb/connection.ixx index e86f8d8..1ed64bb 100644 --- a/odb/connection.ixx +++ b/odb/connection.ixx @@ -64,24 +64,24 @@ namespace odb cache_query_ (pq.impl_, typeid (T), 0, 0, 0); } +#ifdef ODB_CXX11 template <typename T, typename P> inline void connection:: - cache_query (const prepared_query<T>& pq, std::auto_ptr<P> params) + cache_query (const prepared_query<T>& pq, std::unique_ptr<P> params) { assert (pq); - assert (params.get () != 0); + assert (params); cache_query_ ( pq.impl_, typeid (T), params.get (), &typeid (P), ¶ms_deleter<P>); params.release (); } - -#ifdef ODB_CXX11 +#else template <typename T, typename P> inline void connection:: - cache_query (const prepared_query<T>& pq, std::unique_ptr<P> params) + cache_query (const prepared_query<T>& pq, std::auto_ptr<P> params) { assert (pq); - assert (params); + assert (params.get () != 0); cache_query_ ( pq.impl_, typeid (T), params.get (), &typeid (P), ¶ms_deleter<P>); params.release (); diff --git a/odb/database.hxx b/odb/database.hxx index adeb83a..2a25f7f 100644 --- a/odb/database.hxx +++ b/odb/database.hxx @@ -366,14 +366,14 @@ namespace odb void cache_query (const prepared_query<T>&); - template <typename T, typename P> - void - cache_query (const prepared_query<T>&, std::auto_ptr<P> params); - #ifdef ODB_CXX11 template <typename T, typename P> void cache_query (const prepared_query<T>&, std::unique_ptr<P> params); +#else + template <typename T, typename P> + void + cache_query (const prepared_query<T>&, std::auto_ptr<P> params); #endif template <typename T> diff --git a/odb/database.ixx b/odb/database.ixx index 1ea7949..47d4d70 100644 --- a/odb/database.ixx +++ b/odb/database.ixx @@ -687,21 +687,21 @@ namespace odb c.cache_query (pq); } +#ifdef ODB_CXX11 template <typename T, typename P> inline void database:: - cache_query (const prepared_query<T>& pq, std::auto_ptr<P> params) + cache_query (const prepared_query<T>& pq, std::unique_ptr<P> params) { connection_type& c (transaction::current ().connection ()); - c.cache_query (pq, params); + c.cache_query (pq, std::move (params)); } - -#ifdef ODB_CXX11 +#else template <typename T, typename P> inline void database:: - cache_query (const prepared_query<T>& pq, std::unique_ptr<P> params) + cache_query (const prepared_query<T>& pq, std::auto_ptr<P> params) { connection_type& c (transaction::current ().connection ()); - c.cache_query (pq, std::move (params)); + c.cache_query (pq, params); } #endif diff --git a/odb/details/config-vc.h b/odb/details/config-vc.h index a7f8c95..c187fe5 100644 --- a/odb/details/config-vc.h +++ b/odb/details/config-vc.h @@ -24,6 +24,9 @@ # define ODB_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGUMENT # define ODB_CXX11_VARIADIC_TEMPLATE # define ODB_CXX11_INITIALIZER_LIST +# if _MSC_VER >= 1900 +# define ODB_CXX11_NOEXCEPT +# endif # endif # endif #endif diff --git a/odb/details/config.hxx b/odb/details/config.hxx index c36b163..5aa35aa 100644 --- a/odb/details/config.hxx +++ b/odb/details/config.hxx @@ -16,6 +16,7 @@ # define ODB_CXX11 # if (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4 # define ODB_CXX11_NULLPTR +# define ODB_CXX11_NOEXCEPT # endif # define ODB_CXX11_DELETED_FUNCTION # define ODB_CXX11_EXPLICIT_CONVERSION_OPERATOR @@ -29,12 +30,15 @@ # define ODB_CXX11 # ifdef __clang__ // Pretends to be a really old __GNUC__ on some platforms. # define ODB_CXX11_NULLPTR +# define ODB_CXX11_NOEXCEPT # elif defined(__GNUC__) # if (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4 # define ODB_CXX11_NULLPTR +# define ODB_CXX11_NOEXCEPT # endif # else # define ODB_CXX11_NULLPTR +# define ODB_CXX11_NOEXCEPT # endif # define ODB_CXX11_DELETED_FUNCTION # define ODB_CXX11_EXPLICIT_CONVERSION_OPERATOR @@ -48,6 +52,12 @@ # endif #endif +#ifdef ODB_CXX11_NOEXCEPT +# define ODB_NOTHROW_NOEXCEPT noexcept +#else +# define ODB_NOTHROW_NOEXCEPT throw() +#endif + // no post #endif // ODB_DETAILS_CONFIG_HXX diff --git a/odb/details/meta/polymorphic-p.hxx b/odb/details/meta/polymorphic-p.hxx index bd90fc2..5315afc 100644 --- a/odb/details/meta/polymorphic-p.hxx +++ b/odb/details/meta/polymorphic-p.hxx @@ -7,6 +7,7 @@ #include <odb/pre.hxx> +#include <odb/details/config.hxx> // ODB_NOTHROW_NOEXCEPT #include <odb/details/meta/class-p.hxx> #include <odb/details/meta/remove-const-volatile.hxx> @@ -40,7 +41,7 @@ namespace odb t2 (); virtual - ~t2 () throw (); + ~t2 () ODB_NOTHROW_NOEXCEPT; }; static const bool result = sizeof (t1) == sizeof (t2); diff --git a/odb/details/posix/exceptions.cxx b/odb/details/posix/exceptions.cxx index 0ed0aa3..ecffa4f 100644 --- a/odb/details/posix/exceptions.cxx +++ b/odb/details/posix/exceptions.cxx @@ -9,7 +9,7 @@ namespace odb namespace details { const char* posix_exception:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "POSIX API error"; } diff --git a/odb/details/posix/exceptions.hxx b/odb/details/posix/exceptions.hxx index dd78313..7a40ac6 100644 --- a/odb/details/posix/exceptions.hxx +++ b/odb/details/posix/exceptions.hxx @@ -7,6 +7,7 @@ #include <odb/pre.hxx> +#include <odb/details/config.hxx> // ODB_NOTHROW_NOEXCEPT #include <odb/details/export.hxx> #include <odb/details/exception.hxx> @@ -22,7 +23,7 @@ namespace odb code () const {return code_;} virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual posix_exception* clone () const; diff --git a/odb/details/shared-ptr/base.cxx b/odb/details/shared-ptr/base.cxx index b95797b..5bfc0af 100644 --- a/odb/details/shared-ptr/base.cxx +++ b/odb/details/shared-ptr/base.cxx @@ -15,7 +15,7 @@ namespace odb share exclusive = share (2); const char* not_shared:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "object is not shared"; } @@ -54,7 +54,11 @@ namespace odb } void* +#ifdef ODB_CXX11 +operator new (size_t n, odb::details::share s) +#else operator new (size_t n, odb::details::share s) throw (std::bad_alloc) +#endif { if (s == odb::details::shared) { @@ -74,7 +78,7 @@ operator new (size_t n, odb::details::share s) throw (std::bad_alloc) } void -operator delete (void* p, odb::details::share s) throw () +operator delete (void* p, odb::details::share s) ODB_NOTHROW_NOEXCEPT { // This version of operator delete is only called when the c-tor // fails. In this case there is no object and we can just free the diff --git a/odb/details/shared-ptr/base.hxx b/odb/details/shared-ptr/base.hxx index 4a38945..90053e8 100644 --- a/odb/details/shared-ptr/base.hxx +++ b/odb/details/shared-ptr/base.hxx @@ -10,6 +10,7 @@ #include <new> #include <cstddef> // std::size_t +#include <odb/details/config.hxx> // ODB_CXX11, ODB_NOTHROW_NOEXCEPT #include <odb/details/export.hxx> #include <odb/details/shared-ptr/counter-type.hxx> @@ -34,11 +35,16 @@ namespace odb } } +#ifdef ODB_CXX11 +LIBODB_EXPORT void* +operator new (std::size_t, odb::details::share); +#else LIBODB_EXPORT void* operator new (std::size_t, odb::details::share) throw (std::bad_alloc); +#endif LIBODB_EXPORT void -operator delete (void*, odb::details::share) throw (); +operator delete (void*, odb::details::share) ODB_NOTHROW_NOEXCEPT; namespace odb { @@ -61,17 +67,25 @@ namespace odb std::size_t _ref_count () const; +#ifdef ODB_CXX11 + void* + operator new (std::size_t); + + void* + operator new (std::size_t, share); +#else void* operator new (std::size_t) throw (std::bad_alloc); void* operator new (std::size_t, share) throw (std::bad_alloc); +#endif void - operator delete (void*, share) throw (); + operator delete (void*, share) ODB_NOTHROW_NOEXCEPT; void - operator delete (void*) throw (); + operator delete (void*) ODB_NOTHROW_NOEXCEPT; struct refcount_callback { diff --git a/odb/details/shared-ptr/base.ixx b/odb/details/shared-ptr/base.ixx index 9bf7c94..3ed1339 100644 --- a/odb/details/shared-ptr/base.ixx +++ b/odb/details/shared-ptr/base.ixx @@ -63,6 +63,19 @@ namespace odb return counter_; } +#ifdef ODB_CXX11 + inline void* shared_base:: + operator new (std::size_t n) + { + return ::operator new (n); + } + + inline void* shared_base:: + operator new (std::size_t n, share) + { + return ::operator new (n); + } +#else inline void* shared_base:: operator new (std::size_t n) throw (std::bad_alloc) { @@ -74,15 +87,16 @@ namespace odb { return ::operator new (n); } +#endif inline void shared_base:: - operator delete (void* p, share) throw () + operator delete (void* p, share) ODB_NOTHROW_NOEXCEPT { ::operator delete (p); } inline void shared_base:: - operator delete (void* p) throw () + operator delete (void* p) ODB_NOTHROW_NOEXCEPT { ::operator delete (p); } diff --git a/odb/details/shared-ptr/exception.hxx b/odb/details/shared-ptr/exception.hxx index 99ed069..a006a35 100644 --- a/odb/details/shared-ptr/exception.hxx +++ b/odb/details/shared-ptr/exception.hxx @@ -8,6 +8,8 @@ #include <odb/pre.hxx> #include <odb/exception.hxx> + +#include <odb/details/config.hxx> // ODB_NOTHROW_NOEXCEPT #include <odb/details/export.hxx> namespace odb @@ -17,7 +19,7 @@ namespace odb struct LIBODB_EXPORT not_shared: exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual not_shared* clone () const; 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_;} diff --git a/odb/details/win32/exceptions.cxx b/odb/details/win32/exceptions.cxx index 0e52348..1067a28 100644 --- a/odb/details/win32/exceptions.cxx +++ b/odb/details/win32/exceptions.cxx @@ -9,7 +9,7 @@ namespace odb namespace details { const char* win32_exception:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "Win32 API error"; } diff --git a/odb/details/win32/exceptions.hxx b/odb/details/win32/exceptions.hxx index 7303bb7..1f8a4b2 100644 --- a/odb/details/win32/exceptions.hxx +++ b/odb/details/win32/exceptions.hxx @@ -7,9 +7,10 @@ #include <odb/pre.hxx> -#include <odb/details/win32/windows.hxx> +#include <odb/details/config.hxx> // ODB_NOTHROW_NOEXCEPT #include <odb/details/export.hxx> #include <odb/details/exception.hxx> +#include <odb/details/win32/windows.hxx> namespace odb { @@ -24,7 +25,7 @@ namespace odb code () const {return code_;} virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual win32_exception* clone () const; diff --git a/odb/exception.hxx b/odb/exception.hxx index 3a0b809..3ce587b 100644 --- a/odb/exception.hxx +++ b/odb/exception.hxx @@ -11,6 +11,7 @@ #include <odb/forward.hxx> // odb::core +#include <odb/details/config.hxx> // ODB_NOTHROW_NOEXCEPT #include <odb/details/export.hxx> #include <odb/details/shared-ptr/base.hxx> @@ -19,7 +20,7 @@ namespace odb struct LIBODB_EXPORT exception: std::exception, details::shared_base { virtual const char* - what () const throw () = 0; + what () const ODB_NOTHROW_NOEXCEPT = 0; virtual exception* clone () const = 0; diff --git a/odb/exceptions.cxx b/odb/exceptions.cxx index ebbc543..3ce1449 100644 --- a/odb/exceptions.cxx +++ b/odb/exceptions.cxx @@ -13,7 +13,7 @@ using namespace std; namespace odb { const char* null_pointer:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "NULL pointer"; } @@ -25,7 +25,7 @@ namespace odb } const char* already_in_transaction:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "transaction already in progress in this thread"; } @@ -37,7 +37,7 @@ namespace odb } const char* not_in_transaction:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "operation can only be performed in transaction"; } @@ -49,7 +49,7 @@ namespace odb } const char* transaction_already_finalized:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "transaction already committed or rolled back"; } @@ -61,7 +61,7 @@ namespace odb } const char* already_in_session:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "session already in effect in this thread"; } @@ -73,7 +73,7 @@ namespace odb } const char* not_in_session:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "session not in effect in this thread"; } @@ -85,7 +85,7 @@ namespace odb } const char* session_required:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "session required to load this object relationship"; } @@ -97,7 +97,7 @@ namespace odb } const char* deadlock:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "transaction aborted due to deadlock"; } @@ -109,7 +109,7 @@ namespace odb } const char* connection_lost:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "connection to database lost"; } @@ -121,7 +121,7 @@ namespace odb } const char* timeout:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "database operation timeout"; } @@ -133,7 +133,7 @@ namespace odb } const char* object_not_persistent:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "object not persistent"; } @@ -145,7 +145,7 @@ namespace odb } const char* object_already_persistent:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "object already persistent"; } @@ -157,7 +157,7 @@ namespace odb } const char* object_changed:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "object changed concurrently"; } @@ -169,7 +169,7 @@ namespace odb } const char* result_not_cached:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "query result is not cached"; } @@ -181,7 +181,7 @@ namespace odb } const char* abstract_class:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "database operation on instance of abstract class"; } @@ -193,7 +193,7 @@ namespace odb } const char* no_type_info:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "no type information"; } @@ -214,12 +214,12 @@ namespace odb } prepared_already_cached:: - ~prepared_already_cached () throw () + ~prepared_already_cached () ODB_NOTHROW_NOEXCEPT { } const char* prepared_already_cached:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return what_.c_str (); } @@ -240,12 +240,12 @@ namespace odb } prepared_type_mismatch:: - ~prepared_type_mismatch () throw () + ~prepared_type_mismatch () ODB_NOTHROW_NOEXCEPT { } const char* prepared_type_mismatch:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return what_.c_str (); } @@ -266,12 +266,12 @@ namespace odb } unknown_schema:: - ~unknown_schema () throw () + ~unknown_schema () ODB_NOTHROW_NOEXCEPT { } const char* unknown_schema:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return what_.c_str (); } @@ -293,12 +293,12 @@ namespace odb } unknown_schema_version:: - ~unknown_schema_version () throw () + ~unknown_schema_version () ODB_NOTHROW_NOEXCEPT { } const char* unknown_schema_version:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return what_.c_str (); } @@ -310,7 +310,7 @@ namespace odb } const char* section_not_loaded:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "section is not loaded"; } @@ -322,7 +322,7 @@ namespace odb } const char* section_not_in_object:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "section instance is not part of an object (section was copied?)"; } @@ -336,7 +336,7 @@ namespace odb // multiple_exceptions // multiple_exceptions:: - ~multiple_exceptions () throw () {} + ~multiple_exceptions () ODB_NOTHROW_NOEXCEPT {} void multiple_exceptions:: insert (size_t p, bool maybe, const odb::exception& e, bool fatal) @@ -418,7 +418,7 @@ namespace odb } const char* multiple_exceptions:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return what_.c_str (); } diff --git a/odb/exceptions.hxx b/odb/exceptions.hxx index b836291..afd034f 100644 --- a/odb/exceptions.hxx +++ b/odb/exceptions.hxx @@ -15,6 +15,7 @@ #include <odb/forward.hxx> // schema_version, odb::core #include <odb/exception.hxx> +#include <odb/details/config.hxx> // ODB_NOTHROW_NOEXCEPT #include <odb/details/export.hxx> #include <odb/details/shared-ptr.hxx> @@ -23,7 +24,7 @@ namespace odb struct LIBODB_EXPORT null_pointer: odb::exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual null_pointer* clone () const; @@ -34,7 +35,7 @@ namespace odb struct LIBODB_EXPORT already_in_transaction: odb::exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual already_in_transaction* clone () const; @@ -43,7 +44,7 @@ namespace odb struct LIBODB_EXPORT not_in_transaction: odb::exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual not_in_transaction* clone () const; @@ -52,7 +53,7 @@ namespace odb struct LIBODB_EXPORT transaction_already_finalized: odb::exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual transaction_already_finalized* clone () const; @@ -63,7 +64,7 @@ namespace odb struct LIBODB_EXPORT already_in_session: odb::exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual already_in_session* clone () const; @@ -72,7 +73,7 @@ namespace odb struct LIBODB_EXPORT not_in_session: odb::exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual not_in_session* clone () const; @@ -81,7 +82,7 @@ namespace odb struct LIBODB_EXPORT session_required: odb::exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual session_required* clone () const; @@ -97,7 +98,7 @@ namespace odb struct LIBODB_EXPORT connection_lost: recoverable { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual connection_lost* clone () const; @@ -106,7 +107,7 @@ namespace odb struct LIBODB_EXPORT timeout: recoverable { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual timeout* clone () const; @@ -115,7 +116,7 @@ namespace odb struct LIBODB_EXPORT deadlock: recoverable { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual deadlock* clone () const; @@ -124,7 +125,7 @@ namespace odb struct LIBODB_EXPORT object_not_persistent: odb::exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual object_not_persistent* clone () const; @@ -133,7 +134,7 @@ namespace odb struct LIBODB_EXPORT object_already_persistent: odb::exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual object_already_persistent* clone () const; @@ -142,7 +143,7 @@ namespace odb struct LIBODB_EXPORT object_changed: odb::exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual object_changed* clone () const; @@ -151,7 +152,7 @@ namespace odb struct LIBODB_EXPORT result_not_cached: odb::exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual result_not_cached* clone () const; @@ -167,7 +168,7 @@ namespace odb struct LIBODB_EXPORT abstract_class: odb::exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual abstract_class* clone () const; @@ -176,7 +177,7 @@ namespace odb struct LIBODB_EXPORT no_type_info: odb::exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual no_type_info* clone () const; @@ -187,7 +188,7 @@ namespace odb struct LIBODB_EXPORT prepared_already_cached: odb::exception { prepared_already_cached (const char* name); - ~prepared_already_cached () throw (); + ~prepared_already_cached () ODB_NOTHROW_NOEXCEPT; const char* name () const @@ -196,7 +197,7 @@ namespace odb } virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual prepared_already_cached* clone () const; @@ -209,13 +210,13 @@ namespace odb struct LIBODB_EXPORT prepared_type_mismatch: odb::exception { prepared_type_mismatch (const char* name); - ~prepared_type_mismatch () throw (); + ~prepared_type_mismatch () ODB_NOTHROW_NOEXCEPT; const char* name () const {return name_;} virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual prepared_type_mismatch* clone () const; @@ -230,13 +231,13 @@ namespace odb struct LIBODB_EXPORT unknown_schema: odb::exception { unknown_schema (const std::string& name); - ~unknown_schema () throw (); + ~unknown_schema () ODB_NOTHROW_NOEXCEPT; const std::string& name () const {return name_;} virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual unknown_schema* clone () const; @@ -249,13 +250,13 @@ namespace odb struct LIBODB_EXPORT unknown_schema_version: odb::exception { unknown_schema_version (schema_version); - ~unknown_schema_version () throw (); + ~unknown_schema_version () ODB_NOTHROW_NOEXCEPT; schema_version version () const {return version_;} virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual unknown_schema_version* clone () const; @@ -270,7 +271,7 @@ namespace odb struct LIBODB_EXPORT section_not_loaded: odb::exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual section_not_loaded* clone () const; @@ -279,7 +280,7 @@ namespace odb struct LIBODB_EXPORT section_not_in_object: odb::exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual section_not_in_object* clone () const; @@ -399,7 +400,7 @@ namespace odb // public: virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual multiple_exceptions* clone () const; @@ -413,7 +414,7 @@ namespace odb // Implementation details. // public: - ~multiple_exceptions () throw (); + ~multiple_exceptions () ODB_NOTHROW_NOEXCEPT; // All instances of the common exception must be equal since we are // going to create and share just one. diff --git a/odb/lazy-pointer-traits.hxx b/odb/lazy-pointer-traits.hxx index 12e0a08..bc9e64e 100644 --- a/odb/lazy-pointer-traits.hxx +++ b/odb/lazy-pointer-traits.hxx @@ -38,6 +38,7 @@ namespace odb } }; +#ifndef ODB_CXX11 template <typename T> class pointer_traits< lazy_auto_ptr<T> > { @@ -62,6 +63,7 @@ namespace odb return p.template object_id<O> (); } }; +#endif #ifdef ODB_CXX11 template <typename T, typename D> diff --git a/odb/lazy-ptr.hxx b/odb/lazy-ptr.hxx index ccc6c3c..2fca33a 100644 --- a/odb/lazy-ptr.hxx +++ b/odb/lazy-ptr.hxx @@ -116,6 +116,7 @@ namespace odb // std::auto_ptr lazy version. // +#ifndef ODB_CXX11 template <class T> struct lazy_auto_ptr_ref { @@ -203,11 +204,7 @@ namespace odb template <class DB> void reset (DB&, T*); template <class DB, class Y> void reset (DB&, std::auto_ptr<Y>&); -#ifdef ODB_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGUMENT - template <class O = T> -#else template <class O /* = T */> -#endif typename object_traits<O>::id_type object_id () const; database_type& database () const; @@ -223,6 +220,7 @@ namespace odb mutable std::auto_ptr<T> p_; mutable lazy_ptr_impl<T> i_; }; +#endif #ifdef ODB_CXX11 @@ -251,7 +249,7 @@ namespace odb lazy_unique_ptr (lazy_unique_ptr&&) /*noexcept*/; template <class T1, class D1> lazy_unique_ptr (lazy_unique_ptr<T1, D1>&&) /*noexcept*/; - template <class T1> lazy_unique_ptr (std::auto_ptr<T1>&&) /*noexcept*/; + //template <class T1> lazy_unique_ptr (std::auto_ptr<T1>&&) /*noexcept*/; #ifdef ODB_CXX11_NULLPTR lazy_unique_ptr& operator= (std::nullptr_t) /*noexcept*/; @@ -325,12 +323,12 @@ namespace odb template <class DB> lazy_unique_ptr (DB&, pointer, const deleter_type&); template <class DB> lazy_unique_ptr (DB&, pointer, deleter_type&&); template <class DB, class T1, class D1> lazy_unique_ptr (DB&, std::unique_ptr<T1, D1>&&); - template <class DB, class T1> lazy_unique_ptr (DB&, std::auto_ptr<T1>&&); + //template <class DB, class T1> lazy_unique_ptr (DB&, std::auto_ptr<T1>&&); template <class DB, class ID> void reset (DB&, const ID&); template <class DB> void reset (DB&, pointer); template <class DB, class T1, class D1> void reset (DB&, std::unique_ptr<T1, D1>&&); - template <class DB, class T1> void reset (DB&, std::auto_ptr<T1>&&); + //template <class DB, class T1> void reset (DB&, std::auto_ptr<T1>&&); #ifdef ODB_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGUMENT template <class O = T> @@ -413,7 +411,7 @@ namespace odb lazy_shared_ptr (lazy_shared_ptr&&) /*noexcept*/; template <class Y> lazy_shared_ptr (lazy_shared_ptr<Y>&&) /*noexcept*/; template <class Y> explicit lazy_shared_ptr (const lazy_weak_ptr<Y>&); - template <class Y> explicit lazy_shared_ptr (std::auto_ptr<Y>&&); + //template <class Y> explicit lazy_shared_ptr (std::auto_ptr<Y>&&); template <class Y, class D> lazy_shared_ptr (std::unique_ptr<Y, D>&&); ~lazy_shared_ptr (); @@ -422,7 +420,7 @@ namespace odb template <class Y> lazy_shared_ptr& operator= (const lazy_shared_ptr<Y>&) /*noexcept*/; lazy_shared_ptr& operator= (lazy_shared_ptr&&) /*noexcept*/; template <class Y> lazy_shared_ptr& operator= (lazy_shared_ptr<Y>&&) /*noexcept*/; - template <class Y> lazy_shared_ptr& operator= (std::auto_ptr<Y>&&); + //template <class Y> lazy_shared_ptr& operator= (std::auto_ptr<Y>&&); template <class Y, class D> lazy_shared_ptr& operator= (std::unique_ptr<Y, D>&&); void swap (lazy_shared_ptr&) /*noexcept*/; @@ -488,7 +486,7 @@ namespace odb template <class DB, class Y> lazy_shared_ptr (DB&, Y*); template <class DB, class Y, class D> lazy_shared_ptr (DB&, Y*, D); template <class DB, class Y, class D, class A> lazy_shared_ptr (DB&, Y*, D, A); - template <class DB, class Y> lazy_shared_ptr (DB&, std::auto_ptr<Y>&&); + //template <class DB, class Y> lazy_shared_ptr (DB&, std::auto_ptr<Y>&&); template <class DB, class Y> lazy_shared_ptr (DB&, const std::shared_ptr<Y>&); template <class DB, class Y> lazy_shared_ptr (DB&, std::shared_ptr<Y>&&); template <class DB, class Y> lazy_shared_ptr (DB&, const std::weak_ptr<Y>&); @@ -497,7 +495,7 @@ namespace odb template <class DB, class Y> void reset (DB&, Y*); template <class DB, class Y, class D> void reset (DB&, Y*, D); template <class DB, class Y, class D, class A> void reset (DB&, Y*, D, A); - template <class DB, class Y> void reset (DB&, std::auto_ptr<Y>&&); + //template <class DB, class Y> void reset (DB&, std::auto_ptr<Y>&&); template <class DB, class Y> void reset (DB&, const std::shared_ptr<Y>&); template <class DB, class Y> void reset (DB&, std::shared_ptr<Y>&&); @@ -661,7 +659,10 @@ namespace odb namespace common { using odb::lazy_ptr; + +#ifndef ODB_CXX11 using odb::lazy_auto_ptr; +#endif #ifdef ODB_CXX11 using odb::lazy_unique_ptr; diff --git a/odb/lazy-ptr.ixx b/odb/lazy-ptr.ixx index ccd95cc..52e6d7b 100644 --- a/odb/lazy-ptr.ixx +++ b/odb/lazy-ptr.ixx @@ -223,6 +223,7 @@ namespace odb // // lazy_auto_ptr_ref // +#ifndef ODB_CXX11 template <class T> inline lazy_auto_ptr_ref<T>:: @@ -487,6 +488,7 @@ namespace odb { return *i_.database (); } +#endif #ifdef ODB_CXX11 @@ -527,10 +529,10 @@ namespace odb lazy_unique_ptr (lazy_unique_ptr<T1, D1>&& r) : p_ (std::move (r.p_)), i_ (std::move (r.i_)) {} - template <class T, class D> - template <class T1> - lazy_unique_ptr<T, D>:: - lazy_unique_ptr (std::auto_ptr<T1>&& r): p_ (std::move (r)) {} + // template <class T, class D> + // template <class T1> + // lazy_unique_ptr<T, D>:: + // lazy_unique_ptr (std::auto_ptr<T1>&& r): p_ (std::move (r)) {} #ifdef ODB_CXX11_NULLPTR template <class T, class D> @@ -732,15 +734,15 @@ namespace odb i_.reset_db (db); } - template <class T, class D> - template <class DB, class T1> - inline lazy_unique_ptr<T, D>:: - lazy_unique_ptr (DB& db, std::auto_ptr<T1>&& p) - : p_ (std::move (p)) - { - if (p_) - i_.reset_db (db); - } + // template <class T, class D> + // template <class DB, class T1> + // inline lazy_unique_ptr<T, D>:: + // lazy_unique_ptr (DB& db, std::auto_ptr<T1>&& p) + // : p_ (std::move (p)) + // { + // if (p_) + // i_.reset_db (db); + // } template <class T, class D> template <class DB, class ID> @@ -777,18 +779,18 @@ namespace odb i_.reset (); } - template <class T, class D> - template <class DB, class T1> - inline void lazy_unique_ptr<T, D>:: - reset (DB& db, std::auto_ptr<T1>&& p) - { - p_ = std::unique_ptr<T, D> (std::move (p)); - - if (p_) - i_.reset_db (db); - else - i_.reset (); - } + // template <class T, class D> + // template <class DB, class T1> + // inline void lazy_unique_ptr<T, D>:: + // reset (DB& db, std::auto_ptr<T1>&& p) + // { + // p_ = std::unique_ptr<T, D> (std::move (p)); + // + // if (p_) + // i_.reset_db (db); + // else + // i_.reset (); + // } template <class T, class D> template <class O> @@ -943,10 +945,10 @@ namespace odb throw std::bad_weak_ptr (); } - template <class T> - template <class Y> - inline lazy_shared_ptr<T>:: - lazy_shared_ptr (std::auto_ptr<Y>&& r): p_ (std::move (r)) {} + // template <class T> + // template <class Y> + // inline lazy_shared_ptr<T>:: + // lazy_shared_ptr (std::auto_ptr<Y>&& r): p_ (std::move (r)) {} template <class T> template <class Y, class D> @@ -995,15 +997,15 @@ namespace odb return *this; } - template <class T> - template <class Y> - inline lazy_shared_ptr<T>& lazy_shared_ptr<T>:: - operator= (std::auto_ptr<Y>&& r) - { - p_ = std::move (r); - i_.reset (); - return *this; - } + // template <class T> + // template <class Y> + // inline lazy_shared_ptr<T>& lazy_shared_ptr<T>:: + // operator= (std::auto_ptr<Y>&& r) + // { + // p_ = std::move (r); + // i_.reset (); + // return *this; + // } template <class T> template <class Y, class D> @@ -1212,15 +1214,15 @@ namespace odb i_.reset_db (db); } - template <class T> - template <class DB, class Y> - inline lazy_shared_ptr<T>:: - lazy_shared_ptr (DB& db, std::auto_ptr<Y>&& r) - : p_ (std::move (r)) - { - if (p_) - i_.reset_db (db); - } + // template <class T> + // template <class DB, class Y> + // inline lazy_shared_ptr<T>:: + // lazy_shared_ptr (DB& db, std::auto_ptr<Y>&& r) + // : p_ (std::move (r)) + // { + // if (p_) + // i_.reset_db (db); + // } template <class T> template <class DB, class Y> @@ -1300,18 +1302,18 @@ namespace odb i_.reset (); } - template <class T> - template <class DB, class Y> - inline void lazy_shared_ptr<T>:: - reset (DB& db, std::auto_ptr<Y>&& r) - { - p_ = std::move (r); - - if (p_) - i_.reset_db (db); - else - i_.reset (); - } + // template <class T> + // template <class DB, class Y> + // inline void lazy_shared_ptr<T>:: + // reset (DB& db, std::auto_ptr<Y>&& r) + // { + // p_ = std::move (r); + // + // if (p_) + // i_.reset_db (db); + // else + // i_.reset (); + // } template <class T> template <class DB, class Y> diff --git a/odb/pointer-traits.hxx b/odb/pointer-traits.hxx index a20aa93..3bfaa6b 100644 --- a/odb/pointer-traits.hxx +++ b/odb/pointer-traits.hxx @@ -161,6 +161,7 @@ namespace odb // Specialization for std::auto_ptr. // +#ifndef ODB_CXX11 template <typename T> class pointer_traits< std::auto_ptr<T> > { @@ -230,6 +231,7 @@ namespace odb operator delete (p); } }; +#endif #ifdef ODB_CXX11 diff --git a/odb/wrapper-traits.hxx b/odb/wrapper-traits.hxx index 47b6701..6ed1b60 100644 --- a/odb/wrapper-traits.hxx +++ b/odb/wrapper-traits.hxx @@ -77,6 +77,7 @@ namespace odb // Specialization for std::auto_ptr. // +#ifndef ODB_CXX11 template <typename T> class wrapper_traits< std::auto_ptr<T> > { @@ -122,6 +123,7 @@ namespace odb return const_cast<unrestricted_wrapped_type&> (*p); } }; +#endif #ifdef ODB_CXX11 |