From 8a9e1081c026a092c7dfb28fbd079b88850c7233 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 2 Mar 2012 12:34:54 +0200 Subject: Portability workarounds for incomplete C++11 support in VC++ and old GCC --- odb/details/config-vc.h | 8 +++++++- odb/details/config.hxx | 18 ++++++++++++++++++ odb/details/transfer-ptr.hxx | 2 ++ 3 files changed, 27 insertions(+), 1 deletion(-) (limited to 'odb/details') diff --git a/odb/details/config-vc.h b/odb/details/config-vc.h index 6b1da9e..56d69e7 100644 --- a/odb/details/config-vc.h +++ b/odb/details/config-vc.h @@ -11,10 +11,16 @@ #define ODB_THREADS_WIN32 #define ODB_THREADS_TLS_DECLSPEC -/* VC++10 has C++11 always enabled. +/* VC++10 and later have C++11 always enabled. */ #if _MSC_VER >= 1600 # define ODB_CXX11 +# define ODB_CXX11_NULLPTR +# if _MSC_VER >= 1800 +# define ODB_CXX11_DELETED_FUNCTION +# define ODB_CXX11_EXPLICIT_CONVERSION_OPERATOR +# define ODB_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGUMENT +# endif #endif #endif /* ODB_DETAILS_CONFIG_VC_H */ diff --git a/odb/details/config.hxx b/odb/details/config.hxx index ad0ec27..fc47ec7 100644 --- a/odb/details/config.hxx +++ b/odb/details/config.hxx @@ -14,9 +14,27 @@ # define LIBODB_STATIC_LIB # if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L # define ODB_CXX11 +# if __GNUC__ >= 4 && __GNUC_MINOR__ >= 6 +# define ODB_CXX_NULLPTR +# endif +# define ODB_CXX11_DELETED_FUNCTION +# define ODB_CXX11_EXPLICIT_CONVERSION_OPERATOR +# define ODB_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGUMENT # endif #else # include +# ifdef ODB_CXX11 +# ifdef __GNUC__ +# if __GNUC__ >= 4 && __GNUC_MINOR__ >= 6 +# define ODB_CXX_NULLPTR +# endif +# else +# define ODB_CXX_NULLPTR +# endif +# define ODB_CXX11_DELETED_FUNCTION +# define ODB_CXX11_EXPLICIT_CONVERSION_OPERATOR +# define ODB_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGUMENT +# endif #endif // no post diff --git a/odb/details/transfer-ptr.hxx b/odb/details/transfer-ptr.hxx index e7ad42c..5481252 100644 --- a/odb/details/transfer-ptr.hxx +++ b/odb/details/transfer-ptr.hxx @@ -27,7 +27,9 @@ namespace odb transfer_ptr (std::auto_ptr p): p_ (p.release ()) {} #ifdef ODB_CXX11 +#ifdef ODB_CXX11_NULLPTR transfer_ptr (std::nullptr_t): p_ (0) {} +#endif template transfer_ptr (std::unique_ptr&& p): p_ (p.release ()) {} -- cgit v1.1