From 63d45d2fddcab8c633bc457f51da261a3ff1815f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Sat, 17 Jan 2015 19:59:33 +0100 Subject: [PATCH] Updated type traits workaround deleted copy constructors --- include/boost/move/detail/meta_utils.hpp | 38 ++++---------------- include/boost/move/detail/type_traits.hpp | 44 +++++++++++++++++++---- 2 files changed, 43 insertions(+), 39 deletions(-) diff --git a/include/boost/move/detail/meta_utils.hpp b/include/boost/move/detail/meta_utils.hpp index 1104a28..70fbc05 100644 --- a/include/boost/move/detail/meta_utils.hpp +++ b/include/boost/move/detail/meta_utils.hpp @@ -116,39 +116,13 @@ struct add_const ////////////////////////////////////// template struct add_lvalue_reference -{ - typedef T& type; -}; +{ typedef T& type; }; -template -struct add_lvalue_reference -{ - typedef T& type; -}; - -template<> -struct add_lvalue_reference -{ - typedef void type; -}; - -template<> -struct add_lvalue_reference -{ - typedef const void type; -}; - -template<> -struct add_lvalue_reference -{ - typedef volatile void type; -}; - -template<> -struct add_lvalue_reference -{ - typedef const volatile void type; -}; +template struct add_lvalue_reference { typedef T& type; }; +template<> struct add_lvalue_reference { typedef void type; }; +template<> struct add_lvalue_reference { typedef const void type; }; +template<> struct add_lvalue_reference { typedef volatile void type; }; +template<> struct add_lvalue_reference{ typedef const volatile void type; }; template struct add_const_lvalue_reference diff --git a/include/boost/move/detail/type_traits.hpp b/include/boost/move/detail/type_traits.hpp index 0ee31aa..cef0f20 100644 --- a/include/boost/move/detail/type_traits.hpp +++ b/include/boost/move/detail/type_traits.hpp @@ -104,7 +104,9 @@ # define BOOST_MOVE_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T) # endif # if __has_feature(has_trivial_copy) -# define BOOST_MOVE_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T)) +# //There are problems with deleted copy constructors detected as trivially copyable. +# //http://stackoverflow.com/questions/12754886/has-trivial-copy-behaves-differently-in-clang-and-gcc-whos-right +# define BOOST_MOVE_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) && ::boost::move_detail::is_copy_constructible::value) # endif # if __has_feature(has_trivial_assign) # define BOOST_MOVE_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) ) @@ -529,6 +531,35 @@ struct is_function : is_function_impl {}; +////////////////////////////////////// +// is_arithmetic +////////////////////////////////////// +template +struct is_arithmetic +{ + static const bool value = is_floating_point::value || + is_integral::value; +}; + +////////////////////////////////////// +// is_member_function_pointer +////////////////////////////////////// +template +struct is_member_function_pointer_cv +{ + static const bool value = false; +}; + +template +struct is_member_function_pointer_cv + : is_function +{}; + +template +struct is_member_function_pointer + : is_member_function_pointer_cv::type> +{}; + ////////////////////////////////////// // is_enum ////////////////////////////////////// @@ -537,15 +568,14 @@ struct is_function template struct is_enum_nonintrinsic { - static const bool value = !is_void::value && - !is_floating_point::value && - !is_integral::value && + static const bool value = !is_arithmetic::value && + !is_reference::value && + !is_class_or_union::value && + !is_array::value && + !is_void::value && !is_nullptr_t::value && !is_member_pointer::value && !is_pointer::value && - !is_array::value && - !is_class_or_union::value && - !is_reference::value && !is_function::value; }; #endif