diff options
Diffstat (limited to 'boost/python/detail')
-rw-r--r-- | boost/python/detail/borrowed_ptr.hpp | 3 | ||||
-rw-r--r-- | boost/python/detail/caller.hpp | 6 | ||||
-rw-r--r-- | boost/python/detail/config.hpp | 6 | ||||
-rwxr-xr-x | boost/python/detail/convertible.hpp | 4 | ||||
-rw-r--r-- | boost/python/detail/cv_category.hpp | 6 | ||||
-rw-r--r-- | boost/python/detail/dealloc.hpp | 2 | ||||
-rw-r--r-- | boost/python/detail/decorated_type_id.hpp | 2 | ||||
-rw-r--r-- | boost/python/detail/def_helper.hpp | 6 | ||||
-rw-r--r-- | boost/python/detail/defaults_def.hpp | 4 | ||||
-rw-r--r-- | boost/python/detail/destroy.hpp | 6 | ||||
-rw-r--r-- | boost/python/detail/invoke.hpp | 2 | ||||
-rw-r--r-- | boost/python/detail/pointee.hpp | 2 | ||||
-rw-r--r-- | boost/python/detail/result.hpp | 2 | ||||
-rw-r--r-- | boost/python/detail/string_literal.hpp | 3 | ||||
-rw-r--r-- | boost/python/detail/translate_exception.hpp | 6 | ||||
-rw-r--r-- | boost/python/detail/type_traits.hpp | 110 | ||||
-rwxr-xr-x | boost/python/detail/unwind_type.hpp | 6 | ||||
-rwxr-xr-x | boost/python/detail/value_arg.hpp | 5 | ||||
-rw-r--r-- | boost/python/detail/value_is_xxx.hpp | 9 | ||||
-rw-r--r-- | boost/python/detail/void_ptr.hpp | 2 | ||||
-rw-r--r-- | boost/python/detail/wrapper_base.hpp | 9 |
21 files changed, 153 insertions, 48 deletions
diff --git a/boost/python/detail/borrowed_ptr.hpp b/boost/python/detail/borrowed_ptr.hpp index d91d05c90f..7d78739ed9 100644 --- a/boost/python/detail/borrowed_ptr.hpp +++ b/boost/python/detail/borrowed_ptr.hpp @@ -8,8 +8,7 @@ # include <boost/config.hpp> # include <boost/type.hpp> # include <boost/mpl/if.hpp> -# include <boost/type_traits/object_traits.hpp> -# include <boost/type_traits/cv_traits.hpp> +# include <boost/python/detail/type_traits.hpp> # include <boost/python/tag.hpp> namespace boost { namespace python { namespace detail { diff --git a/boost/python/detail/caller.hpp b/boost/python/detail/caller.hpp index e479bf427d..c572d35aa9 100644 --- a/boost/python/detail/caller.hpp +++ b/boost/python/detail/caller.hpp @@ -16,6 +16,7 @@ # include <boost/python/detail/invoke.hpp> # include <boost/python/detail/signature.hpp> # include <boost/python/detail/preprocessor.hpp> +# include <boost/python/detail/type_traits.hpp> # include <boost/python/arg_from_python.hpp> # include <boost/python/converter/context_result_converter.hpp> @@ -31,9 +32,6 @@ # include <boost/compressed_pair.hpp> -# include <boost/type_traits/is_same.hpp> -# include <boost/type_traits/is_convertible.hpp> - # include <boost/mpl/apply.hpp> # include <boost/mpl/eval_if.hpp> # include <boost/mpl/identity.hpp> @@ -236,7 +234,7 @@ struct caller_arity<N> typedef typename select_result_converter<Policies, rtype>::type result_converter; static const signature_element ret = { - (boost::is_void<rtype>::value ? "void" : type_id<rtype>().name()) + (is_void<rtype>::value ? "void" : type_id<rtype>().name()) , &detail::converter_target_type<result_converter>::get_pytype , boost::detail::indirect_traits::is_reference_to_non_const<rtype>::value }; diff --git a/boost/python/detail/config.hpp b/boost/python/detail/config.hpp index c92ecb32b0..3e4b7c9e54 100644 --- a/boost/python/detail/config.hpp +++ b/boost/python/detail/config.hpp @@ -105,7 +105,11 @@ // Set the name of our library, this will get undef'ed by auto_link.hpp // once it's done with it: // -#define BOOST_LIB_NAME boost_python +#if PY_MAJOR_VERSION == 2 +# define BOOST_LIB_NAME boost_python +#elif PY_MAJOR_VERSION == 3 +# define BOOST_LIB_NAME boost_python3 +#endif // // If we're importing code from a dll, then tell auto_link.hpp about it: // diff --git a/boost/python/detail/convertible.hpp b/boost/python/detail/convertible.hpp index 2ce552f5f7..1ff350ec24 100755 --- a/boost/python/detail/convertible.hpp +++ b/boost/python/detail/convertible.hpp @@ -7,11 +7,11 @@ # if defined(__EDG_VERSION__) && __EDG_VERSION__ <= 241 # include <boost/mpl/if.hpp> -# include <boost/type_traits/conversion_traits.hpp> +# include <boost/python/detail/type_traits.hpp> # endif // Supplies a runtime is_convertible check which can be used with tag -// dispatching to work around the Metrowerks Pro7 limitation with boost::is_convertible +// dispatching to work around the Metrowerks Pro7 limitation with boost/std::is_convertible namespace boost { namespace python { namespace detail { typedef char* yes_convertible; diff --git a/boost/python/detail/cv_category.hpp b/boost/python/detail/cv_category.hpp index d32dd0fdbe..eb5a8eb9da 100644 --- a/boost/python/detail/cv_category.hpp +++ b/boost/python/detail/cv_category.hpp @@ -4,7 +4,7 @@ // http://www.boost.org/LICENSE_1_0.txt) #ifndef CV_CATEGORY_DWA200222_HPP # define CV_CATEGORY_DWA200222_HPP -# include <boost/type_traits/cv_traits.hpp> +# include <boost/python/detail/type_traits.hpp> namespace boost { namespace python { namespace detail { @@ -26,8 +26,8 @@ struct cv_category // BOOST_STATIC_CONSTANT(bool, c = is_const<T>::value); // BOOST_STATIC_CONSTANT(bool, v = is_volatile<T>::value); typedef cv_tag< - ::boost::is_const<T>::value - , ::boost::is_volatile<T>::value + is_const<T>::value + , is_volatile<T>::value > type; }; diff --git a/boost/python/detail/dealloc.hpp b/boost/python/detail/dealloc.hpp index f2d914b18c..ce07926ee1 100644 --- a/boost/python/detail/dealloc.hpp +++ b/boost/python/detail/dealloc.hpp @@ -1,4 +1,4 @@ -// Copyright Gottfried Ganßauge 2003. +// Copyright Gottfried Ganßauge 2003. // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/boost/python/detail/decorated_type_id.hpp b/boost/python/detail/decorated_type_id.hpp index 535508b43d..2596f3104a 100644 --- a/boost/python/detail/decorated_type_id.hpp +++ b/boost/python/detail/decorated_type_id.hpp @@ -7,7 +7,7 @@ # include <boost/python/type_id.hpp> # include <boost/python/detail/indirect_traits.hpp> -# include <boost/type_traits/cv_traits.hpp> +# include <boost/python/detail/type_traits.hpp> namespace boost { namespace python { namespace detail { diff --git a/boost/python/detail/def_helper.hpp b/boost/python/detail/def_helper.hpp index 92db09ed7b..24f9c5cdb2 100644 --- a/boost/python/detail/def_helper.hpp +++ b/boost/python/detail/def_helper.hpp @@ -6,12 +6,11 @@ # define DEF_HELPER_DWA200287_HPP # include <boost/python/args.hpp> -# include <boost/type_traits/same_traits.hpp> # include <boost/python/detail/indirect_traits.hpp> +# include <boost/python/detail/type_traits.hpp> # include <boost/mpl/not.hpp> # include <boost/mpl/and.hpp> # include <boost/mpl/or.hpp> -# include <boost/type_traits/add_reference.hpp> # include <boost/mpl/lambda.hpp> # include <boost/mpl/apply.hpp> # include <boost/tuple/tuple.hpp> @@ -73,7 +72,8 @@ namespace detail struct tuple_extract_base_select { typedef typename Tuple::head_type head_type; - typedef typename mpl::apply1<Predicate, typename add_reference<head_type>::type>::type match_t; + typedef typename mpl::apply1<Predicate, + typename add_lvalue_reference<head_type>::type>::type match_t; BOOST_STATIC_CONSTANT(bool, match = match_t::value); typedef typename tuple_extract_impl<match>::template apply<Tuple,Predicate> type; }; diff --git a/boost/python/detail/defaults_def.hpp b/boost/python/detail/defaults_def.hpp index 68799f83e6..a721b76794 100644 --- a/boost/python/detail/defaults_def.hpp +++ b/boost/python/detail/defaults_def.hpp @@ -12,7 +12,7 @@ #define DEFAULTS_DEF_JDG20020811_HPP #include <boost/python/detail/defaults_gen.hpp> -#include <boost/type_traits.hpp> +#include <boost/python/detail/type_traits.hpp> #include <boost/mpl/front.hpp> #include <boost/mpl/size.hpp> #include <boost/static_assert.hpp> @@ -238,7 +238,7 @@ namespace detail typedef typename OverloadsT::non_void_return_type non_void_return_type; typedef typename mpl::if_c< - boost::is_same<void, return_type>::value + is_same<void, return_type>::value , void_return_type , non_void_return_type >::type stubs_type; diff --git a/boost/python/detail/destroy.hpp b/boost/python/detail/destroy.hpp index 3ea6455330..d35b2b536e 100644 --- a/boost/python/detail/destroy.hpp +++ b/boost/python/detail/destroy.hpp @@ -5,7 +5,7 @@ #ifndef DESTROY_DWA2002221_HPP # define DESTROY_DWA2002221_HPP -# include <boost/type_traits/is_array.hpp> +# include <boost/python/detail/type_traits.hpp> # include <boost/detail/workaround.hpp> namespace boost { namespace python { namespace detail { @@ -30,7 +30,7 @@ struct value_destroyer<true> for (T const volatile* p = first; p != first + sizeof(A)/sizeof(T); ++p) { value_destroyer< - boost::is_array<T>::value + is_array<T>::value >::execute(p); } } @@ -48,7 +48,7 @@ inline void destroy_referent_impl(void* p, T& (*)()) // note: cv-qualification needed for MSVC6 // must come *before* T for metrowerks value_destroyer< - (boost::is_array<T>::value) + (is_array<T>::value) >::execute((const volatile T*)p); } diff --git a/boost/python/detail/invoke.hpp b/boost/python/detail/invoke.hpp index 939fa11818..4c5296ff12 100644 --- a/boost/python/detail/invoke.hpp +++ b/boost/python/detail/invoke.hpp @@ -11,8 +11,6 @@ # include <boost/python/detail/preprocessor.hpp> # include <boost/python/detail/none.hpp> -# include <boost/type_traits/is_member_function_pointer.hpp> - # include <boost/preprocessor/iterate.hpp> # include <boost/preprocessor/facilities/intercept.hpp> # include <boost/preprocessor/repetition/enum_trailing_params.hpp> diff --git a/boost/python/detail/pointee.hpp b/boost/python/detail/pointee.hpp index e18c1f49b6..e786b37626 100644 --- a/boost/python/detail/pointee.hpp +++ b/boost/python/detail/pointee.hpp @@ -5,7 +5,7 @@ #ifndef POINTEE_DWA2002323_HPP # define POINTEE_DWA2002323_HPP -# include <boost/type_traits/object_traits.hpp> +# include <boost/python/detail/type_traits.hpp> namespace boost { namespace python { namespace detail { diff --git a/boost/python/detail/result.hpp b/boost/python/detail/result.hpp index 8ccc3c5029..2390693a88 100644 --- a/boost/python/detail/result.hpp +++ b/boost/python/detail/result.hpp @@ -11,8 +11,8 @@ # include <boost/type.hpp> # include <boost/python/detail/preprocessor.hpp> +# include <boost/python/detail/type_traits.hpp> -# include <boost/type_traits/object_traits.hpp> # include <boost/mpl/if.hpp> # include <boost/preprocessor/comma_if.hpp> diff --git a/boost/python/detail/string_literal.hpp b/boost/python/detail/string_literal.hpp index a56e72ec6b..0961ec7c4e 100644 --- a/boost/python/detail/string_literal.hpp +++ b/boost/python/detail/string_literal.hpp @@ -7,8 +7,7 @@ # include <cstddef> # include <boost/type.hpp> -# include <boost/type_traits/array_traits.hpp> -# include <boost/type_traits/same_traits.hpp> +# include <boost/python/detail/type_traits.hpp> # include <boost/mpl/bool.hpp> # include <boost/detail/workaround.hpp> diff --git a/boost/python/detail/translate_exception.hpp b/boost/python/detail/translate_exception.hpp index df7ec2dd6c..877db2b2c6 100644 --- a/boost/python/detail/translate_exception.hpp +++ b/boost/python/detail/translate_exception.hpp @@ -6,11 +6,9 @@ # define TRANSLATE_EXCEPTION_TDS20091020_HPP # include <boost/python/detail/exception_handler.hpp> +# include <boost/python/detail/type_traits.hpp> # include <boost/call_traits.hpp> -# include <boost/type_traits/add_const.hpp> -# include <boost/type_traits/add_reference.hpp> -# include <boost/type_traits/remove_reference.hpp> # include <boost/function/function0.hpp> @@ -33,7 +31,7 @@ struct translate_exception typename add_const<ExceptionType>::type >::type exception_non_ref; # else - typedef typename add_reference< + typedef typename add_lvalue_reference< typename add_const<ExceptionType>::type >::type exception_cref; # endif diff --git a/boost/python/detail/type_traits.hpp b/boost/python/detail/type_traits.hpp new file mode 100644 index 0000000000..df940c7ea2 --- /dev/null +++ b/boost/python/detail/type_traits.hpp @@ -0,0 +1,110 @@ +// Copyright Shreyans Doshi 2017. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_PYTHON_DETAIL_TYPE_TRAITS_HPP +# define BOOST_PYTHON_DETAIL_TYPE_TRAITS_HPP + + +#if __cplusplus < 201103L +# include <boost/type_traits/transform_traits.hpp> +# include <boost/type_traits/same_traits.hpp> +# include <boost/type_traits/cv_traits.hpp> +# include <boost/type_traits/is_polymorphic.hpp> +# include <boost/type_traits/composite_traits.hpp> +# include <boost/type_traits/conversion_traits.hpp> +# include <boost/type_traits/add_pointer.hpp> +# include <boost/type_traits/remove_pointer.hpp> +# include <boost/type_traits/is_void.hpp> +# include <boost/type_traits/object_traits.hpp> +# include <boost/type_traits/add_lvalue_reference.hpp> +# include <boost/type_traits/function_traits.hpp> +# include <boost/type_traits/is_scalar.hpp> +# include <boost/type_traits/alignment_traits.hpp> +# include <boost/mpl/bool.hpp> +#else +# include <type_traits> +#endif + +# include <boost/type_traits/is_base_and_derived.hpp> +# include <boost/type_traits/alignment_traits.hpp> +# include <boost/type_traits/has_trivial_copy.hpp> + + +namespace boost { namespace python { namespace detail { + +#if __cplusplus < 201103L + using boost::alignment_of; + using boost::add_const; + using boost::add_cv; + using boost::add_lvalue_reference; + using boost::add_pointer; + + using boost::is_array; + using boost::is_class; + using boost::is_const; + using boost::is_convertible; + using boost::is_enum; + using boost::is_function; + using boost::is_integral; + using boost::is_lvalue_reference; + using boost::is_member_function_pointer; + using boost::is_member_pointer; + using boost::is_pointer; + using boost::is_polymorphic; + using boost::is_reference; + using boost::is_same; + using boost::is_scalar; + using boost::is_union; + using boost::is_void; + using boost::is_volatile; + + using boost::remove_reference; + using boost::remove_pointer; + using boost::remove_cv; + using boost::remove_const; + + using boost::mpl::true_; + using boost::mpl::false_; +#else + using std::alignment_of; + using std::add_const; + using std::add_cv; + using std::add_lvalue_reference; + using std::add_pointer; + + using std::is_array; + using std::is_class; + using std::is_const; + using std::is_convertible; + using std::is_enum; + using std::is_function; + using std::is_integral; + using std::is_lvalue_reference; + using std::is_member_function_pointer; + using std::is_member_pointer; + using std::is_pointer; + using std::is_polymorphic; + using std::is_reference; + using std::is_same; + using std::is_scalar; + using std::is_union; + using std::is_void; + using std::is_volatile; + + using std::remove_reference; + using std::remove_pointer; + using std::remove_cv; + using std::remove_const; + + using true_ = std::integral_constant<bool, true>; + using false_ = std::integral_constant<bool, false>; +#endif + using boost::is_base_and_derived; + using boost::type_with_alignment; + using boost::has_trivial_copy; +}}} // namespace boost::python::detail + + +#endif //BOOST_DETAIL_TYPE_TRAITS_HPP diff --git a/boost/python/detail/unwind_type.hpp b/boost/python/detail/unwind_type.hpp index 9a997c9dbd..f6cdab64fe 100755 --- a/boost/python/detail/unwind_type.hpp +++ b/boost/python/detail/unwind_type.hpp @@ -7,7 +7,7 @@ # include <boost/python/detail/cv_category.hpp> # include <boost/python/detail/indirect_traits.hpp> -# include <boost/type_traits/object_traits.hpp> +# include <boost/python/detail/type_traits.hpp> namespace boost { namespace python { namespace detail { @@ -155,10 +155,10 @@ unwind_type(boost::type<U>*p =0, Generator* =0) #endif { BOOST_STATIC_CONSTANT(int, indirection - = (boost::is_pointer<U>::value ? pointer_ : 0) + = (is_pointer<U>::value ? pointer_ : 0) + (indirect_traits::is_reference_to_pointer<U>::value ? reference_to_pointer_ - : boost::is_reference<U>::value + : is_lvalue_reference<U>::value ? reference_ : 0)); diff --git a/boost/python/detail/value_arg.hpp b/boost/python/detail/value_arg.hpp index 747588d6fd..2c938dacca 100755 --- a/boost/python/detail/value_arg.hpp +++ b/boost/python/detail/value_arg.hpp @@ -6,8 +6,7 @@ # include <boost/python/detail/copy_ctor_mutates_rhs.hpp> # include <boost/mpl/if.hpp> -# include <boost/type_traits/add_reference.hpp> -# include <boost/type_traits/add_const.hpp> +# include <boost/python/detail/indirect_traits.hpp> namespace boost { namespace python { namespace detail { @@ -16,7 +15,7 @@ struct value_arg : mpl::if_< copy_ctor_mutates_rhs<T> , T - , typename add_reference< + , typename add_lvalue_reference< typename add_const<T>::type >::type > diff --git a/boost/python/detail/value_is_xxx.hpp b/boost/python/detail/value_is_xxx.hpp index fbb9defd0b..e270f89ca3 100644 --- a/boost/python/detail/value_is_xxx.hpp +++ b/boost/python/detail/value_is_xxx.hpp @@ -9,11 +9,11 @@ # include <boost/mpl/bool.hpp> # include <boost/preprocessor/enum_params.hpp> - -# include <boost/type_traits/remove_reference.hpp> -# include <boost/type_traits/remove_cv.hpp> +# include <boost/python/detail/type_traits.hpp> # include <boost/python/detail/is_xxx.hpp> +namespace boost { namespace python { namespace detail { + # define BOOST_PYTHON_VALUE_IS_XXX_DEF(name, qualified_name, nargs) \ template <class X_> \ struct value_is_##name \ @@ -24,9 +24,10 @@ struct value_is_##name \ typename remove_reference<X_>::type \ >::type \ >::value); \ - typedef mpl::bool_<value> type; \ + typedef mpl::bool_<value> type; \ \ }; +}}} // namespace boost::python::detail #endif // VALUE_IS_XXX_DWA2003224_HPP diff --git a/boost/python/detail/void_ptr.hpp b/boost/python/detail/void_ptr.hpp index 06f680104d..5543b23a4a 100644 --- a/boost/python/detail/void_ptr.hpp +++ b/boost/python/detail/void_ptr.hpp @@ -5,7 +5,7 @@ #ifndef VOID_PTR_DWA200239_HPP # define VOID_PTR_DWA200239_HPP -# include <boost/type_traits/remove_cv.hpp> +# include <boost/python/detail/type_traits.hpp> namespace boost { namespace python { namespace detail { diff --git a/boost/python/detail/wrapper_base.hpp b/boost/python/detail/wrapper_base.hpp index 2a79e0c528..60ac99436e 100644 --- a/boost/python/detail/wrapper_base.hpp +++ b/boost/python/detail/wrapper_base.hpp @@ -5,8 +5,7 @@ # define WRAPPER_BASE_DWA2004722_HPP # include <boost/python/detail/prefix.hpp> -# include <boost/type_traits/is_polymorphic.hpp> -# include <boost/mpl/bool.hpp> +# include <boost/python/detail/type_traits.hpp> namespace boost { namespace python { @@ -21,14 +20,14 @@ namespace detail inline PyObject* get_owner(wrapper_base const volatile& w); inline PyObject* - owner_impl(void const volatile* /*x*/, mpl::false_) + owner_impl(void const volatile* /*x*/, detail::false_) { return 0; } template <class T> inline PyObject* - owner_impl(T const volatile* x, mpl::true_); + owner_impl(T const volatile* x, detail::true_); template <class T> inline PyObject* @@ -59,7 +58,7 @@ namespace detail { template <class T> inline PyObject* - owner_impl(T const volatile* x, mpl::true_) + owner_impl(T const volatile* x, detail::true_) { if (wrapper_base const volatile* w = dynamic_cast<wrapper_base const volatile*>(x)) { |