aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac4
-rw-r--r--m4/cxx11.m438
-rw-r--r--odb/details/config-vc.h8
-rw-r--r--odb/details/config.h.in2
-rw-r--r--odb/details/config.hxx3
-rw-r--r--odb/details/unique-ptr.hxx80
-rw-r--r--odb/makefile7
7 files changed, 85 insertions, 57 deletions
diff --git a/configure.ac b/configure.ac
index 50f2122..5d5d213 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,10 +37,6 @@ AS_IF([test x$threads = xposix], AC_DEFINE([ODB_THREADS_POSIX], [1], [Have POSIX
AS_IF([test x$threads_thread_keyword = xyes], AC_DEFINE([ODB_THREADS_TLS_KEYWORD], [1], [Have __thread keyword.]))
-# Check for C++11.
-#
-CXX11([ODB_CXX11], [Compiling in the C++11 mode.])
-
# Define LIBODB_STATIC_LIB if we are build static library on certain platforms.
#
STATIC_LIB([LIBODB_STATIC_LIB], [Static library interface.])
diff --git a/m4/cxx11.m4 b/m4/cxx11.m4
deleted file mode 100644
index 774f20d..0000000
--- a/m4/cxx11.m4
+++ /dev/null
@@ -1,38 +0,0 @@
-dnl file : m4/cxx11.m4
-dnl copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC
-dnl license : GNU GPL v2; see accompanying LICENSE file
-dnl
-dnl CXX11(MACRO, DESCRIPTION)
-dnl
-dnl Check if we are compiling in the C++11 mode. If we are, define MACRO as
-dnl both a macro and conditional as well as set the cxx11 variable to 'yes'.
-dnl
-AC_DEFUN([CXX11],
-[
-cxx11=no
-
-AC_MSG_CHECKING([whether we are in C++11 mode])
-
-CXX_LIBTOOL_LINK_IFELSE(
-AC_LANG_SOURCE([[
-#include <memory>
-
-int
-main ()
-{
- std::shared_ptr<int> p (new int (10));
- *p = 11;
-}
-]]),
-[cxx11=yes])
-
-if test x"$cxx11" = xyes; then
- AC_MSG_RESULT([yes])
- AC_DEFINE([$1], [1], [$2])
-else
- AC_MSG_RESULT([no])
-fi
-
-AM_CONDITIONAL([$1], [test x$cxx11 = xyes])
-
-])dnl
diff --git a/odb/details/config-vc.h b/odb/details/config-vc.h
index 56d69e7..2c2990a 100644
--- a/odb/details/config-vc.h
+++ b/odb/details/config-vc.h
@@ -16,11 +16,9 @@
#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
+//# define ODB_CXX11_DELETED_FUNCTION
+//# define ODB_CXX11_EXPLICIT_CONVERSION_OPERATOR
+//# define ODB_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGUMENT
#endif
#endif /* ODB_DETAILS_CONFIG_VC_H */
diff --git a/odb/details/config.h.in b/odb/details/config.h.in
index 5e71765..2422d98 100644
--- a/odb/details/config.h.in
+++ b/odb/details/config.h.in
@@ -14,8 +14,6 @@
#undef ODB_THREADS_TLS_KEYWORD
#undef ODB_THREADS_TLS_DECLSPEC
-#undef ODB_CXX11
-
#undef LIBODB_STATIC_LIB
#endif /* ODB_DETAILS_CONFIG_H */
diff --git a/odb/details/config.hxx b/odb/details/config.hxx
index fc47ec7..36a8e3a 100644
--- a/odb/details/config.hxx
+++ b/odb/details/config.hxx
@@ -23,7 +23,8 @@
# endif
#else
# include <odb/details/config.h>
-# ifdef ODB_CXX11
+# if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
+# define ODB_CXX11
# ifdef __GNUC__
# if __GNUC__ >= 4 && __GNUC_MINOR__ >= 6
# define ODB_CXX_NULLPTR
diff --git a/odb/details/unique-ptr.hxx b/odb/details/unique-ptr.hxx
new file mode 100644
index 0000000..ab08d51
--- /dev/null
+++ b/odb/details/unique-ptr.hxx
@@ -0,0 +1,80 @@
+// file : odb/details/unique-ptr.hxx
+// copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_DETAILS_UNIQUE_PTR_HXX
+#define ODB_DETAILS_UNIQUE_PTR_HXX
+
+#include <odb/pre.hxx>
+
+namespace odb
+{
+ namespace details
+ {
+ template <typename T>
+ class unique_ptr
+ {
+ public:
+ typedef T element_type;
+
+ explicit unique_ptr (T* p = 0): p_ (p) {}
+ ~unique_ptr () {delete p_;}
+
+ private:
+ unique_ptr (const unique_ptr&);
+ unique_ptr& operator= (const unique_ptr&);
+
+ public:
+ T*
+ operator-> () const {return p_;}
+
+ T&
+ operator* () const {return *p_;}
+
+ typedef T* unique_ptr::*unspecified_bool_type;
+ operator unspecified_bool_type () const
+ {
+ return p_ != 0 ? &unique_ptr::p_ : 0;
+ }
+
+ T*
+ get () const {return p_;}
+
+ void
+ reset (T* p = 0)
+ {
+ delete p_;
+ p_ = p;
+ }
+
+ T*
+ release ()
+ {
+ T* r (p_);
+ p_ = 0;
+ return r;
+ }
+
+ private:
+ T* p_;
+ };
+
+ template <typename T1, typename T2>
+ inline bool
+ operator== (const unique_ptr<T1>& a, const unique_ptr<T2>& b)
+ {
+ return a.get () == b.get ();
+ }
+
+ template <typename T1, typename T2>
+ inline bool
+ operator!= (const unique_ptr<T1>& a, const unique_ptr<T2>& b)
+ {
+ return a.get () != b.get ();
+ }
+ }
+}
+
+#include <odb/post.hxx>
+
+#endif // ODB_DETAILS_UNIQUE_PTR_HXX
diff --git a/odb/makefile b/odb/makefile
index 26820d2..fd61513 100644
--- a/odb/makefile
+++ b/odb/makefile
@@ -79,10 +79,7 @@ endif
$(cxx_obj) $(cxx_od): $(odb.l.cpp-options) $(out_base)/details/config.h
$(odb.l.cpp-options): value := -I$(out_root) -I$(src_root)
-$(call include,$(bld_root)/cxx/standard.make) # cxx_standard
-
ifdef libodb_threads
-ifdef cxx_standard
$(out_base)/details/config.h: | $(out_base)/details/.
@echo '/* file : odb/details/config.h' >$@
@echo ' * note : automatically generated' >>$@
@@ -100,13 +97,9 @@ endif
ifeq ($(libodb_threads),none)
@echo '#define ODB_THREADS_NONE 1' >>$@
endif
-ifeq ($(cxx_standard),c++11)
- @echo '#define ODB_CXX11 1' >>$@
-endif
@echo '' >>$@
@echo '#endif /* ODB_DETAILS_CONFIG_H */' >>$@
endif
-endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(out_base)/details/config.h)