From 30c9eb1fb6f0525541e4b6dd33ed01de455b0b53 Mon Sep 17 00:00:00 2001 From: Gary Furnish Date: Mon, 21 Aug 2017 09:19:20 -0600 Subject: [PATCH] Fix c++11 detection. --- config/cxx.py | 2 +- include/boost/python/converter/registered.hpp | 2 +- include/boost/python/converter/shared_ptr_to_python.hpp | 2 +- include/boost/python/detail/is_shared_ptr.hpp | 2 +- include/boost/python/detail/type_traits.hpp | 5 +++-- include/boost/python/object/class_metadata.hpp | 2 +- include/boost/python/to_python_indirect.hpp | 2 +- include/boost/python/to_python_value.hpp | 2 +- 8 files changed, 10 insertions(+), 9 deletions(-) diff --git a/config/cxx.py b/config/cxx.py index ae34beb0..deb7be73 100644 --- a/config/cxx.py +++ b/config/cxx.py @@ -15,7 +15,7 @@ def add_options(vars): def check(context): - source = r"""#if __cplusplus < 201103L + source = r"""#if __cplusplus < 201103L && (!defined(_MSC_VER) || _MSC_VER < 1800) #error no C++11 #endif""" diff --git a/include/boost/python/converter/registered.hpp b/include/boost/python/converter/registered.hpp index 73f4d984..98013052 100644 --- a/include/boost/python/converter/registered.hpp +++ b/include/boost/python/converter/registered.hpp @@ -76,7 +76,7 @@ namespace detail registry::lookup_shared_ptr(type_id >()); } -#if __cplusplus >= 201103L +#if !defined(BOOST_NO_CXX11_SMART_PTR) template inline void register_shared_ptr0(std::shared_ptr*) diff --git a/include/boost/python/converter/shared_ptr_to_python.hpp b/include/boost/python/converter/shared_ptr_to_python.hpp index cc686461..02649d40 100644 --- a/include/boost/python/converter/shared_ptr_to_python.hpp +++ b/include/boost/python/converter/shared_ptr_to_python.hpp @@ -25,7 +25,7 @@ PyObject* shared_ptr_to_python(shared_ptr const& x) return converter::registered const&>::converters.to_python(&x); } -#if __cplusplus >= 201103L +#if !defined(BOOST_NO_CXX11_SMART_PTR) template PyObject* shared_ptr_to_python(std::shared_ptr const& x) { diff --git a/include/boost/python/detail/is_shared_ptr.hpp b/include/boost/python/detail/is_shared_ptr.hpp index bef0e05a..383383bc 100644 --- a/include/boost/python/detail/is_shared_ptr.hpp +++ b/include/boost/python/detail/is_shared_ptr.hpp @@ -13,7 +13,7 @@ namespace boost { namespace python { namespace detail { BOOST_PYTHON_IS_XXX_DEF(shared_ptr, shared_ptr, 1) -#if __cplusplus >= 201103L +#if !defined(BOOST_NO_CXX11_SMART_PTR) template struct is_shared_ptr > : std::true_type {}; #endif diff --git a/include/boost/python/detail/type_traits.hpp b/include/boost/python/detail/type_traits.hpp index df940c7e..381132ee 100644 --- a/include/boost/python/detail/type_traits.hpp +++ b/include/boost/python/detail/type_traits.hpp @@ -7,7 +7,8 @@ # define BOOST_PYTHON_DETAIL_TYPE_TRAITS_HPP -#if __cplusplus < 201103L +#if __cplusplus < 201103L && (!defined(BOOST_MSVC) || BOOST_MSVC<=1600) +#define BOOST_PYTHON_USE_BOOST_TYPES # include # include # include @@ -34,7 +35,7 @@ namespace boost { namespace python { namespace detail { -#if __cplusplus < 201103L +#if defined(BOOST_PYTHON_USE_BOOST_TYPES) using boost::alignment_of; using boost::add_const; using boost::add_cv; diff --git a/include/boost/python/object/class_metadata.hpp b/include/boost/python/object/class_metadata.hpp index 93303ecb..06d3f8ef 100644 --- a/include/boost/python/object/class_metadata.hpp +++ b/include/boost/python/object/class_metadata.hpp @@ -83,7 +83,7 @@ inline void register_shared_ptr_from_python_and_casts(T*, Bases) { // Constructor performs registration python::detail::force_instantiate(converter::shared_ptr_from_python()); -#if __cplusplus >= 201103L +#if !defined(BOOST_NO_CXX11_SMART_PTR) python::detail::force_instantiate(converter::shared_ptr_from_python()); #endif diff --git a/include/boost/python/to_python_indirect.hpp b/include/boost/python/to_python_indirect.hpp index 212e1db3..0a19aca5 100644 --- a/include/boost/python/to_python_indirect.hpp +++ b/include/boost/python/to_python_indirect.hpp @@ -83,7 +83,7 @@ namespace detail // copy constructor. # if defined(__ICL) && __ICL < 600 typedef boost::shared_ptr smart_pointer; -# elif __cplusplus < 201103L +# elif defined(BOOST_NO_CXX11_SMART_PTR) typedef std::auto_ptr smart_pointer; # else typedef std::unique_ptr smart_pointer; diff --git a/include/boost/python/to_python_value.hpp b/include/boost/python/to_python_value.hpp index 2066d3a2..b6ec0135 100644 --- a/include/boost/python/to_python_value.hpp +++ b/include/boost/python/to_python_value.hpp @@ -118,7 +118,7 @@ struct object_manager_get_pytype PyTypeObject const* get_pytype(boost::type &> *) const {return converter::registered::converters.to_python_target_type();} template PyTypeObject const* get_pytype(boost::type &> *) const {return converter::registered::converters.to_python_target_type();} -# if __cplusplus >= 201103L +# if !defined(BOOST_NO_CXX11_SMART_PTR) template PyTypeObject const* get_pytype(boost::type &> *) const {return converter::registered::converters.to_python_target_type();} template