aboutsummaryrefslogtreecommitdiff
path: root/odb/details
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-03-02 12:34:54 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-03-02 12:34:54 +0200
commit8a9e1081c026a092c7dfb28fbd079b88850c7233 (patch)
treef44ba71ea18365b8d9c1a97c09b624a0c4d150dc /odb/details
parent0f25b194dcbcfa95a80284069999dd92341ce36d (diff)
Portability workarounds for incomplete C++11 support in VC++ and old GCC
Diffstat (limited to 'odb/details')
-rw-r--r--odb/details/config-vc.h8
-rw-r--r--odb/details/config.hxx18
-rw-r--r--odb/details/transfer-ptr.hxx2
3 files changed, 27 insertions, 1 deletions
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 <odb/details/config.h>
+# 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<T1> p): p_ (p.release ()) {}
#ifdef ODB_CXX11
+#ifdef ODB_CXX11_NULLPTR
transfer_ptr (std::nullptr_t): p_ (0) {}
+#endif
template <typename T1>
transfer_ptr (std::unique_ptr<T1>&& p): p_ (p.release ()) {}