diff options
Diffstat (limited to 'boost/type_traits')
155 files changed, 3704 insertions, 3926 deletions
diff --git a/boost/type_traits/add_const.hpp b/boost/type_traits/add_const.hpp index 0a27f8a971..a9fb781c78 100644 --- a/boost/type_traits/add_const.hpp +++ b/boost/type_traits/add_const.hpp @@ -10,10 +10,7 @@ #ifndef BOOST_TT_ADD_CONST_HPP_INCLUDED #define BOOST_TT_ADD_CONST_HPP_INCLUDED -#include <boost/config.hpp> - -// should be the last #include -#include <boost/type_traits/detail/type_trait_def.hpp> +#include <boost/type_traits/detail/config.hpp> namespace boost { @@ -30,16 +27,20 @@ namespace boost { # pragma warning(disable:4181) // warning C4181: qualifier applied to reference type ignored #endif -BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_const,T,T const) + template <class T> struct add_const + { + typedef T const type; + }; #if defined(BOOST_MSVC) # pragma warning(pop) #endif -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,add_const,T&,T&) + template <class T> struct add_const<T&> + { + typedef T& type; + }; } // namespace boost -#include <boost/type_traits/detail/type_trait_undef.hpp> - #endif // BOOST_TT_ADD_CONST_HPP_INCLUDED diff --git a/boost/type_traits/add_cv.hpp b/boost/type_traits/add_cv.hpp index 66625c66c2..e62ddee0c4 100644 --- a/boost/type_traits/add_cv.hpp +++ b/boost/type_traits/add_cv.hpp @@ -13,9 +13,6 @@ #include <boost/config.hpp> -// should be the last #include -#include <boost/type_traits/detail/type_trait_def.hpp> - namespace boost { // * convert a type T to a const volatile type - add_cv<T> @@ -31,16 +28,14 @@ namespace boost { # pragma warning(disable:4181) // warning C4181: qualifier applied to reference type ignored #endif -BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_cv,T,T const volatile) +template <class T> struct add_cv{ typedef T const volatile type; }; #if defined(BOOST_MSVC) # pragma warning(pop) #endif -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,add_cv,T&,T&) +template <class T> struct add_cv<T&>{ typedef T& type; }; } // namespace boost -#include <boost/type_traits/detail/type_trait_undef.hpp> - #endif // BOOST_TT_ADD_CV_HPP_INCLUDED diff --git a/boost/type_traits/add_lvalue_reference.hpp b/boost/type_traits/add_lvalue_reference.hpp index 1d7579476a..41851a1f34 100644 --- a/boost/type_traits/add_lvalue_reference.hpp +++ b/boost/type_traits/add_lvalue_reference.hpp @@ -8,19 +8,20 @@ #include <boost/type_traits/add_reference.hpp> -// should be the last #include -#include <boost/type_traits/detail/type_trait_def.hpp> - namespace boost{ -BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_lvalue_reference,T,typename boost::add_reference<T>::type) +template <class T> struct add_lvalue_reference +{ + typedef typename boost::add_reference<T>::type type; +}; #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,add_lvalue_reference,T&&,T&) +template <class T> struct add_lvalue_reference<T&&> +{ + typedef T& type; +}; #endif } -#include <boost/type_traits/detail/type_trait_undef.hpp> - #endif // BOOST_TYPE_TRAITS_EXT_ADD_LVALUE_REFERENCE__HPP diff --git a/boost/type_traits/add_pointer.hpp b/boost/type_traits/add_pointer.hpp index 3e0e481894..745f63a084 100644 --- a/boost/type_traits/add_pointer.hpp +++ b/boost/type_traits/add_pointer.hpp @@ -11,13 +11,8 @@ #include <boost/type_traits/remove_reference.hpp> -// should be the last #include -#include <boost/type_traits/detail/type_trait_def.hpp> - namespace boost { -namespace detail { - #if defined(__BORLANDC__) && (__BORLANDC__ < 0x5A0) // // For some reason this implementation stops Borlands compiler @@ -25,27 +20,27 @@ namespace detail { // to arrays for some reason though (shrug...) (JM 20021104) // template <typename T> -struct add_pointer_impl +struct add_pointer { typedef T* type; }; template <typename T> -struct add_pointer_impl<T&> +struct add_pointer<T&> { typedef T* type; }; template <typename T> -struct add_pointer_impl<T&const> +struct add_pointer<T&const> { typedef T* type; }; template <typename T> -struct add_pointer_impl<T&volatile> +struct add_pointer<T&volatile> { typedef T* type; }; template <typename T> -struct add_pointer_impl<T&const volatile> +struct add_pointer<T&const volatile> { typedef T* type; }; @@ -53,7 +48,7 @@ struct add_pointer_impl<T&const volatile> #else template <typename T> -struct add_pointer_impl +struct add_pointer { typedef typename remove_reference<T>::type no_ref_type; typedef no_ref_type* type; @@ -61,12 +56,6 @@ struct add_pointer_impl #endif -} // namespace detail - -BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_pointer,T,typename boost::detail::add_pointer_impl<T>::type) - } // namespace boost -#include <boost/type_traits/detail/type_trait_undef.hpp> - #endif // BOOST_TT_ADD_POINTER_HPP_INCLUDED diff --git a/boost/type_traits/add_reference.hpp b/boost/type_traits/add_reference.hpp index 5e3efca692..526f259c87 100644 --- a/boost/type_traits/add_reference.hpp +++ b/boost/type_traits/add_reference.hpp @@ -9,13 +9,9 @@ #ifndef BOOST_TT_ADD_REFERENCE_HPP_INCLUDED #define BOOST_TT_ADD_REFERENCE_HPP_INCLUDED -#include <boost/type_traits/is_reference.hpp> #include <boost/detail/workaround.hpp> #include <boost/config.hpp> -// should be the last #include -#include <boost/type_traits/detail/type_trait_def.hpp> - namespace boost { namespace detail { @@ -26,47 +22,38 @@ namespace detail { // template <typename T> -struct add_reference_rvalue_layer +struct add_reference_impl { typedef T& type; }; #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template <typename T> -struct add_reference_rvalue_layer<T&&> +struct add_reference_impl<T&&> { typedef T&& type; }; #endif -template <typename T> -struct add_reference_impl +} // namespace detail + +template <class T> struct add_reference { - typedef typename add_reference_rvalue_layer<T>::type type; + typedef typename boost::detail::add_reference_impl<T>::type type; +}; +template <class T> struct add_reference<T&> +{ + typedef T& type; }; - -BOOST_TT_AUX_TYPE_TRAIT_IMPL_PARTIAL_SPEC1_1(typename T,add_reference,T&,T&) // these full specialisations are always required: -BOOST_TT_AUX_TYPE_TRAIT_IMPL_SPEC1(add_reference,void,void) +template <> struct add_reference<void> { typedef void type; }; #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_TYPE_TRAIT_IMPL_SPEC1(add_reference,void const,void const) -BOOST_TT_AUX_TYPE_TRAIT_IMPL_SPEC1(add_reference,void volatile,void volatile) -BOOST_TT_AUX_TYPE_TRAIT_IMPL_SPEC1(add_reference,void const volatile,void const volatile) -#endif - -} // namespace detail - -BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_reference,T,typename boost::detail::add_reference_impl<T>::type) - -// agurt, 07/mar/03: workaround Borland's ill-formed sensitivity to an additional -// level of indirection, here -#if BOOST_WORKAROUND(__BORLANDC__, < 0x600) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,add_reference,T&,T&) +template <> struct add_reference<const void> { typedef void type; }; +template <> struct add_reference<const volatile void> { typedef void type; }; +template <> struct add_reference<volatile void> { typedef void type; }; #endif } // namespace boost -#include <boost/type_traits/detail/type_trait_undef.hpp> - #endif // BOOST_TT_ADD_REFERENCE_HPP_INCLUDED diff --git a/boost/type_traits/add_rvalue_reference.hpp b/boost/type_traits/add_rvalue_reference.hpp index 242716f09c..44ead34803 100644 --- a/boost/type_traits/add_rvalue_reference.hpp +++ b/boost/type_traits/add_rvalue_reference.hpp @@ -15,9 +15,6 @@ #include <boost/type_traits/is_void.hpp> #include <boost/type_traits/is_reference.hpp> -// should be the last #include -#include <boost/type_traits/detail/type_trait_def.hpp> - //----------------------------------------------------------------------------// // // // C++03 implementation of // @@ -56,11 +53,12 @@ namespace type_traits_detail { } -BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_rvalue_reference,T,typename boost::type_traits_detail::add_rvalue_reference_imp<T>::type) +template <class T> struct add_rvalue_reference +{ + typedef typename boost::type_traits_detail::add_rvalue_reference_imp<T>::type type; +}; } // namespace boost -#include <boost/type_traits/detail/type_trait_undef.hpp> - #endif // BOOST_TYPE_TRAITS_EXT_ADD_RVALUE_REFERENCE__HPP diff --git a/boost/type_traits/add_volatile.hpp b/boost/type_traits/add_volatile.hpp index 86b529798e..24f515c802 100644 --- a/boost/type_traits/add_volatile.hpp +++ b/boost/type_traits/add_volatile.hpp @@ -12,9 +12,6 @@ #include <boost/config.hpp> -// should be the last #include -#include <boost/type_traits/detail/type_trait_def.hpp> - namespace boost { // * convert a type T to volatile type - add_volatile<T> @@ -30,16 +27,14 @@ namespace boost { # pragma warning(disable:4181) // warning C4181: qualifier applied to reference type ignored #endif -BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_volatile,T,T volatile) +template <class T> struct add_volatile{ typedef T volatile type; }; #if defined(BOOST_MSVC) # pragma warning(pop) #endif -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,add_volatile,T&,T&) +template <class T> struct add_volatile<T&>{ typedef T& type; }; } // namespace boost -#include <boost/type_traits/detail/type_trait_undef.hpp> - #endif // BOOST_TT_ADD_VOLATILE_HPP_INCLUDED diff --git a/boost/type_traits/aligned_storage.hpp b/boost/type_traits/aligned_storage.hpp index 5420f26738..09f0c6b885 100755..100644 --- a/boost/type_traits/aligned_storage.hpp +++ b/boost/type_traits/aligned_storage.hpp @@ -1,13 +1,138 @@ +//----------------------------------------------------------------------------- +// boost aligned_storage.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2002-2003 +// Eric Friedman, Itay Maman +// +// 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_TT_ALIGNED_STORAGE_HPP +#define BOOST_TT_ALIGNED_STORAGE_HPP + +#include <cstddef> // for std::size_t + +#include "boost/config.hpp" +#include "boost/detail/workaround.hpp" +#include "boost/type_traits/alignment_of.hpp" +#include "boost/type_traits/type_with_alignment.hpp" +#include "boost/type_traits/is_pod.hpp" +#include "boost/type_traits/conditional.hpp" + +namespace boost { + +namespace detail { namespace aligned_storage { + +BOOST_STATIC_CONSTANT( + std::size_t + , alignment_of_max_align = ::boost::alignment_of<boost::detail::max_align>::value + ); + +// +// To be TR1 conforming this must be a POD type: +// +template < + std::size_t size_ + , std::size_t alignment_ +> +struct aligned_storage_imp +{ + union data_t + { + char buf[size_]; + + typename ::boost::type_with_alignment<alignment_>::type align_; + } data_; + void* address() const { return const_cast<aligned_storage_imp*>(this); } +}; +template <std::size_t size> +struct aligned_storage_imp<size, std::size_t(-1)> +{ + union data_t + { + char buf[size]; + ::boost::detail::max_align align_; + } data_; + void* address() const { return const_cast<aligned_storage_imp*>(this); } +}; + +template< std::size_t alignment_ > +struct aligned_storage_imp<0u,alignment_> +{ + /* intentionally empty */ + void* address() const { return 0; } +}; -// Copyright (C) John Maddock 2005. -// Use, modification and distribution are subject to 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). +}} // namespace detail::aligned_storage + +template < + std::size_t size_ + , std::size_t alignment_ = std::size_t(-1) +> +class aligned_storage : +#ifndef __BORLANDC__ + private +#else + public +#endif + ::boost::detail::aligned_storage::aligned_storage_imp<size_, alignment_> +{ + +public: // constants + + typedef ::boost::detail::aligned_storage::aligned_storage_imp<size_, alignment_> type; + + BOOST_STATIC_CONSTANT( + std::size_t + , size = size_ + ); + BOOST_STATIC_CONSTANT( + std::size_t + , alignment = ( + alignment_ == std::size_t(-1) + ? ::boost::detail::aligned_storage::alignment_of_max_align + : alignment_ + ) + ); + +private: // noncopyable + + aligned_storage(const aligned_storage&); + aligned_storage& operator=(const aligned_storage&); + +public: // structors + + aligned_storage() + { + } + + ~aligned_storage() + { + } + +public: // accessors + + void* address() + { + return static_cast<type*>(this)->address(); + } + + const void* address() const + { + return static_cast<const type*>(this)->address(); + } +}; + +// +// Make sure that is_pod recognises aligned_storage<>::type +// as a POD (Note that aligned_storage<> itself is not a POD): // -// See http://www.boost.org/libs/type_traits for most recent version including documentation. +template <std::size_t size_, std::size_t alignment_> +struct is_pod< ::boost::detail::aligned_storage::aligned_storage_imp<size_, alignment_> > : public true_type{}; -#ifndef BOOST_TT_ALIGNED_STORAGE_HPP_INCLUDED -# define BOOST_TT_ALIGNED_STORAGE_HPP_INCLUDED -# include <boost/aligned_storage.hpp> -#endif // BOOST_TT_ALIGNED_STORAGE_HPP_INCLUDED +} // namespace boost +#endif // BOOST_ALIGNED_STORAGE_HPP diff --git a/boost/type_traits/alignment_of.hpp b/boost/type_traits/alignment_of.hpp index 31a5f3839f..7d960e3184 100644 --- a/boost/type_traits/alignment_of.hpp +++ b/boost/type_traits/alignment_of.hpp @@ -13,8 +13,7 @@ #include <cstddef> #include <boost/type_traits/intrinsics.hpp> -// should be the last #include -#include <boost/type_traits/detail/size_t_trait_def.hpp> +#include <boost/type_traits/integral_constant.hpp> #ifdef BOOST_MSVC # pragma warning(push) @@ -86,29 +85,25 @@ struct alignment_of_impl } // namespace detail -BOOST_TT_AUX_SIZE_T_TRAIT_DEF1(alignment_of,T,::boost::detail::alignment_of_impl<T>::value) +template <class T> struct alignment_of : public integral_constant<std::size_t, ::boost::detail::alignment_of_impl<T>::value>{}; // references have to be treated specially, assume // that a reference is just a special pointer: -template <typename T> -struct alignment_of<T&> - : public alignment_of<T*> -{ -}; +template <typename T> struct alignment_of<T&> : public alignment_of<T*>{}; + #ifdef __BORLANDC__ // long double gives an incorrect value of 10 (!) // unless we do this... struct long_double_wrapper{ long double ld; }; -template<> struct alignment_of<long double> - : public alignment_of<long_double_wrapper>{}; +template<> struct alignment_of<long double> : public alignment_of<long_double_wrapper>{}; #endif // void has to be treated specially: -BOOST_TT_AUX_SIZE_T_TRAIT_SPEC1(alignment_of,void,0) +template<> struct alignment_of<void> : integral_constant<std::size_t, 0>{}; #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_SIZE_T_TRAIT_SPEC1(alignment_of,void const,0) -BOOST_TT_AUX_SIZE_T_TRAIT_SPEC1(alignment_of,void volatile,0) -BOOST_TT_AUX_SIZE_T_TRAIT_SPEC1(alignment_of,void const volatile,0) +template<> struct alignment_of<void const> : integral_constant<std::size_t, 0>{}; +template<> struct alignment_of<void const volatile> : integral_constant<std::size_t, 0>{}; +template<> struct alignment_of<void volatile> : integral_constant<std::size_t, 0>{}; #endif } // namespace boost @@ -120,7 +115,5 @@ BOOST_TT_AUX_SIZE_T_TRAIT_SPEC1(alignment_of,void const volatile,0) # pragma warning(pop) #endif -#include <boost/type_traits/detail/size_t_trait_undef.hpp> - #endif // BOOST_TT_ALIGNMENT_OF_HPP_INCLUDED diff --git a/boost/type_traits/broken_compiler_spec.hpp b/boost/type_traits/broken_compiler_spec.hpp index 3a13273594..030840f1c4 100644 --- a/boost/type_traits/broken_compiler_spec.hpp +++ b/boost/type_traits/broken_compiler_spec.hpp @@ -1,14 +1,21 @@ -// Copyright 2001-2003 Aleksey Gurtovoy. +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. // Use, modification and distribution are subject to 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). // // See http://www.boost.org/libs/type_traits for most recent version including documentation. -#ifndef BOOST_TT_BROKEN_COMPILER_SPEC_HPP_INCLUDED -#define BOOST_TT_BROKEN_COMPILER_SPEC_HPP_INCLUDED - -#include <boost/type_traits/config.hpp> +#ifndef BOOST_TT_BROKEN_SPEC_HPP_INCLUDED +#define BOOST_TT_BROKEN_SPEC_HPP_INCLUDED +// +// This header is deprecated and no longer used by type_traits: +// +#if defined(__GNUC__) || defined(_MSC_VER) +# pragma message("NOTE: Use of this header (boost/type_traits/broken_compiler_spec.hpp) is deprecated") #endif + +#endif // BOOST_TT_CONFIG_HPP_INCLUDED + + diff --git a/boost/type_traits/common_type.hpp b/boost/type_traits/common_type.hpp index b52ff167eb..5c4303b9ec 100644 --- a/boost/type_traits/common_type.hpp +++ b/boost/type_traits/common_type.hpp @@ -1,157 +1,144 @@ -// common_type.hpp ---------------------------------------------------------// - -// Copyright 2008 Howard Hinnant -// Copyright 2008 Beman Dawes +#ifndef BOOST_TYPE_TRAITS_COMMON_TYPE_HPP_INCLUDED +#define BOOST_TYPE_TRAITS_COMMON_TYPE_HPP_INCLUDED +// +// Copyright 2015 Peter Dimov +// // Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - -#ifndef BOOST_TYPE_TRAITS_COMMON_TYPE_HPP -#define BOOST_TYPE_TRAITS_COMMON_TYPE_HPP +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// #include <boost/config.hpp> +#include <boost/type_traits/decay.hpp> +#include <boost/type_traits/declval.hpp> -#if defined(__SUNPRO_CC) && !defined(BOOST_COMMON_TYPE_DONT_USE_TYPEOF) -# define BOOST_COMMON_TYPE_DONT_USE_TYPEOF -#endif -#if defined(__IBMCPP__) && !defined(BOOST_COMMON_TYPE_DONT_USE_TYPEOF) -# define BOOST_COMMON_TYPE_DONT_USE_TYPEOF +#if defined(BOOST_NO_CXX11_DECLTYPE) +#include <boost/type_traits/detail/common_type_impl.hpp> #endif -//----------------------------------------------------------------------------// -#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_COMMON_TYPE_ARITY) -#define BOOST_COMMON_TYPE_ARITY 3 +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +#include <boost/type_traits/detail/mp_defer.hpp> #endif -//----------------------------------------------------------------------------// -#if defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_COMMON_TYPE_DONT_USE_TYPEOF) -#include <boost/typeof/typeof.hpp> // boost wonders never cease! -#endif +namespace boost +{ -//----------------------------------------------------------------------------// -#ifndef BOOST_NO_CXX11_STATIC_ASSERT -#define BOOST_COMMON_TYPE_STATIC_ASSERT(CND, MSG, TYPES) static_assert(CND,MSG) -#elif defined(BOOST_COMMON_TYPE_USES_MPL_ASSERT) -#include <boost/mpl/assert.hpp> -#include <boost/mpl/bool.hpp> -#define BOOST_COMMON_TYPE_STATIC_ASSERT(CND, MSG, TYPES) \ - BOOST_MPL_ASSERT_MSG(boost::mpl::bool_< (CND) >::type::value, MSG, TYPES) -#else -#include <boost/static_assert.hpp> -#define BOOST_COMMON_TYPE_STATIC_ASSERT(CND, MSG, TYPES) BOOST_STATIC_ASSERT(CND) -#endif +// variadic common_type -#if !defined(BOOST_NO_CXX11_STATIC_ASSERT) || !defined(BOOST_COMMON_TYPE_USES_MPL_ASSERT) -#define BOOST_COMMON_TYPE_MUST_BE_A_COMPLE_TYPE "must be complete type" -#endif - -#if defined(BOOST_NO_CXX11_DECLTYPE) && defined(BOOST_COMMON_TYPE_DONT_USE_TYPEOF) -#include <boost/type_traits/detail/common_type_imp.hpp> -#include <boost/type_traits/remove_cv.hpp> -#endif -#include <boost/mpl/if.hpp> -#include <boost/utility/declval.hpp> -#include <boost/type_traits/add_rvalue_reference.hpp> - -//----------------------------------------------------------------------------// -// // -// C++03 implementation of // -// 20.9.7.6 Other transformations [meta.trans.other] // -// Written by Howard Hinnant // -// Adapted for Boost by Beman Dawes, Vicente Botet and Jeffrey Hellrung // -// // -//----------------------------------------------------------------------------// - -namespace boost { - -// prototype #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - template<typename... T> - struct common_type; -#else // or no specialization - template <class T, class U = void, class V = void> - struct common_type - { - public: - typedef typename common_type<typename common_type<T, U>::type, V>::type type; - }; -#endif +template<class... T> struct common_type +{ +}; + +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) + +template<class... T> using common_type_t = typename common_type<T...>::type; + +namespace type_traits_detail +{ + +template<class T1, class T2, class... T> using common_type_fold = common_type_t<common_type_t<T1, T2>, T...>; + +} // namespace type_traits_detail + +template<class T1, class T2, class... T> +struct common_type<T1, T2, T...>: type_traits_detail::mp_defer<type_traits_detail::common_type_fold, T1, T2, T...> +{ +}; -// 1 arg - template<typename T> -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - struct common_type<T> #else - struct common_type<T, void, void> -#endif - { - BOOST_COMMON_TYPE_STATIC_ASSERT(sizeof(T) > 0, BOOST_COMMON_TYPE_MUST_BE_A_COMPLE_TYPE, (T)); - public: - typedef T type; - }; - -// 2 args -namespace type_traits_detail { - - template <class T, class U> - struct common_type_2 - { - private: - BOOST_COMMON_TYPE_STATIC_ASSERT(sizeof(T) > 0, BOOST_COMMON_TYPE_MUST_BE_A_COMPLE_TYPE, (T)); - BOOST_COMMON_TYPE_STATIC_ASSERT(sizeof(U) > 0, BOOST_COMMON_TYPE_MUST_BE_A_COMPLE_TYPE, (U)); - static bool declval_bool(); // workaround gcc bug; not required by std - static typename add_rvalue_reference<T>::type declval_T(); // workaround gcc bug; not required by std - static typename add_rvalue_reference<U>::type declval_U(); // workaround gcc bug; not required by std - static typename add_rvalue_reference<bool>::type declval_b(); +template<class T1, class T2, class... T> +struct common_type<T1, T2, T...>: common_type<typename common_type<T1, T2>::type, T...> +{ +}; + +#endif // !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) + +#else + +template< + class T1 = void, class T2 = void, class T3 = void, + class T4 = void, class T5 = void, class T6 = void, + class T7 = void, class T8 = void, class T9 = void +> +struct common_type: common_type<typename common_type<T1, T2>::type, T3, T4, T5, T6, T7, T8, T9> +{ +}; + +#endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + +// one argument + +template<class T> struct common_type<T>: boost::decay<T> +{ +}; + +// two arguments + +namespace type_traits_detail +{ + +// binary common_type #if !defined(BOOST_NO_CXX11_DECLTYPE) - public: - typedef decltype(declval<bool>() ? declval<T>() : declval<U>()) type; -#elif defined(BOOST_COMMON_TYPE_DONT_USE_TYPEOF) - public: - typedef typename detail_type_traits_common_type::common_type_impl< - typename remove_cv<T>::type, - typename remove_cv<U>::type - >::type type; + +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + +#if !defined(BOOST_MSVC) || BOOST_MSVC > 1800 + +// internal compiler error on msvc-12.0 + +template<class T1, class T2> using builtin_common_type = typename boost::decay<decltype( boost::declval<bool>()? boost::declval<T1>(): boost::declval<T2>() )>::type; + +template<class T1, class T2> struct common_type_impl: mp_defer<builtin_common_type, T1, T2> +{ +}; + #else - public: - typedef BOOST_TYPEOF_TPL(declval_b() ? declval_T() : declval_U()) type; -#endif -#if defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ == 3 - public: - void public_dummy_function_just_to_silence_warning(); -#endif - }; +template<class T1, class T2> using builtin_common_type = decltype( boost::declval<bool>()? boost::declval<T1>(): boost::declval<T2>() ); - template <class T> - struct common_type_2<T, T> - { - typedef T type; - }; - } +template<class T1, class T2> struct common_type_impl_2: mp_defer<builtin_common_type, T1, T2> +{ +}; + +template<class T1, class T2> using decay_common_type = typename boost::decay<typename common_type_impl_2<T1, T2>::type>::type; + +template<class T1, class T2> struct common_type_impl: mp_defer<decay_common_type, T1, T2> +{ +}; + +#endif // !defined(BOOST_MSVC) || BOOST_MSVC > 1800 -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - template <class T, class U> - struct common_type<T, U> #else - template <class T, class U> - struct common_type<T, U, void> -#endif - : public type_traits_detail::common_type_2<T,U> - { }; +template<class T1, class T2> struct common_type_impl: boost::decay<decltype( boost::declval<bool>()? boost::declval<T1>(): boost::declval<T2>() )> +{ +}; -// 3 or more args -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - template<typename T, typename U, typename... V> - struct common_type<T, U, V...> { - public: - typedef typename common_type<typename common_type<T, U>::type, V...>::type type; - }; -#endif -} // namespace boost +#endif // #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + +#endif // #if !defined(BOOST_NO_CXX11_DECLTYPE) + +// decay helper + +template<class T1, class T2, class T1d = typename boost::decay<T1>::type, class T2d = typename boost::decay<T2>::type> struct common_type_decay_helper: boost::common_type<T1d, T2d> +{ +}; + +template<class T1, class T2> struct common_type_decay_helper<T1, T2, T1, T2>: common_type_impl<T1, T2> +{ +}; + +} // type_traits_detail + +template<class T1, class T2> struct common_type<T1, T2>: type_traits_detail::common_type_decay_helper<T1, T2> +{ +}; + +} // namespace boost -#endif // BOOST_TYPE_TRAITS_COMMON_TYPE_HPP +#endif // #ifndef BOOST_TYPE_TRAITS_COMMON_TYPE_HPP_INCLUDED diff --git a/boost/type_traits/conditional.hpp b/boost/type_traits/conditional.hpp index 8bbda85fc6..b7e82dbe82 100644 --- a/boost/type_traits/conditional.hpp +++ b/boost/type_traits/conditional.hpp @@ -1,4 +1,3 @@ - // (C) Copyright John Maddock 2010. // Use, modification and distribution are subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -10,14 +9,10 @@ #ifndef BOOST_TT_CONDITIONAL_HPP_INCLUDED #define BOOST_TT_CONDITIONAL_HPP_INCLUDED -#include <boost/mpl/if.hpp> - namespace boost { -template <bool b, class T, class U> -struct conditional : public mpl::if_c<b, T, U> -{ -}; +template <bool b, class T, class U> struct conditional { typedef T type; }; +template <class T, class U> struct conditional<false, T, U> { typedef U type; }; } // namespace boost diff --git a/boost/type_traits/config.hpp b/boost/type_traits/config.hpp index 2e25ad01ff..47a06483ef 100644 --- a/boost/type_traits/config.hpp +++ b/boost/type_traits/config.hpp @@ -6,67 +6,16 @@ // // See http://www.boost.org/libs/type_traits for most recent version including documentation. -#ifndef BOOST_TT_CONFIG_HPP_INCLUDED -#define BOOST_TT_CONFIG_HPP_INCLUDED - -#ifndef BOOST_CONFIG_HPP -#include <boost/config.hpp> -#endif - -#include <boost/detail/workaround.hpp> +#ifndef BOOST_TT_OLD_CONFIG_HPP_INCLUDED +#define BOOST_TT_OLD_CONFIG_HPP_INCLUDED // -// whenever we have a conversion function with ellipses -// it needs to be declared __cdecl to suppress compiler -// warnings from MS and Borland compilers (this *must* -// appear before we include is_same.hpp below): -#if defined(BOOST_MSVC) || (defined(__BORLANDC__) && !defined(BOOST_DISABLE_WIN32)) -# define BOOST_TT_DECL __cdecl -#else -# define BOOST_TT_DECL /**/ -#endif - -# if (BOOST_WORKAROUND(__MWERKS__, < 0x3000) \ - || BOOST_WORKAROUND(__IBMCPP__, < 600 ) \ - || BOOST_WORKAROUND(__BORLANDC__, < 0x5A0) \ - || defined(__ghs) \ - || BOOST_WORKAROUND(__HP_aCC, < 60700) \ - || BOOST_WORKAROUND(MPW_CPLUS, BOOST_TESTED_AT(0x890)) \ - || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580))) \ - && defined(BOOST_NO_IS_ABSTRACT) - -# define BOOST_TT_NO_CONFORMING_IS_CLASS_IMPLEMENTATION 1 - -#endif - -#ifndef BOOST_TT_NO_CONFORMING_IS_CLASS_IMPLEMENTATION -# define BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION 1 -#endif - -// -// define BOOST_TT_TEST_MS_FUNC_SIGS -// when we want to test __stdcall etc function types with is_function etc -// (Note, does not work with Borland, even though it does support __stdcall etc): +// This header is deprecated and no longer used by type_traits: // -#if defined(_MSC_EXTENSIONS) && !defined(__BORLANDC__) -# define BOOST_TT_TEST_MS_FUNC_SIGS +#if defined(__GNUC__) || defined(_MSC_VER) +# pragma message("NOTE: Use of this header (boost/type_traits/config.hpp) is deprecated") #endif -// -// define BOOST_TT_NO_CV_FUNC_TEST -// if tests for cv-qualified member functions don't -// work in is_member_function_pointer -// -#if BOOST_WORKAROUND(__MWERKS__, < 0x3000) || BOOST_WORKAROUND(__IBMCPP__, <= 600) -# define BOOST_TT_NO_CV_FUNC_TEST -#endif - -// -// Macros that have been deprecated, defined here for backwards compatibility: -// -#define BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(x) -#define BOOST_TT_BROKEN_COMPILER_SPEC(x) - #endif // BOOST_TT_CONFIG_HPP_INCLUDED diff --git a/boost/type_traits/copy_cv.hpp b/boost/type_traits/copy_cv.hpp new file mode 100644 index 0000000000..1605ca3356 --- /dev/null +++ b/boost/type_traits/copy_cv.hpp @@ -0,0 +1,34 @@ +#ifndef BOOST_TYPE_TRAITS_COPY_CV_HPP_INCLUDED +#define BOOST_TYPE_TRAITS_COPY_CV_HPP_INCLUDED + +// +// Copyright 2015 Peter Dimov +// +// 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 +// + +#include <boost/type_traits/is_const.hpp> +#include <boost/type_traits/is_volatile.hpp> +#include <boost/type_traits/add_const.hpp> +#include <boost/type_traits/add_volatile.hpp> +#include <boost/type_traits/conditional.hpp> + +namespace boost +{ + +template<class T, class U> struct copy_cv +{ +private: + + typedef typename boost::conditional<boost::is_const<U>::value, typename boost::add_const<T>::type, T>::type CT; + +public: + + typedef typename boost::conditional<boost::is_volatile<U>::value, typename boost::add_volatile<CT>::type, CT>::type type; +}; + +} // namespace boost + +#endif // #ifndef BOOST_TYPE_TRAITS_COPY_CV_HPP_INCLUDED diff --git a/boost/type_traits/decay.hpp b/boost/type_traits/decay.hpp index c23a9b0f15..4e8118433e 100755..100644 --- a/boost/type_traits/decay.hpp +++ b/boost/type_traits/decay.hpp @@ -9,33 +9,32 @@ #ifndef BOOST_TT_DECAY_HPP_INCLUDED #define BOOST_TT_DECAY_HPP_INCLUDED -#include <boost/type_traits/config.hpp> #include <boost/type_traits/is_array.hpp> #include <boost/type_traits/is_function.hpp> #include <boost/type_traits/remove_bounds.hpp> #include <boost/type_traits/add_pointer.hpp> #include <boost/type_traits/remove_reference.hpp> -#include <boost/mpl/eval_if.hpp> -#include <boost/mpl/identity.hpp> +#include <boost/type_traits/remove_cv.hpp> namespace boost { + namespace detail + { + + template <class T, bool Array, bool Function> struct decay_imp { typedef typename remove_cv<T>::type type; }; + template <class T> struct decay_imp<T, true, false> { typedef typename remove_bounds<T>::type* type; }; + template <class T> struct decay_imp<T, false, true> { typedef T* type; }; + + } + template< class T > struct decay { private: - typedef BOOST_DEDUCED_TYPENAME remove_reference<T>::type Ty; + typedef typename remove_reference<T>::type Ty; public: - typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< - is_array<Ty>, - mpl::identity<BOOST_DEDUCED_TYPENAME remove_bounds<Ty>::type*>, - BOOST_DEDUCED_TYPENAME mpl::eval_if< - is_function<Ty>, - add_pointer<Ty>, - mpl::identity<Ty> - > - >::type type; + typedef typename boost::detail::decay_imp<Ty, boost::is_array<Ty>::value, boost::is_function<Ty>::value>::type type; }; } // namespace boost diff --git a/boost/type_traits/declval.hpp b/boost/type_traits/declval.hpp new file mode 100644 index 0000000000..a050012eb5 --- /dev/null +++ b/boost/type_traits/declval.hpp @@ -0,0 +1,44 @@ +// declval.hpp -------------------------------------------------------------// + +// Copyright 2010 Vicente J. Botet Escriba + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +#ifndef BOOST_TYPE_TRAITS_DECLVAL_HPP_INCLUDED +#define BOOST_TYPE_TRAITS_DECLVAL_HPP_INCLUDED + +#include <boost/config.hpp> + +//----------------------------------------------------------------------------// + +#include <boost/type_traits/add_rvalue_reference.hpp> + +//----------------------------------------------------------------------------// +// // +// C++03 implementation of // +// 20.2.4 Function template declval [declval] // +// Written by Vicente J. Botet Escriba // +// // +// 1 The library provides the function template declval to simplify the +// definition of expressions which occur as unevaluated operands. +// 2 Remarks: If this function is used, the program is ill-formed. +// 3 Remarks: The template parameter T of declval may be an incomplete type. +// [ Example: +// +// template <class To, class From> +// decltype(static_cast<To>(declval<From>())) convert(From&&); +// +// declares a function template convert which only participates in overloading +// if the type From can be explicitly converted to type To. For another example +// see class template common_type (20.9.7.6). -end example ] +//----------------------------------------------------------------------------// + +namespace boost { + + template <typename T> + typename add_rvalue_reference<T>::type declval() BOOST_NOEXCEPT; // as unevaluated operand + +} // namespace boost + +#endif // BOOST_TYPE_TRAITS_DECLVAL_HPP_INCLUDED diff --git a/boost/type_traits/detail/bool_trait_def.hpp b/boost/type_traits/detail/bool_trait_def.hpp index 69e4f1ca62..b6b0677d68 100644 --- a/boost/type_traits/detail/bool_trait_def.hpp +++ b/boost/type_traits/detail/bool_trait_def.hpp @@ -11,10 +11,15 @@ // $Date$ // $Revision$ +// +// This header is deprecated and no longer used by type_traits: +// +#if defined(__GNUC__) || defined(_MSC_VER) +# pragma message("NOTE: Use of this header (bool_trait_def.hpp) is deprecated") +#endif + #include <boost/type_traits/detail/template_arity_spec.hpp> #include <boost/type_traits/integral_constant.hpp> -#include <boost/mpl/bool.hpp> -#include <boost/mpl/aux_/lambda_support.hpp> #include <boost/config.hpp> // @@ -39,14 +44,6 @@ #undef BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1 #endif -#if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x570) -# define BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ - typedef ::boost::integral_constant<bool,C> type; \ - enum { value = type::value }; \ - /**/ -# define BOOST_TT_AUX_BOOL_C_BASE(C) -#endif - #ifndef BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL # define BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) /**/ #endif @@ -62,7 +59,6 @@ template< typename T > struct trait \ { \ public:\ BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,trait,(T)) \ }; \ \ BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1,trait) \ @@ -75,7 +71,6 @@ template< typename T1, typename T2 > struct trait \ { \ public:\ BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ - BOOST_MPL_AUX_LAMBDA_SUPPORT(2,trait,(T1,T2)) \ }; \ \ BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(2,trait) \ @@ -87,7 +82,6 @@ template< typename T1, typename T2, typename T3 > struct trait \ { \ public:\ BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ - BOOST_MPL_AUX_LAMBDA_SUPPORT(3,trait,(T1,T2,T3)) \ }; \ \ BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(3,trait) \ @@ -99,7 +93,6 @@ template<> struct trait< sp > \ { \ public:\ BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ - BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(1,trait,(sp)) \ }; \ /**/ @@ -109,7 +102,6 @@ template<> struct trait< sp1,sp2 > \ { \ public:\ BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ - BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2,trait,(sp1,sp2)) \ }; \ /**/ @@ -153,7 +145,6 @@ template< param > struct trait< sp1,sp2 > \ { \ public:\ BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ - BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2,trait,(sp1,sp2)) \ }; \ /**/ diff --git a/boost/type_traits/detail/common_arithmetic_type.hpp b/boost/type_traits/detail/common_arithmetic_type.hpp new file mode 100644 index 0000000000..7211002218 --- /dev/null +++ b/boost/type_traits/detail/common_arithmetic_type.hpp @@ -0,0 +1,212 @@ +#ifndef BOOST_TYPE_TRAITS_DETAIL_COMMON_ARITHMETIC_TYPE_HPP_INCLUDED +#define BOOST_TYPE_TRAITS_DETAIL_COMMON_ARITHMETIC_TYPE_HPP_INCLUDED + +// +// Copyright 2015 Peter Dimov +// +// 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 +// + +#include <boost/config.hpp> + +namespace boost +{ + +namespace type_traits_detail +{ + +template<int I> struct arithmetic_type; + +// Types bool, char, char16_t, char32_t, wchar_t, +// and the signed and unsigned integer types are +// collectively called integral types + +template<> struct arithmetic_type<1> +{ + typedef bool type; + typedef char (&result_type) [1]; +}; + +template<> struct arithmetic_type<2> +{ + typedef char type; + typedef char (&result_type) [2]; +}; + +template<> struct arithmetic_type<3> +{ + typedef wchar_t type; + typedef char (&result_type) [3]; +}; + +// There are five standard signed integer types: +// “signed char”, “short int”, “int”, “long int”, and “long long int”. + +template<> struct arithmetic_type<4> +{ + typedef signed char type; + typedef char (&result_type) [4]; +}; + +template<> struct arithmetic_type<5> +{ + typedef short type; + typedef char (&result_type) [5]; +}; + +template<> struct arithmetic_type<6> +{ + typedef int type; + typedef char (&result_type) [6]; +}; + +template<> struct arithmetic_type<7> +{ + typedef long type; + typedef char (&result_type) [7]; +}; + +template<> struct arithmetic_type<8> +{ + typedef boost::long_long_type type; + typedef char (&result_type) [8]; +}; + +// For each of the standard signed integer types, there exists a corresponding +// (but different) standard unsigned integer type: “unsigned char”, “unsigned short int”, +// “unsigned int”, “unsigned long int”, and “unsigned long long int” + +template<> struct arithmetic_type<9> +{ + typedef unsigned char type; + typedef char (&result_type) [9]; +}; + +template<> struct arithmetic_type<10> +{ + typedef unsigned short type; + typedef char (&result_type) [10]; +}; + +template<> struct arithmetic_type<11> +{ + typedef unsigned int type; + typedef char (&result_type) [11]; +}; + +template<> struct arithmetic_type<12> +{ + typedef unsigned long type; + typedef char (&result_type) [12]; +}; + +template<> struct arithmetic_type<13> +{ + typedef boost::ulong_long_type type; + typedef char (&result_type) [13]; +}; + +// There are three floating point types: float, double, and long double. + +template<> struct arithmetic_type<14> +{ + typedef float type; + typedef char (&result_type) [14]; +}; + +template<> struct arithmetic_type<15> +{ + typedef double type; + typedef char (&result_type) [15]; +}; + +template<> struct arithmetic_type<16> +{ + typedef long double type; + typedef char (&result_type) [16]; +}; + +#if !defined( BOOST_NO_CXX11_CHAR16_T ) + +template<> struct arithmetic_type<17> +{ + typedef char16_t type; + typedef char (&result_type) [17]; +}; + +#endif + +#if !defined( BOOST_NO_CXX11_CHAR32_T ) + +template<> struct arithmetic_type<18> +{ + typedef char32_t type; + typedef char (&result_type) [18]; +}; + +#endif + +#if defined( BOOST_HAS_INT128 ) + +template<> struct arithmetic_type<19> +{ + typedef boost::int128_type type; + typedef char (&result_type) [19]; +}; + +template<> struct arithmetic_type<20> +{ + typedef boost::uint128_type type; + typedef char (&result_type) [20]; +}; + +#endif + +template<class T, class U> class common_arithmetic_type +{ +private: + + static arithmetic_type<1>::result_type select( arithmetic_type<1>::type ); + static arithmetic_type<2>::result_type select( arithmetic_type<2>::type ); + static arithmetic_type<3>::result_type select( arithmetic_type<3>::type ); + static arithmetic_type<4>::result_type select( arithmetic_type<4>::type ); + static arithmetic_type<5>::result_type select( arithmetic_type<5>::type ); + static arithmetic_type<6>::result_type select( arithmetic_type<6>::type ); + static arithmetic_type<7>::result_type select( arithmetic_type<7>::type ); + static arithmetic_type<8>::result_type select( arithmetic_type<8>::type ); + static arithmetic_type<9>::result_type select( arithmetic_type<9>::type ); + static arithmetic_type<10>::result_type select( arithmetic_type<10>::type ); + static arithmetic_type<11>::result_type select( arithmetic_type<11>::type ); + static arithmetic_type<12>::result_type select( arithmetic_type<12>::type ); + static arithmetic_type<13>::result_type select( arithmetic_type<13>::type ); + static arithmetic_type<14>::result_type select( arithmetic_type<14>::type ); + static arithmetic_type<15>::result_type select( arithmetic_type<15>::type ); + static arithmetic_type<16>::result_type select( arithmetic_type<16>::type ); + +#if !defined( BOOST_NO_CXX11_CHAR16_T ) + static arithmetic_type<17>::result_type select( arithmetic_type<17>::type ); +#endif + +#if !defined( BOOST_NO_CXX11_CHAR32_T ) + static arithmetic_type<18>::result_type select( arithmetic_type<18>::type ); +#endif + +#if defined( BOOST_HAS_INT128 ) + static arithmetic_type<19>::result_type select( arithmetic_type<19>::type ); + static arithmetic_type<20>::result_type select( arithmetic_type<20>::type ); +#endif + + static bool cond(); + +public: + + typedef typename arithmetic_type< sizeof(select( cond()? T(): U() )) >::type type; +}; + +} // namespace type_traits_detail + +} // namespace boost + +#endif // #ifndef BOOST_TYPE_TRAITS_DETAIL_COMMON_ARITHMETIC_TYPE_HPP_INCLUDED diff --git a/boost/type_traits/detail/common_type_imp.hpp b/boost/type_traits/detail/common_type_imp.hpp deleted file mode 100644 index 84de8b4125..0000000000 --- a/boost/type_traits/detail/common_type_imp.hpp +++ /dev/null @@ -1,333 +0,0 @@ -/******************************************************************************* - * boost/type_traits/detail/common_type_imp.hpp - * - * Copyright 2010, Jeffrey Hellrung. - * 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) - * - * struct boost::common_type<T,U> - * - * common_type<T,U>::type is the type of the expression - * b() ? x() : y() - * where b() returns a bool, x() has return type T, and y() has return type U. - * See - * http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2661.htm#common_type - * - * Note that this evaluates to void if one or both of T and U is void. - ******************************************************************************/ - -#ifndef BOOST_TYPE_TRAITS_DETAIL_COMMON_TYPE_IMP_HPP -#define BOOST_TYPE_TRAITS_DETAIL_COMMON_TYPE_IMP_HPP - -#include <cstddef> - -#include <boost/mpl/assert.hpp> -#include <boost/mpl/at.hpp> -#include <boost/mpl/begin_end.hpp> -#include <boost/mpl/contains.hpp> -#include <boost/mpl/copy.hpp> -#include <boost/mpl/deref.hpp> -#include <boost/mpl/eval_if.hpp> -#include <boost/mpl/if.hpp> -#include <boost/mpl/inserter.hpp> -#include <boost/mpl/next.hpp> -#include <boost/mpl/or.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/mpl/push_back.hpp> -#include <boost/mpl/size.hpp> -#include <boost/mpl/vector/vector0.hpp> -#include <boost/mpl/vector/vector10.hpp> -#include <boost/type_traits/integral_constant.hpp> -#include <boost/type_traits/is_enum.hpp> -#include <boost/type_traits/is_integral.hpp> -#include <boost/type_traits/make_signed.hpp> -#include <boost/type_traits/make_unsigned.hpp> -#include <boost/type_traits/remove_cv.hpp> -#include <boost/type_traits/remove_reference.hpp> -#include <boost/utility/declval.hpp> - -namespace boost -{ - -namespace detail_type_traits_common_type -{ - -/******************************************************************************* - * struct propagate_cv< From, To > - * - * This metafunction propagates cv-qualifiers on type From to type To. - ******************************************************************************/ - -template< class From, class To > -struct propagate_cv -{ typedef To type; }; -template< class From, class To > -struct propagate_cv< const From, To > -{ typedef To const type; }; -template< class From, class To > -struct propagate_cv< volatile From, To > -{ typedef To volatile type; }; -template< class From, class To > -struct propagate_cv< const volatile From, To > -{ typedef To const volatile type; }; - -/******************************************************************************* - * struct is_integral_or_enum<T> - * - * This metafunction determines if T is an integral type which can be made - * signed or unsigned. - ******************************************************************************/ - -template< class T > -struct is_integral_or_enum - : public mpl::or_< is_integral<T>, is_enum<T> > -{ }; -template<> -struct is_integral_or_enum< bool > - : public false_type -{ }; - -/******************************************************************************* - * struct make_unsigned_soft<T> - * struct make_signed_soft<T> - * - * These metafunction are identical to make_unsigned and make_signed, - * respectively, except for special-casing bool. - ******************************************************************************/ - -template< class T > -struct make_unsigned_soft - : public make_unsigned<T> -{ }; -template<> -struct make_unsigned_soft< bool > -{ typedef bool type; }; - -template< class T > -struct make_signed_soft - : public make_signed<T> -{ }; -template<> -struct make_signed_soft< bool > -{ typedef bool type; }; - -/******************************************************************************* - * struct sizeof_t<N> - * typedef ... yes_type - * typedef ... no_type - * - * These types are integral players in the use of the "sizeof trick", i.e., we - * can distinguish overload selection by inspecting the size of the return type - * of the overload. - ******************************************************************************/ - -template< std::size_t N > struct sizeof_t { char _dummy[N]; }; -typedef sizeof_t<1> yes_type; -typedef sizeof_t<2> no_type; -BOOST_MPL_ASSERT_RELATION( sizeof( yes_type ), ==, 1 ); -BOOST_MPL_ASSERT_RELATION( sizeof( no_type ), ==, 2 ); - -/******************************************************************************* - * rvalue_test(T&) -> no_type - * rvalue_test(...) -> yes_type - * - * These overloads are used to determine the rvalue-ness of an expression. - ******************************************************************************/ - -template< class T > no_type rvalue_test(T&); -yes_type rvalue_test(...); - -/******************************************************************************* - * struct conversion_test_overloads< Sequence > - * - * This struct has multiple overloads of the static member function apply, each - * one taking a single parameter of a type within the Boost.MPL sequence - * Sequence. Each such apply overload has a return type with sizeof equal to - * one plus the index of the parameter type within Sequence. Thus, we can - * deduce the type T of an expression as long as we can generate a finite set of - * candidate types containing T via these apply overloads and the "sizeof - * trick". - ******************************************************************************/ - -template< class First, class Last, std::size_t Index > -struct conversion_test_overloads_iterate - : public conversion_test_overloads_iterate< - typename mpl::next< First >::type, Last, Index + 1 - > -{ - using conversion_test_overloads_iterate< - typename mpl::next< First >::type, Last, Index + 1 - >::apply; - static sizeof_t< Index + 1 > - apply(typename mpl::deref< First >::type); -}; - -template< class Last, std::size_t Index > -struct conversion_test_overloads_iterate< Last, Last, Index > -{ static sizeof_t< Index + 1 > apply(...); }; - -template< class Sequence > -struct conversion_test_overloads - : public conversion_test_overloads_iterate< - typename mpl::begin< Sequence >::type, - typename mpl::end< Sequence >::type, - 0 - > -{ }; - -/******************************************************************************* - * struct select< Sequence, Index > - * - * select is synonymous with mpl::at_c unless Index equals the size of the - * Boost.MPL Sequence, in which case this evaluates to void. - ******************************************************************************/ - -template< - class Sequence, int Index, - int N = mpl::size< Sequence >::value -> -struct select - : public mpl::at_c< Sequence, Index > -{ }; -template< class Sequence, int N > -struct select< Sequence, N, N > -{ typedef void type; }; - -/******************************************************************************* - * class deduce_common_type< T, U, NominalCandidates > - * struct nominal_candidates<T,U> - * struct common_type_dispatch_on_rvalueness<T,U> - * struct common_type_impl<T,U> - * - * These classes and structs implement the logic behind common_type, which goes - * roughly as follows. Let C be the type of the conditional expression - * declval< bool >() ? declval<T>() : declval<U>() - * if C is an rvalue, then: - * let T' and U' be T and U stripped of reference- and cv-qualifiers - * if T' and U' are pointer types, say, T' = V* and U' = W*, then: - * define the set of NominalCandidates to be - * { V*, W*, V'*, W'* } - * where V' is V with whatever cv-qualifiers are on W, and W' is W - * with whatever cv-qualifiers are on V - * else if T' and U' are both integral or enum types, then: - * define the set of NominalCandidates to be - * { - * unsigned_soft(T'), - * unsigned_soft(U'), - * signed_soft(T'), - * signed_soft(U'), - * T', - * U', - * unsigned int, - * int - * } - * where unsigned_soft(X) is make_unsigned_soft<X>::type and - * signed_soft(X) is make_signed_soft<X>::type (these are all - * generally necessary to cover the various integral promotion cases) - * else - * define the set of NominalCandidates to be - * { T', U' } - * else - * let V and W be T and U stripped of reference-qualifiers - * define the set of NominalCandidates to be - * { V&, W&, V'&, W'& } - * where V' is V with whatever cv-qualifiers are on W, and W' is W with - * whatever cv-qualifiers are on V - * define the set of Candidates to be equal to the set of NominalCandidates with - * duplicates removed, and use this set of Candidates to determine C using the - * conversion_test_overloads struct - ******************************************************************************/ - -template< class T, class U, class NominalCandidates > -class deduce_common_type -{ - typedef typename mpl::copy< - NominalCandidates, - mpl::inserter< - mpl::vector0<>, - mpl::if_< - mpl::contains< mpl::_1, mpl::_2 >, - mpl::_1, - mpl::push_back< mpl::_1, mpl::_2 > - > - > - >::type candidate_types; - static const int best_candidate_index = - sizeof( conversion_test_overloads< candidate_types >::apply( - declval< bool >() ? declval<T>() : declval<U>() - ) ) - 1; -public: - typedef typename select< candidate_types, best_candidate_index >::type type; -}; - -template< - class T, class U, - class V = typename remove_cv< typename remove_reference<T>::type >::type, - class W = typename remove_cv< typename remove_reference<U>::type >::type, - bool = is_integral_or_enum<V>::value && is_integral_or_enum<W>::value -> -struct nominal_candidates -{ typedef mpl::vector2<V,W> type; }; - -template< class T, class U, class V, class W > -struct nominal_candidates< T, U, V, W, true > -{ - typedef boost::mpl::vector8< - typename make_unsigned_soft<V>::type, - typename make_unsigned_soft<W>::type, - typename make_signed_soft<V>::type, - typename make_signed_soft<W>::type, - V, W, unsigned int, int - > type; -}; - -template< class T, class U, class V, class W > -struct nominal_candidates< T, U, V*, W*, false > -{ - typedef mpl::vector4< - V*, W*, - typename propagate_cv<W,V>::type *, - typename propagate_cv<V,W>::type * - > type; -}; - -template<class T, class U, bool b> -struct common_type_dispatch_on_rvalueness - : public deduce_common_type< T, U, typename nominal_candidates<T,U>::type > -{ }; - -template< class T, class U > -struct common_type_dispatch_on_rvalueness< T, U, false > -{ -private: - typedef typename remove_reference<T>::type unrefed_T_type; - typedef typename remove_reference<U>::type unrefed_U_type; -public: - typedef typename deduce_common_type< - T, U, - mpl::vector4< - unrefed_T_type &, - unrefed_U_type &, - typename propagate_cv< unrefed_U_type, unrefed_T_type >::type &, - typename propagate_cv< unrefed_T_type, unrefed_U_type >::type & - > - >::type type; -}; - -template< class T, class U > -struct common_type_impl - : public common_type_dispatch_on_rvalueness<T,U, sizeof( ::boost::detail_type_traits_common_type::rvalue_test( - declval< bool >() ? declval<T>() : declval<U>() ) ) == sizeof( yes_type ) > -{ }; - -template< class T > struct common_type_impl< T, void > { typedef void type; }; -template< class T > struct common_type_impl< void, T > { typedef void type; }; -template<> struct common_type_impl< void, void > { typedef void type; }; - -} // namespace detail_type_traits_common_type - - -} // namespace boost - -#endif // BOOST_TYPE_TRAITS_DETAIL_COMMON_TYPE_HPP - diff --git a/boost/type_traits/detail/common_type_impl.hpp b/boost/type_traits/detail/common_type_impl.hpp new file mode 100644 index 0000000000..53a634d4df --- /dev/null +++ b/boost/type_traits/detail/common_type_impl.hpp @@ -0,0 +1,107 @@ +#ifndef BOOST_TYPE_TRAITS_DETAIL_COMMON_TYPE_IMPL_HPP_INCLUDED +#define BOOST_TYPE_TRAITS_DETAIL_COMMON_TYPE_IMPL_HPP_INCLUDED + +// +// Copyright 2015 Peter Dimov +// +// 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 +// + +#include <boost/type_traits/detail/common_arithmetic_type.hpp> +#include <boost/type_traits/detail/composite_pointer_type.hpp> +#include <boost/type_traits/detail/composite_member_pointer_type.hpp> +#include <boost/type_traits/type_identity.hpp> +#include <boost/type_traits/is_class.hpp> +#include <boost/type_traits/is_union.hpp> +#include <boost/type_traits/is_convertible.hpp> +#include <boost/type_traits/is_pointer.hpp> +#include <boost/type_traits/is_member_pointer.hpp> +#include <boost/type_traits/conditional.hpp> + +namespace boost +{ + +namespace type_traits_detail +{ + +// the arguments to common_type_impl have already been passed through decay<> + +template<class T, class U> struct common_type_impl; + +// same type + +template<class T> struct common_type_impl<T, T> +{ + typedef T type; +}; + +// one of the operands is a class type, try conversions in both directions + +template<class T, class U> struct ct_class +{ + BOOST_STATIC_CONSTANT( bool, ct = boost::is_class<T>::value || boost::is_union<T>::value ); + BOOST_STATIC_CONSTANT( bool, cu = boost::is_class<U>::value || boost::is_union<U>::value ); + + BOOST_STATIC_CONSTANT( bool, value = ct || cu ); +}; + +template<class T, class U> struct common_type_impl3; + +template<class T, class U> struct common_type_class: public boost::conditional< + + boost::is_convertible<T, U>::value && !boost::is_convertible<U, T>::value, + boost::type_identity<U>, + + typename boost::conditional< + + boost::is_convertible<U, T>::value && !boost::is_convertible<T, U>::value, + boost::type_identity<T>, + + common_type_impl3<T, U> + >::type +>::type +{ +}; + +template<class T, class U> struct common_type_impl: public boost::conditional< + ct_class<T, U>::value, + common_type_class<T, U>, + common_type_impl3<T, U> >::type +{ +}; + +// pointers + +template<class T, class U> struct common_type_impl4; + +template<class T, class U> struct common_type_impl3: public boost::conditional< + boost::is_pointer<T>::value || boost::is_pointer<U>::value, + composite_pointer_type<T, U>, + common_type_impl4<T, U> >::type +{ +}; + +// pointers to members + +template<class T, class U> struct common_type_impl5; + +template<class T, class U> struct common_type_impl4: public boost::conditional< + boost::is_member_pointer<T>::value || boost::is_member_pointer<U>::value, + composite_member_pointer_type<T, U>, + common_type_impl5<T, U> >::type +{ +}; + +// arithmetic types (including class types w/ conversions to arithmetic and enums) + +template<class T, class U> struct common_type_impl5: public common_arithmetic_type<T, U> +{ +}; + +} // namespace type_traits_detail + +} // namespace boost + +#endif // #ifndef BOOST_TYPE_TRAITS_DETAIL_COMMON_TYPE_IMPL_HPP_INCLUDED diff --git a/boost/type_traits/detail/composite_member_pointer_type.hpp b/boost/type_traits/detail/composite_member_pointer_type.hpp new file mode 100644 index 0000000000..a747ee4db6 --- /dev/null +++ b/boost/type_traits/detail/composite_member_pointer_type.hpp @@ -0,0 +1,113 @@ +#ifndef BOOST_TYPE_TRAITS_DETAIL_COMPOSITE_MEMBER_POINTER_TYPE_HPP_INCLUDED +#define BOOST_TYPE_TRAITS_DETAIL_COMPOSITE_MEMBER_POINTER_TYPE_HPP_INCLUDED + +// +// Copyright 2015 Peter Dimov +// +// 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 +// + +#include <boost/type_traits/detail/composite_pointer_type.hpp> +#include <boost/type_traits/remove_pointer.hpp> +#include <boost/type_traits/is_base_of.hpp> +#include <boost/type_traits/conditional.hpp> +#include <boost/config.hpp> +#include <cstddef> + +namespace boost +{ + +namespace type_traits_detail +{ + +template<class T, class U> struct composite_member_pointer_type; + +// nullptr_t + +#if !defined( BOOST_NO_CXX11_NULLPTR ) + +#if !defined( BOOST_NO_CXX11_DECLTYPE ) && ( ( defined( __clang__ ) && !defined( _LIBCPP_VERSION ) ) || defined( __INTEL_COMPILER ) ) + +template<class C, class T> struct composite_member_pointer_type<T C::*, decltype(nullptr)> +{ + typedef T C::* type; +}; + +template<class C, class T> struct composite_member_pointer_type<decltype(nullptr), T C::*> +{ + typedef T C::* type; +}; + +template<> struct composite_member_pointer_type<decltype(nullptr), decltype(nullptr)> +{ + typedef decltype(nullptr) type; +}; + +#else + +template<class C, class T> struct composite_member_pointer_type<T C::*, std::nullptr_t> +{ + typedef T C::* type; +}; + +template<class C, class T> struct composite_member_pointer_type<std::nullptr_t, T C::*> +{ + typedef T C::* type; +}; + +template<> struct composite_member_pointer_type<std::nullptr_t, std::nullptr_t> +{ + typedef std::nullptr_t type; +}; + +#endif + +#endif // !defined( BOOST_NO_CXX11_NULLPTR ) + +template<class C1, class C2> struct common_member_class; + +template<class C> struct common_member_class<C, C> +{ + typedef C type; +}; + +template<class C1, class C2> struct common_member_class +{ + typedef typename boost::conditional< + + boost::is_base_of<C1, C2>::value, + C2, + typename boost::conditional<boost::is_base_of<C2, C1>::value, C1, void>::type + + >::type type; +}; + +//This indirection avoids compilation errors on some older +//compilers like MSVC 7.1 +template<class CT, class CB> +struct common_member_class_pointer_to_member +{ + typedef CT CB::* type; +}; + +template<class C1, class T1, class C2, class T2> struct composite_member_pointer_type<T1 C1::*, T2 C2::*> +{ +private: + + typedef typename composite_pointer_type<T1*, T2*>::type CPT; + typedef typename boost::remove_pointer<CPT>::type CT; + + typedef typename common_member_class<C1, C2>::type CB; + +public: + + typedef typename common_member_class_pointer_to_member<CT, CB>::type type; +}; + +} // namespace type_traits_detail + +} // namespace boost + +#endif // #ifndef BOOST_TYPE_TRAITS_DETAIL_COMPOSITE_MEMBER_POINTER_TYPE_HPP_INCLUDED diff --git a/boost/type_traits/detail/composite_pointer_type.hpp b/boost/type_traits/detail/composite_pointer_type.hpp new file mode 100644 index 0000000000..ae21e18ade --- /dev/null +++ b/boost/type_traits/detail/composite_pointer_type.hpp @@ -0,0 +1,153 @@ +#ifndef BOOST_TYPE_TRAITS_DETAIL_COMPOSITE_POINTER_TYPE_HPP_INCLUDED +#define BOOST_TYPE_TRAITS_DETAIL_COMPOSITE_POINTER_TYPE_HPP_INCLUDED + +// +// Copyright 2015 Peter Dimov +// +// 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 +// + +#include <boost/type_traits/copy_cv.hpp> +#include <boost/type_traits/remove_cv.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/type_traits/is_void.hpp> +#include <boost/type_traits/is_base_of.hpp> +#include <boost/config.hpp> +#include <cstddef> + +namespace boost +{ + +namespace type_traits_detail +{ + +template<class T, class U> struct composite_pointer_type; + +// same type + +template<class T> struct composite_pointer_type<T*, T*> +{ + typedef T* type; +}; + +// nullptr_t + +#if !defined( BOOST_NO_CXX11_NULLPTR ) + +#if !defined( BOOST_NO_CXX11_DECLTYPE ) && ( ( defined( __clang__ ) && !defined( _LIBCPP_VERSION ) ) || defined( __INTEL_COMPILER ) ) + +template<class T> struct composite_pointer_type<T*, decltype(nullptr)> +{ + typedef T* type; +}; + +template<class T> struct composite_pointer_type<decltype(nullptr), T*> +{ + typedef T* type; +}; + +template<> struct composite_pointer_type<decltype(nullptr), decltype(nullptr)> +{ + typedef decltype(nullptr) type; +}; + +#else + +template<class T> struct composite_pointer_type<T*, std::nullptr_t> +{ + typedef T* type; +}; + +template<class T> struct composite_pointer_type<std::nullptr_t, T*> +{ + typedef T* type; +}; + +template<> struct composite_pointer_type<std::nullptr_t, std::nullptr_t> +{ + typedef std::nullptr_t type; +}; + +#endif + +#endif // !defined( BOOST_NO_CXX11_NULLPTR ) + +namespace detail +{ + +template<class T, class U> struct has_common_pointee +{ +private: + + typedef typename boost::remove_cv<T>::type T2; + typedef typename boost::remove_cv<U>::type U2; + +public: + + BOOST_STATIC_CONSTANT( bool, value = + (boost::is_same<T2, U2>::value) + || boost::is_void<T2>::value + || boost::is_void<U2>::value + || (boost::is_base_of<T2, U2>::value) + || (boost::is_base_of<U2, T2>::value) ); +}; + +template<class T, class U> struct common_pointee +{ +private: + + typedef typename boost::remove_cv<T>::type T2; + typedef typename boost::remove_cv<U>::type U2; + +public: + + typedef typename boost::conditional< + + boost::is_same<T2, U2>::value || boost::is_void<T2>::value || boost::is_base_of<T2, U2>::value, + typename boost::copy_cv<T, U>::type, + typename boost::copy_cv<U, T>::type + + >::type type; +}; + +template<class T, class U> struct composite_pointer_impl +{ +private: + + typedef typename boost::remove_cv<T>::type T2; + typedef typename boost::remove_cv<U>::type U2; + +public: + + typedef typename boost::copy_cv<typename boost::copy_cv<typename composite_pointer_type<T2, U2>::type const, T>::type, U>::type type; +}; + +//Old compilers like MSVC-7.1 have problems using boost::conditional in +//composite_pointer_type. Partially specializing on has_common_pointee<T, U>::value +//seems to make their life easier +template<class T, class U, bool = has_common_pointee<T, U>::value > +struct composite_pointer_type_dispatch + : common_pointee<T, U> +{}; + +template<class T, class U> +struct composite_pointer_type_dispatch<T, U, false> + : composite_pointer_impl<T, U> +{}; + + +} // detail + + +template<class T, class U> struct composite_pointer_type<T*, U*> +{ + typedef typename detail::composite_pointer_type_dispatch<T, U>::type* type; +}; + +} // namespace type_traits_detail + +} // namespace boost + +#endif // #ifndef BOOST_TYPE_TRAITS_DETAIL_COMPOSITE_POINTER_TYPE_HPP_INCLUDED diff --git a/boost/type_traits/detail/config.hpp b/boost/type_traits/detail/config.hpp new file mode 100644 index 0000000000..ebb1dd65f0 --- /dev/null +++ b/boost/type_traits/detail/config.hpp @@ -0,0 +1,72 @@ + +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// Use, modification and distribution are subject to 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_CONFIG_HPP_INCLUDED +#define BOOST_TT_CONFIG_HPP_INCLUDED + +#ifndef BOOST_CONFIG_HPP +#include <boost/config.hpp> +#endif +#include <boost/version.hpp> +#include <boost/detail/workaround.hpp> + +// +// whenever we have a conversion function with ellipses +// it needs to be declared __cdecl to suppress compiler +// warnings from MS and Borland compilers (this *must* +// appear before we include is_same.hpp below): +#if defined(BOOST_MSVC) || (defined(__BORLANDC__) && !defined(BOOST_DISABLE_WIN32)) +# define BOOST_TT_DECL __cdecl +#else +# define BOOST_TT_DECL /**/ +#endif + +# if (BOOST_WORKAROUND(__MWERKS__, < 0x3000) \ + || BOOST_WORKAROUND(__IBMCPP__, < 600 ) \ + || BOOST_WORKAROUND(__BORLANDC__, < 0x5A0) \ + || defined(__ghs) \ + || BOOST_WORKAROUND(__HP_aCC, < 60700) \ + || BOOST_WORKAROUND(MPW_CPLUS, BOOST_TESTED_AT(0x890)) \ + || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580))) \ + && defined(BOOST_NO_IS_ABSTRACT) + +# define BOOST_TT_NO_CONFORMING_IS_CLASS_IMPLEMENTATION 1 + +#endif + +#ifndef BOOST_TT_NO_CONFORMING_IS_CLASS_IMPLEMENTATION +# define BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION 1 +#endif + +// +// define BOOST_TT_TEST_MS_FUNC_SIGS +// when we want to test __stdcall etc function types with is_function etc +// (Note, does not work with Borland, even though it does support __stdcall etc): +// +#if defined(_MSC_EXTENSIONS) && !defined(__BORLANDC__) +# define BOOST_TT_TEST_MS_FUNC_SIGS +#endif + +// +// define BOOST_TT_NO_CV_FUNC_TEST +// if tests for cv-qualified member functions don't +// work in is_member_function_pointer +// +#if BOOST_WORKAROUND(__MWERKS__, < 0x3000) || BOOST_WORKAROUND(__IBMCPP__, <= 600) +# define BOOST_TT_NO_CV_FUNC_TEST +#endif + +// +// Macros that have been deprecated, defined here for backwards compatibility: +// +#define BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(x) +#define BOOST_TT_BROKEN_COMPILER_SPEC(x) + +#endif // BOOST_TT_CONFIG_HPP_INCLUDED + + diff --git a/boost/type_traits/detail/cv_traits_impl.hpp b/boost/type_traits/detail/cv_traits_impl.hpp deleted file mode 100644 index 8e995bb064..0000000000 --- a/boost/type_traits/detail/cv_traits_impl.hpp +++ /dev/null @@ -1,140 +0,0 @@ - -// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard -// Hinnant & John Maddock 2000. -// Use, modification and distribution are subject to 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). -// -// See http://www.boost.org/libs/type_traits for most recent version including documentation. - - -#ifndef BOOST_TT_DETAIL_CV_TRAITS_IMPL_HPP_INCLUDED -#define BOOST_TT_DETAIL_CV_TRAITS_IMPL_HPP_INCLUDED - -#include <cstddef> -#include <boost/config.hpp> -#include <boost/detail/workaround.hpp> - - -// implementation helper: - - -namespace boost { -namespace detail { - -#if BOOST_WORKAROUND(BOOST_MSVC, == 1700) -#define BOOST_TT_AUX_CV_TRAITS_IMPL_PARAM(X) X - template <typename T> - struct cv_traits_imp - { - BOOST_STATIC_CONSTANT(bool, is_const = false); - BOOST_STATIC_CONSTANT(bool, is_volatile = false); - typedef T unqualified_type; - }; - - template <typename T> - struct cv_traits_imp<T[]> - { - BOOST_STATIC_CONSTANT(bool, is_const = false); - BOOST_STATIC_CONSTANT(bool, is_volatile = false); - typedef T unqualified_type[]; - }; - - template <typename T> - struct cv_traits_imp<const T[]> - { - BOOST_STATIC_CONSTANT(bool, is_const = true); - BOOST_STATIC_CONSTANT(bool, is_volatile = false); - typedef T unqualified_type[]; - }; - - template <typename T> - struct cv_traits_imp<volatile T[]> - { - BOOST_STATIC_CONSTANT(bool, is_const = false); - BOOST_STATIC_CONSTANT(bool, is_volatile = true); - typedef T unqualified_type[]; - }; - - template <typename T> - struct cv_traits_imp<const volatile T[]> - { - BOOST_STATIC_CONSTANT(bool, is_const = true); - BOOST_STATIC_CONSTANT(bool, is_volatile = true); - typedef T unqualified_type[]; - }; - - template <typename T, std::size_t N> - struct cv_traits_imp<T[N]> - { - BOOST_STATIC_CONSTANT(bool, is_const = false); - BOOST_STATIC_CONSTANT(bool, is_volatile = false); - typedef T unqualified_type[N]; - }; - - template <typename T, std::size_t N> - struct cv_traits_imp<const T[N]> - { - BOOST_STATIC_CONSTANT(bool, is_const = true); - BOOST_STATIC_CONSTANT(bool, is_volatile = false); - typedef T unqualified_type[N]; - }; - - template <typename T, std::size_t N> - struct cv_traits_imp<volatile T[N]> - { - BOOST_STATIC_CONSTANT(bool, is_const = false); - BOOST_STATIC_CONSTANT(bool, is_volatile = true); - typedef T unqualified_type[N]; - }; - - template <typename T, std::size_t N> - struct cv_traits_imp<const volatile T[N]> - { - BOOST_STATIC_CONSTANT(bool, is_const = true); - BOOST_STATIC_CONSTANT(bool, is_volatile = true); - typedef T unqualified_type[N]; - }; - -#else -#define BOOST_TT_AUX_CV_TRAITS_IMPL_PARAM(X) X * -template <typename T> struct cv_traits_imp {}; - -template <typename T> -struct cv_traits_imp<T*> -{ - BOOST_STATIC_CONSTANT(bool, is_const = false); - BOOST_STATIC_CONSTANT(bool, is_volatile = false); - typedef T unqualified_type; -}; -#endif - -template <typename T> -struct cv_traits_imp<BOOST_TT_AUX_CV_TRAITS_IMPL_PARAM(const T)> -{ - BOOST_STATIC_CONSTANT(bool, is_const = true); - BOOST_STATIC_CONSTANT(bool, is_volatile = false); - typedef T unqualified_type; -}; - -template <typename T> -struct cv_traits_imp<BOOST_TT_AUX_CV_TRAITS_IMPL_PARAM(volatile T)> -{ - BOOST_STATIC_CONSTANT(bool, is_const = false); - BOOST_STATIC_CONSTANT(bool, is_volatile = true); - typedef T unqualified_type; -}; - -template <typename T> -struct cv_traits_imp<BOOST_TT_AUX_CV_TRAITS_IMPL_PARAM(const volatile T)> -{ - BOOST_STATIC_CONSTANT(bool, is_const = true); - BOOST_STATIC_CONSTANT(bool, is_volatile = true); - typedef T unqualified_type; -}; - -} // namespace detail -} // namespace boost - - -#endif // BOOST_TT_DETAIL_CV_TRAITS_IMPL_HPP_INCLUDED diff --git a/boost/type_traits/detail/false_result.hpp b/boost/type_traits/detail/false_result.hpp deleted file mode 100644 index e65e8bc257..0000000000 --- a/boost/type_traits/detail/false_result.hpp +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright David Abrahams 2002. -// Use, modification and distribution are subject to 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). -// -// See http://www.boost.org/libs/type_traits for most recent version including documentation. - - -#ifndef BOOST_TT_DETAIL_FALSE_RESULT_HPP_INCLUDED -#define BOOST_TT_DETAIL_FALSE_RESULT_HPP_INCLUDED - -#include <boost/config.hpp> - -namespace boost { -namespace type_traits { - -// Utility class which always "returns" false -struct false_result -{ - template <typename T> struct result_ - { - BOOST_STATIC_CONSTANT(bool, value = false); - }; -}; - -}} // namespace boost::type_traits - -#endif // BOOST_TT_DETAIL_FALSE_RESULT_HPP_INCLUDED diff --git a/boost/type_traits/detail/has_binary_operator.hpp b/boost/type_traits/detail/has_binary_operator.hpp index d82a5cefdb..039a6bb778 100644 --- a/boost/type_traits/detail/has_binary_operator.hpp +++ b/boost/type_traits/detail/has_binary_operator.hpp @@ -7,7 +7,7 @@ // See http://www.boost.org/libs/type_traits for most recent version including documentation. #include <boost/config.hpp> -#include <boost/type_traits/ice.hpp> +#include <boost/type_traits/detail/yes_no_type.hpp> #include <boost/type_traits/integral_constant.hpp> #include <boost/type_traits/is_base_of.hpp> #include <boost/type_traits/is_const.hpp> @@ -21,9 +21,6 @@ #include <boost/type_traits/remove_pointer.hpp> #include <boost/type_traits/remove_reference.hpp> -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> - // cannot include this header without getting warnings of the kind: // gcc: // warning: value computed is not used @@ -40,7 +37,10 @@ # pragma GCC system_header #elif defined(BOOST_MSVC) # pragma warning ( push ) -# pragma warning ( disable : 4018 4244 4547 4800 4804 4805 4913 ) +# pragma warning ( disable : 4018 4244 4547 4800 4804 4805 4913) +# if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) +# pragma warning ( disable : 6334) +# endif #endif namespace boost { @@ -177,13 +177,7 @@ struct trait_impl1 < Lhs, Rhs, Ret, true > { template < typename Lhs, typename Rhs, typename Ret > struct trait_impl1 < Lhs, Rhs, Ret, false > { BOOST_STATIC_CONSTANT(bool, - value = ( - ::boost::type_traits::ice_and< - operator_exists < Lhs, Rhs >::value, - operator_returns_Ret < Lhs, Rhs, Ret, operator_returns_void < Lhs, Rhs >::value >::value - >::value - ) - ); + value = (operator_exists < Lhs, Rhs >::value && operator_returns_Ret < Lhs, Rhs, Ret, operator_returns_void < Lhs, Rhs >::value >::value)); }; // some specializations needs to be declared for the special void case @@ -218,12 +212,11 @@ struct trait_impl { } // namespace detail // this is the accessible definition of the trait to end user -BOOST_TT_AUX_BOOL_TRAIT_DEF3(BOOST_TT_TRAIT_NAME, Lhs, Rhs=Lhs, Ret=::boost::detail::BOOST_JOIN(BOOST_TT_TRAIT_NAME,_impl)::dont_care, (::boost::detail::BOOST_JOIN(BOOST_TT_TRAIT_NAME,_impl)::trait_impl < Lhs, Rhs, Ret >::value)) +template <class Lhs, class Rhs=Lhs, class Ret=::boost::detail::BOOST_JOIN(BOOST_TT_TRAIT_NAME,_impl)::dont_care> +struct BOOST_TT_TRAIT_NAME : public integral_constant<bool, (::boost::detail::BOOST_JOIN(BOOST_TT_TRAIT_NAME, _impl)::trait_impl < Lhs, Rhs, Ret >::value)>{}; } // namespace boost #if defined(BOOST_MSVC) # pragma warning ( pop ) #endif - -#include <boost/type_traits/detail/bool_trait_undef.hpp> diff --git a/boost/type_traits/detail/has_postfix_operator.hpp b/boost/type_traits/detail/has_postfix_operator.hpp index e9048e1214..3e686f12b5 100644 --- a/boost/type_traits/detail/has_postfix_operator.hpp +++ b/boost/type_traits/detail/has_postfix_operator.hpp @@ -7,7 +7,7 @@ // See http://www.boost.org/libs/type_traits for most recent version including documentation. #include <boost/config.hpp> -#include <boost/type_traits/ice.hpp> +#include <boost/type_traits/detail/yes_no_type.hpp> #include <boost/type_traits/integral_constant.hpp> #include <boost/type_traits/is_const.hpp> #include <boost/type_traits/is_fundamental.hpp> @@ -18,15 +18,15 @@ #include <boost/type_traits/remove_pointer.hpp> #include <boost/type_traits/remove_reference.hpp> -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> - // avoid warnings #if defined(__GNUC__) # pragma GCC system_header #elif defined(BOOST_MSVC) # pragma warning ( push ) -# pragma warning ( disable : 4244 4913 ) +# pragma warning ( disable : 4244 4913) +# if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) +# pragma warning ( disable : 6334) +# endif #endif namespace boost { @@ -163,13 +163,7 @@ struct trait_impl1 < Lhs, Ret, true > { template < typename Lhs, typename Ret > struct trait_impl1 < Lhs, Ret, false > { BOOST_STATIC_CONSTANT(bool, - value = ( - ::boost::type_traits::ice_and< - operator_exists < Lhs >::value, - operator_returns_Ret < Lhs, Ret, operator_returns_void < Lhs >::value >::value - >::value - ) - ); + value = (operator_exists < Lhs >::value && operator_returns_Ret < Lhs, Ret, operator_returns_void < Lhs >::value >::value)); }; // specialization needs to be declared for the special void case @@ -191,12 +185,11 @@ struct trait_impl { } // namespace detail // this is the accessible definition of the trait to end user -BOOST_TT_AUX_BOOL_TRAIT_DEF2(BOOST_TT_TRAIT_NAME, Lhs, Ret=::boost::detail::BOOST_JOIN(BOOST_TT_TRAIT_NAME,_impl)::dont_care, (::boost::detail::BOOST_JOIN(BOOST_TT_TRAIT_NAME,_impl)::trait_impl< Lhs, Ret >::value)) +template <class Lhs, class Ret=::boost::detail::BOOST_JOIN(BOOST_TT_TRAIT_NAME,_impl)::dont_care> +struct BOOST_TT_TRAIT_NAME : public integral_constant<bool, (::boost::detail::BOOST_JOIN(BOOST_TT_TRAIT_NAME, _impl)::trait_impl< Lhs, Ret >::value)>{}; } // namespace boost #if defined(BOOST_MSVC) # pragma warning ( pop ) #endif - -#include <boost/type_traits/detail/bool_trait_undef.hpp> diff --git a/boost/type_traits/detail/has_prefix_operator.hpp b/boost/type_traits/detail/has_prefix_operator.hpp index e1cf8d054f..d4574fc60d 100644 --- a/boost/type_traits/detail/has_prefix_operator.hpp +++ b/boost/type_traits/detail/has_prefix_operator.hpp @@ -7,7 +7,7 @@ // See http://www.boost.org/libs/type_traits for most recent version including documentation. #include <boost/config.hpp> -#include <boost/type_traits/ice.hpp> +#include <boost/type_traits/detail/yes_no_type.hpp> #include <boost/type_traits/integral_constant.hpp> #include <boost/type_traits/is_const.hpp> #include <boost/type_traits/is_fundamental.hpp> @@ -19,9 +19,6 @@ #include <boost/type_traits/remove_pointer.hpp> #include <boost/type_traits/remove_reference.hpp> -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> - // cannot include this header without getting warnings of the kind: // gcc: // warning: value computed is not used @@ -34,9 +31,14 @@ # pragma GCC system_header #elif defined(BOOST_MSVC) # pragma warning ( push ) -# pragma warning ( disable : 4146 4804 4913 4244 ) +# pragma warning ( disable : 4146 4804 4913 4244) +# if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) +# pragma warning ( disable : 6334) +# endif #endif + + namespace boost { namespace detail { @@ -171,13 +173,7 @@ struct trait_impl1 < Rhs, Ret, true > { template < typename Rhs, typename Ret > struct trait_impl1 < Rhs, Ret, false > { BOOST_STATIC_CONSTANT(bool, - value = ( - ::boost::type_traits::ice_and< - operator_exists < Rhs >::value, - operator_returns_Ret < Rhs, Ret, operator_returns_void < Rhs >::value >::value - >::value - ) - ); + value = (operator_exists < Rhs >::value && operator_returns_Ret < Rhs, Ret, operator_returns_void < Rhs >::value >::value)); }; // specialization needs to be declared for the special void case @@ -199,12 +195,11 @@ struct trait_impl { } // namespace detail // this is the accessible definition of the trait to end user -BOOST_TT_AUX_BOOL_TRAIT_DEF2(BOOST_TT_TRAIT_NAME, Rhs, Ret=::boost::detail::BOOST_JOIN(BOOST_TT_TRAIT_NAME,_impl)::dont_care, (::boost::detail::BOOST_JOIN(BOOST_TT_TRAIT_NAME,_impl)::trait_impl < Rhs, Ret >::value)) +template <class Rhs, class Ret=::boost::detail::BOOST_JOIN(BOOST_TT_TRAIT_NAME,_impl)::dont_care> +struct BOOST_TT_TRAIT_NAME : public integral_constant<bool, (::boost::detail::BOOST_JOIN(BOOST_TT_TRAIT_NAME, _impl)::trait_impl < Rhs, Ret >::value)>{}; } // namespace boost #if defined(BOOST_MSVC) # pragma warning ( pop ) #endif - -#include <boost/type_traits/detail/bool_trait_undef.hpp> diff --git a/boost/type_traits/detail/ice_and.hpp b/boost/type_traits/detail/ice_and.hpp index 8b461b9fff..3ccb03e850 100644 --- a/boost/type_traits/detail/ice_and.hpp +++ b/boost/type_traits/detail/ice_and.hpp @@ -11,6 +11,13 @@ #include <boost/config.hpp> +// +// This header is deprecated and no longer used by type_traits: +// +#if defined(__GNUC__) || defined(_MSC_VER) +# pragma message("NOTE: Use of this header (ice_and.hpp) is deprecated") +#endif + namespace boost { namespace type_traits { diff --git a/boost/type_traits/detail/ice_eq.hpp b/boost/type_traits/detail/ice_eq.hpp index ea42a60b66..5908f81512 100644 --- a/boost/type_traits/detail/ice_eq.hpp +++ b/boost/type_traits/detail/ice_eq.hpp @@ -10,6 +10,13 @@ #include <boost/config.hpp> +// +// This header is deprecated and no longer used by type_traits: +// +#if defined(__GNUC__) || defined(_MSC_VER) +# pragma message("NOTE: Use of this header (ice_eq.hpp) is deprecated") +#endif + namespace boost { namespace type_traits { diff --git a/boost/type_traits/detail/ice_not.hpp b/boost/type_traits/detail/ice_not.hpp index ee1dca0ecd..e095be9cc1 100644 --- a/boost/type_traits/detail/ice_not.hpp +++ b/boost/type_traits/detail/ice_not.hpp @@ -10,6 +10,13 @@ #include <boost/config.hpp> +// +// This header is deprecated and no longer used by type_traits: +// +#if defined(__GNUC__) || defined(_MSC_VER) +# pragma message("NOTE: Use of this header (ice_not.hpp) is deprecated") +#endif + namespace boost { namespace type_traits { diff --git a/boost/type_traits/detail/ice_or.hpp b/boost/type_traits/detail/ice_or.hpp index f88d9f6aec..ea523c808a 100644 --- a/boost/type_traits/detail/ice_or.hpp +++ b/boost/type_traits/detail/ice_or.hpp @@ -10,6 +10,13 @@ #include <boost/config.hpp> +// +// This header is deprecated and no longer used by type_traits: +// +#if defined(__GNUC__) || defined(_MSC_VER) +# pragma message("NOTE: Use of this header (ice_or.hpp) is deprecated") +#endif + namespace boost { namespace type_traits { diff --git a/boost/type_traits/detail/is_function_ptr_helper.hpp b/boost/type_traits/detail/is_function_ptr_helper.hpp index 1c3b17f6d2..3538e402da 100644 --- a/boost/type_traits/detail/is_function_ptr_helper.hpp +++ b/boost/type_traits/detail/is_function_ptr_helper.hpp @@ -15,12 +15,20 @@ #ifndef BOOST_TT_DETAIL_IS_FUNCTION_PTR_HELPER_HPP_INCLUDED #define BOOST_TT_DETAIL_IS_FUNCTION_PTR_HELPER_HPP_INCLUDED -#include <boost/type_traits/config.hpp> - #if defined(BOOST_TT_PREPROCESSING_MODE) -# include <boost/preprocessor/iterate.hpp> -# include <boost/preprocessor/enum_params.hpp> -# include <boost/preprocessor/comma_if.hpp> +// +// Hide these #include from dependency analysers as +// these are required in maintenance mode only: +// +#define PP1 <boost/preprocessor/iterate.hpp> +#include PP1 +#undef PP1 +#define PP1 <boost/preprocessor/enum_params.hpp> +#include PP1 +#undef PP1 +#define PP1 <boost/preprocessor/comma_if.hpp> +#include PP1 +#undef PP1 #endif namespace boost { diff --git a/boost/type_traits/detail/is_function_ptr_tester.hpp b/boost/type_traits/detail/is_function_ptr_tester.hpp index 2eb8a6f47f..4fe88e81b2 100644 --- a/boost/type_traits/detail/is_function_ptr_tester.hpp +++ b/boost/type_traits/detail/is_function_ptr_tester.hpp @@ -15,12 +15,21 @@ #define BOOST_TT_DETAIL_IS_FUNCTION_PTR_TESTER_HPP_INCLUDED #include <boost/type_traits/detail/yes_no_type.hpp> -#include <boost/type_traits/config.hpp> #if defined(BOOST_TT_PREPROCESSING_MODE) -# include <boost/preprocessor/iterate.hpp> -# include <boost/preprocessor/enum_params.hpp> -# include <boost/preprocessor/comma_if.hpp> +// +// Hide include dependencies from analysers since they're +// only require in maintenance mode: +// +#define PP1 <boost/preprocessor/iterate.hpp> +#define PP2 <boost/preprocessor/enum_params.hpp> +#define PP3 <boost/preprocessor/comma_if.hpp> +#include PP1 +#include PP2 +#include PP3 +#undef PP1 +#undef PP2 +#undef PP3 #endif namespace boost { diff --git a/boost/type_traits/detail/is_mem_fun_pointer_impl.hpp b/boost/type_traits/detail/is_mem_fun_pointer_impl.hpp index bd5c591b20..5698a74897 100644 --- a/boost/type_traits/detail/is_mem_fun_pointer_impl.hpp +++ b/boost/type_traits/detail/is_mem_fun_pointer_impl.hpp @@ -17,9 +17,19 @@ #include <boost/config.hpp> #if defined(BOOST_TT_PREPROCESSING_MODE) -# include <boost/preprocessor/iterate.hpp> -# include <boost/preprocessor/enum_params.hpp> -# include <boost/preprocessor/comma_if.hpp> +// +// Maintenance mode, hide include dependencies +// from trackers: +// +#define PPI <boost/preprocessor/iterate.hpp> +#include PPI +#undef PPI +#define PPI <boost/preprocessor/enum_params.hpp> +#include PPI +#undef PPI +#define PPI <boost/preprocessor/comma_if.hpp> +#include PPI +#undef PPI #endif namespace boost { diff --git a/boost/type_traits/detail/is_mem_fun_pointer_tester.hpp b/boost/type_traits/detail/is_mem_fun_pointer_tester.hpp index 334a843450..5e31693111 100644 --- a/boost/type_traits/detail/is_mem_fun_pointer_tester.hpp +++ b/boost/type_traits/detail/is_mem_fun_pointer_tester.hpp @@ -15,12 +15,22 @@ #define BOOST_TT_DETAIL_IS_MEM_FUN_POINTER_TESTER_HPP_INCLUDED #include <boost/type_traits/detail/yes_no_type.hpp> -#include <boost/type_traits/config.hpp> +#include <boost/type_traits/detail/config.hpp> #if defined(BOOST_TT_PREPROCESSING_MODE) -# include <boost/preprocessor/iterate.hpp> -# include <boost/preprocessor/enum_params.hpp> -# include <boost/preprocessor/comma_if.hpp> +// +// Maintentance mode, hide include dependencies +// from dependency trackers: +// +#define PPI <boost/preprocessor/iterate.hpp> +#include PPI +#undef PPI +#define PPI <boost/preprocessor/enum_params.hpp> +#include PPI +#undef PPI +#define <boost/preprocessor/comma_if.hpp> +#include PPI +#undef #endif namespace boost { diff --git a/boost/type_traits/detail/mp_defer.hpp b/boost/type_traits/detail/mp_defer.hpp new file mode 100644 index 0000000000..7910e545e1 --- /dev/null +++ b/boost/type_traits/detail/mp_defer.hpp @@ -0,0 +1,56 @@ +#ifndef BOOST_TYPE_TRAITS_DETAIL_MP_DEFER_HPP_INCLUDED +#define BOOST_TYPE_TRAITS_DETAIL_MP_DEFER_HPP_INCLUDED + +// +// Copyright 2015 Peter Dimov +// +// 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 +// + +#include <boost/type_traits/integral_constant.hpp> +#include <boost/type_traits/conditional.hpp> + +namespace boost +{ + +namespace type_traits_detail +{ + +// mp_valid +// implementation by Bruno Dutra (by the name is_evaluable) + +template<template<class...> class F, class... T> +struct mp_valid_impl +{ + template<template<class...> class G, class = G<T...>> + static boost::true_type check(int); + + template<template<class...> class> + static boost::false_type check(...); + + using type = decltype(check<F>(0)); +}; + +template<template<class...> class F, class... T> +using mp_valid = typename mp_valid_impl<F, T...>::type; + +// mp_defer + +struct mp_empty +{ +}; + +template<template<class...> class F, class... T> struct mp_defer_impl +{ + using type = F<T...>; +}; + +template<template<class...> class F, class... T> using mp_defer = typename boost::conditional<mp_valid<F, T...>::value, mp_defer_impl<F, T...>, mp_empty>::type; + +} // namespace type_traits_detail + +} // namespace boost + +#endif // #ifndef BOOST_TYPE_TRAITS_DETAIL_MP_DEFER_HPP_INCLUDED diff --git a/boost/type_traits/detail/size_t_trait_def.hpp b/boost/type_traits/detail/size_t_trait_def.hpp deleted file mode 100644 index 8cea9b4522..0000000000 --- a/boost/type_traits/detail/size_t_trait_def.hpp +++ /dev/null @@ -1,51 +0,0 @@ - -// NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION - -// Copyright Aleksey Gurtovoy 2002-2004 -// -// 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) - -// $Source$ -// $Date$ -// $Revision$ - -#include <boost/type_traits/detail/template_arity_spec.hpp> -#include <boost/type_traits/integral_constant.hpp> -#include <boost/mpl/aux_/lambda_support.hpp> -#include <boost/mpl/size_t.hpp> - -#include <cstddef> - -// Obsolete. Remove. -#define BOOST_TT_AUX_SIZE_T_BASE(C) public ::boost::integral_constant<std::size_t,C> -#define BOOST_TT_AUX_SIZE_T_TRAIT_VALUE_DECL(C) /**/ - - -#define BOOST_TT_AUX_SIZE_T_TRAIT_DEF1(trait,T,C) \ -template< typename T > struct trait \ - : public ::boost::integral_constant<std::size_t,C> \ -{ \ -public:\ - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,trait,(T)) \ -}; \ -\ -BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1,trait) \ -/**/ - -#define BOOST_TT_AUX_SIZE_T_TRAIT_SPEC1(trait,spec,C) \ -template<> struct trait<spec> \ - : public ::boost::integral_constant<std::size_t,C> \ -{ \ -public:\ - BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(1,trait,(spec)) \ -}; \ -/**/ - -#define BOOST_TT_AUX_SIZE_T_TRAIT_PARTIAL_SPEC1_1(param,trait,spec,C) \ -template< param > struct trait<spec> \ - : public ::boost::integral_constant<std::size_t,C> \ -{ \ -}; \ -/**/ diff --git a/boost/type_traits/detail/size_t_trait_undef.hpp b/boost/type_traits/detail/size_t_trait_undef.hpp deleted file mode 100644 index 1694fac772..0000000000 --- a/boost/type_traits/detail/size_t_trait_undef.hpp +++ /dev/null @@ -1,16 +0,0 @@ - -// NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION - -// Copyright Aleksey Gurtovoy 2002-2004 -// -// 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) - -// $Source$ -// $Date$ -// $Revision$ - -#undef BOOST_TT_AUX_SIZE_T_TRAIT_DEF1 -#undef BOOST_TT_AUX_SIZE_T_TRAIT_SPEC1 -#undef BOOST_TT_AUX_SIZE_T_TRAIT_PARTIAL_SPEC1_1 diff --git a/boost/type_traits/detail/template_arity_spec.hpp b/boost/type_traits/detail/template_arity_spec.hpp index fe9b422e83..36ea96d6d5 100644 --- a/boost/type_traits/detail/template_arity_spec.hpp +++ b/boost/type_traits/detail/template_arity_spec.hpp @@ -1,4 +1,3 @@ - // NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION // Copyright Aleksey Gurtovoy 2002-2004 @@ -7,25 +6,11 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include <boost/mpl/int.hpp> -#include <boost/mpl/aux_/template_arity_fwd.hpp> -#include <boost/mpl/aux_/preprocessor/params.hpp> -#include <boost/mpl/aux_/config/lambda.hpp> -#include <boost/mpl/aux_/config/overload_resolution.hpp> +// +// This header is deprecated and no longer used by type_traits: +// +#if defined(__GNUC__) || defined(_MSC_VER) +# pragma message("NOTE: Use of this header (template_arity_spec.hpp) is deprecated") +#endif -#if defined(BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT) \ - && defined(BOOST_MPL_CFG_BROKEN_OVERLOAD_RESOLUTION) -# define BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(i, name) \ -namespace mpl { namespace aux { \ -template< BOOST_MPL_PP_PARAMS(i, typename T) > \ -struct template_arity< \ - name< BOOST_MPL_PP_PARAMS(i, T) > \ - > \ - : int_<i> \ -{ \ -}; \ -}} \ -/**/ -#else # define BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(i, name) /**/ -#endif diff --git a/boost/type_traits/detail/type_trait_def.hpp b/boost/type_traits/detail/type_trait_def.hpp deleted file mode 100644 index bc54696b55..0000000000 --- a/boost/type_traits/detail/type_trait_def.hpp +++ /dev/null @@ -1,67 +0,0 @@ - -// NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION - -// Copyright Aleksey Gurtovoy 2002-2004 -// -// 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) - -// $Source$ -// $Date$ -// $Revision$ - -#include <boost/type_traits/detail/template_arity_spec.hpp> -#include <boost/mpl/aux_/lambda_support.hpp> - -#define BOOST_TT_AUX_TYPE_TRAIT_DEF1(trait,T,result) \ -template< typename T > struct trait \ -{ \ -public:\ - typedef result type; \ - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,trait,(T)) \ -}; \ -\ -BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1,trait) \ -/**/ - -#define BOOST_TT_AUX_TYPE_TRAIT_SPEC1(trait,spec,result) \ -template<> struct trait<spec> \ -{ \ -public:\ - typedef result type; \ - BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(1,trait,(spec)) \ -}; \ -/**/ - -#define BOOST_TT_AUX_TYPE_TRAIT_IMPL_SPEC1(trait,spec,result) \ -template<> struct trait##_impl<spec> \ -{ \ -public:\ - typedef result type; \ -}; \ -/**/ - -#define BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(param,trait,spec,result) \ -template< param > struct trait<spec> \ -{ \ -public:\ - typedef result type; \ -}; \ -/**/ - -#define BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(param1,param2,trait,spec,result) \ -template< param1, param2 > struct trait<spec> \ -{ \ -public:\ - typedef result; \ -}; \ -/**/ - -#define BOOST_TT_AUX_TYPE_TRAIT_IMPL_PARTIAL_SPEC1_1(param,trait,spec,result) \ -template< param > struct trait##_impl<spec> \ -{ \ -public:\ - typedef result type; \ -}; \ -/**/ diff --git a/boost/type_traits/detail/type_trait_undef.hpp b/boost/type_traits/detail/type_trait_undef.hpp deleted file mode 100644 index d8edf66275..0000000000 --- a/boost/type_traits/detail/type_trait_undef.hpp +++ /dev/null @@ -1,19 +0,0 @@ - -// NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION - -// Copyright Aleksey Gurtovoy 2002-2004 -// -// 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) - -// $Source$ -// $Date$ -// $Revision$ - -#undef BOOST_TT_AUX_TYPE_TRAIT_DEF1 -#undef BOOST_TT_AUX_TYPE_TRAIT_SPEC1 -#undef BOOST_TT_AUX_TYPE_TRAIT_IMPL_SPEC1 -#undef BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1 -#undef BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2 -#undef BOOST_TT_AUX_TYPE_TRAIT_IMPL_PARTIAL_SPEC1_1 diff --git a/boost/type_traits/detail/wrap.hpp b/boost/type_traits/detail/wrap.hpp deleted file mode 100644 index d0a75d06cb..0000000000 --- a/boost/type_traits/detail/wrap.hpp +++ /dev/null @@ -1,18 +0,0 @@ -// (C) Copyright David Abrahams 2002. -// Use, modification and distribution are subject to 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). -// -// See http://www.boost.org/libs/type_traits for most recent version including documentation. - -#ifndef BOOST_TT_DETAIL_WRAP_HPP_INCLUDED -#define BOOST_TT_DETAIL_WRAP_HPP_INCLUDED - -namespace boost { -namespace type_traits { - -template <class T> struct wrap {}; - -}} // namespace boost::type_traits - -#endif // BOOST_TT_DETAIL_WRAP_HPP_INCLUDED diff --git a/boost/type_traits/extent.hpp b/boost/type_traits/extent.hpp index c41f7f2ffe..dfb3c54ee8 100644 --- a/boost/type_traits/extent.hpp +++ b/boost/type_traits/extent.hpp @@ -10,8 +10,8 @@ #ifndef BOOST_TT_EXTENT_HPP_INCLUDED #define BOOST_TT_EXTENT_HPP_INCLUDED -// should be the last #include -#include <boost/type_traits/detail/size_t_trait_def.hpp> +#include <boost/type_traits/integral_constant.hpp> +#include <boost/detail/workaround.hpp> namespace boost { @@ -131,11 +131,8 @@ template <class T, std::size_t N = 0> struct extent : public ::boost::integral_constant<std::size_t, ::boost::detail::extent_imp<T,N>::value> { - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,extent,(T)) }; } // namespace boost -#include <boost/type_traits/detail/size_t_trait_undef.hpp> - #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/boost/type_traits/floating_point_promotion.hpp b/boost/type_traits/floating_point_promotion.hpp index 8b6ae3a32a..993e14ef4b 100644 --- a/boost/type_traits/floating_point_promotion.hpp +++ b/boost/type_traits/floating_point_promotion.hpp @@ -6,86 +6,15 @@ #ifndef FILE_boost_type_traits_floating_point_promotion_hpp_INCLUDED #define FILE_boost_type_traits_floating_point_promotion_hpp_INCLUDED -#include <boost/config.hpp> - -#ifdef BOOST_NO_CV_SPECIALIZATIONS -#include <boost/mpl/at.hpp> -#include <boost/mpl/int.hpp> -#include <boost/mpl/multiplies.hpp> -#include <boost/mpl/plus.hpp> -#include <boost/mpl/vector.hpp> -#include <boost/type_traits/is_same.hpp> -#endif - -// Should be the last #include -#include <boost/type_traits/detail/type_trait_def.hpp> - namespace boost { -namespace type_traits { namespace detail { - -#ifndef BOOST_NO_CV_SPECIALIZATIONS - -template<class T> -struct floating_point_promotion -{ - typedef T type; -}; - -template<> -struct floating_point_promotion<float> -{ - typedef double type; -}; - -template<> -struct floating_point_promotion<float const> -{ - typedef double const type; -}; + template<class T> struct floating_point_promotion { typedef T type; }; + template<> struct floating_point_promotion<float> { typedef double type; }; + template<> struct floating_point_promotion<float const> { typedef double const type; }; + template<> struct floating_point_promotion<float volatile>{ typedef double volatile type; }; + template<> struct floating_point_promotion<float const volatile> { typedef double const volatile type; }; -template<> -struct floating_point_promotion<float volatile> -{ - typedef double volatile type; -}; - -template<> -struct floating_point_promotion<float const volatile> -{ - typedef double const volatile type; -}; - -#else - -template<class T> -struct floating_point_promotion - : mpl::at< - mpl::vector< T, double, double const, double volatile, - double const volatile > - , mpl::plus< - is_same<T, float> - , mpl::multiplies< is_same<T, float const> , mpl::int_<2> > - , mpl::multiplies< is_same<T, float volatile> , mpl::int_<3> > - , mpl::multiplies< is_same<T, float const volatile>, mpl::int_<4> > - > - > -{ -}; - -#endif - -} } - -BOOST_TT_AUX_TYPE_TRAIT_DEF1( - floating_point_promotion - , T - , BOOST_DEDUCED_TYPENAME - boost::type_traits::detail::floating_point_promotion<T>::type - ) } -#include <boost/type_traits/detail/type_trait_undef.hpp> - #endif // #ifndef FILE_boost_type_traits_floating_point_promotion_hpp_INCLUDED diff --git a/boost/type_traits/has_bit_and.hpp b/boost/type_traits/has_bit_and.hpp index ee3307f8da..a16c71a48d 100644 --- a/boost/type_traits/has_bit_and.hpp +++ b/boost/type_traits/has_bit_and.hpp @@ -12,32 +12,32 @@ #define BOOST_TT_TRAIT_NAME has_bit_and #define BOOST_TT_TRAIT_OP & #define BOOST_TT_FORBIDDEN_IF\ - ::boost::type_traits::ice_or<\ + (\ /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ - ::boost::is_fundamental< Rhs_nocv >::value,\ - ::boost::type_traits::ice_or<\ - ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ - ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ - >::value\ - >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ + ::boost::is_fundamental< Rhs_nocv >::value && \ + ( \ + (! ::boost::is_integral< Lhs_noref >::value ) || \ + (! ::boost::is_integral< Rhs_noref >::value )\ + )\ + )||\ /* Lhs==fundamental and Rhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ ::boost::is_pointer< Rhs_noref >::value\ - >::value,\ + )||\ /* Rhs==fundamental and Lhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Rhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Rhs_nocv >::value && \ ::boost::is_pointer< Lhs_noref >::value\ - >::value,\ + )||\ /* Lhs==pointer and Rhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ ::boost::is_pointer< Rhs_noref >::value\ - >::value\ - >::value + )\ + ) #include <boost/type_traits/detail/has_binary_operator.hpp> diff --git a/boost/type_traits/has_bit_and_assign.hpp b/boost/type_traits/has_bit_and_assign.hpp index 5b3112a5bd..01e25e318f 100644 --- a/boost/type_traits/has_bit_and_assign.hpp +++ b/boost/type_traits/has_bit_and_assign.hpp @@ -12,38 +12,38 @@ #define BOOST_TT_TRAIT_NAME has_bit_and_assign #define BOOST_TT_TRAIT_OP &= #define BOOST_TT_FORBIDDEN_IF\ - ::boost::type_traits::ice_or<\ + (\ /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ - ::boost::is_fundamental< Rhs_nocv >::value,\ - ::boost::type_traits::ice_or<\ - ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ - ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ - >::value\ - >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ + ::boost::is_fundamental< Rhs_nocv >::value && \ + (\ + (! ::boost::is_integral< Lhs_noref >::value ) || \ + (! ::boost::is_integral< Rhs_noref >::value )\ + )\ + )||\ /* Lhs==fundamental and Rhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ ::boost::is_pointer< Rhs_noref >::value\ - >::value,\ + )||\ /* Rhs==fundamental and Lhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Rhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Rhs_nocv >::value && \ ::boost::is_pointer< Lhs_noref >::value\ - >::value,\ + )||\ /* Lhs==pointer and Rhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ ::boost::is_pointer< Rhs_noref >::value\ - >::value,\ + )||\ /* Lhs==fundamental and Rhs==fundamental and Lhs==const */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ - ::boost::is_fundamental< Rhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ + ::boost::is_fundamental< Rhs_nocv >::value && \ ::boost::is_const< Lhs_noref >::value\ - >::value\ - >::value + )\ + ) #include <boost/type_traits/detail/has_binary_operator.hpp> diff --git a/boost/type_traits/has_bit_or.hpp b/boost/type_traits/has_bit_or.hpp index 922b4ce966..6e76929fda 100644 --- a/boost/type_traits/has_bit_or.hpp +++ b/boost/type_traits/has_bit_or.hpp @@ -12,32 +12,32 @@ #define BOOST_TT_TRAIT_NAME has_bit_or #define BOOST_TT_TRAIT_OP | #define BOOST_TT_FORBIDDEN_IF\ - ::boost::type_traits::ice_or<\ + (\ /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ - ::boost::is_fundamental< Rhs_nocv >::value,\ - ::boost::type_traits::ice_or<\ - ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ - ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ - >::value\ - >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ + ::boost::is_fundamental< Rhs_nocv >::value && \ + ( \ + (! ::boost::is_integral< Lhs_noref >::value ) || \ + (! ::boost::is_integral< Rhs_noref >::value )\ + )\ + )||\ /* Lhs==fundamental and Rhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ ::boost::is_pointer< Rhs_noref >::value\ - >::value,\ + )||\ /* Rhs==fundamental and Lhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Rhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Rhs_nocv >::value && \ ::boost::is_pointer< Lhs_noref >::value\ - >::value,\ + )||\ /* Lhs==pointer and Rhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ ::boost::is_pointer< Rhs_noref >::value\ - >::value\ - >::value + )\ + ) #include <boost/type_traits/detail/has_binary_operator.hpp> diff --git a/boost/type_traits/has_bit_or_assign.hpp b/boost/type_traits/has_bit_or_assign.hpp index 5481b92453..891c39c51b 100644 --- a/boost/type_traits/has_bit_or_assign.hpp +++ b/boost/type_traits/has_bit_or_assign.hpp @@ -12,38 +12,38 @@ #define BOOST_TT_TRAIT_NAME has_bit_or_assign #define BOOST_TT_TRAIT_OP |= #define BOOST_TT_FORBIDDEN_IF\ - ::boost::type_traits::ice_or<\ + (\ /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ - ::boost::is_fundamental< Rhs_nocv >::value,\ - ::boost::type_traits::ice_or<\ - ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ - ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ - >::value\ - >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ + ::boost::is_fundamental< Rhs_nocv >::value && \ + ( \ + (! ::boost::is_integral< Lhs_noref >::value ) || \ + (! ::boost::is_integral< Rhs_noref >::value )\ + )\ + )||\ /* Lhs==fundamental and Rhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ ::boost::is_pointer< Rhs_noref >::value\ - >::value,\ + )||\ /* Rhs==fundamental and Lhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Rhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Rhs_nocv >::value && \ ::boost::is_pointer< Lhs_noref >::value\ - >::value,\ + )||\ /* Lhs==pointer and Rhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ ::boost::is_pointer< Rhs_noref >::value\ - >::value,\ + )||\ /* Lhs==fundamental and Rhs==fundamental and Lhs==const */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ - ::boost::is_fundamental< Rhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ + ::boost::is_fundamental< Rhs_nocv >::value && \ ::boost::is_const< Lhs_noref >::value\ - >::value\ - >::value + )\ + ) #include <boost/type_traits/detail/has_binary_operator.hpp> diff --git a/boost/type_traits/has_bit_xor.hpp b/boost/type_traits/has_bit_xor.hpp index 883dcf691c..05173ac11d 100644 --- a/boost/type_traits/has_bit_xor.hpp +++ b/boost/type_traits/has_bit_xor.hpp @@ -12,32 +12,32 @@ #define BOOST_TT_TRAIT_NAME has_bit_xor #define BOOST_TT_TRAIT_OP ^ #define BOOST_TT_FORBIDDEN_IF\ - ::boost::type_traits::ice_or<\ + (\ /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ - ::boost::is_fundamental< Rhs_nocv >::value,\ - ::boost::type_traits::ice_or<\ - ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ - ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ - >::value\ - >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ + ::boost::is_fundamental< Rhs_nocv >::value && \ + ( \ + (! ::boost::is_integral< Lhs_noref >::value ) || \ + (! ::boost::is_integral< Rhs_noref >::value )\ + )\ + )||\ /* Lhs==fundamental and Rhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ ::boost::is_pointer< Rhs_noref >::value\ - >::value,\ + )||\ /* Rhs==fundamental and Lhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Rhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Rhs_nocv >::value && \ ::boost::is_pointer< Lhs_noref >::value\ - >::value,\ + )||\ /* Lhs==pointer and Rhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ ::boost::is_pointer< Rhs_noref >::value\ - >::value\ - >::value + )\ + ) #include <boost/type_traits/detail/has_binary_operator.hpp> diff --git a/boost/type_traits/has_bit_xor_assign.hpp b/boost/type_traits/has_bit_xor_assign.hpp index e2767cc8c6..3866b7ac48 100644 --- a/boost/type_traits/has_bit_xor_assign.hpp +++ b/boost/type_traits/has_bit_xor_assign.hpp @@ -12,38 +12,38 @@ #define BOOST_TT_TRAIT_NAME has_bit_xor_assign #define BOOST_TT_TRAIT_OP ^= #define BOOST_TT_FORBIDDEN_IF\ - ::boost::type_traits::ice_or<\ + (\ /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ - ::boost::is_fundamental< Rhs_nocv >::value,\ - ::boost::type_traits::ice_or<\ - ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ - ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ - >::value\ - >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ + ::boost::is_fundamental< Rhs_nocv >::value && \ + ( \ + (! ::boost::is_integral< Lhs_noref >::value ) || \ + (! ::boost::is_integral< Rhs_noref >::value )\ + )\ + )||\ /* Lhs==fundamental and Rhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ ::boost::is_pointer< Rhs_noref >::value\ - >::value,\ + )||\ /* Rhs==fundamental and Lhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Rhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Rhs_nocv >::value && \ ::boost::is_pointer< Lhs_noref >::value\ - >::value,\ + )||\ /* Lhs==pointer and Rhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ ::boost::is_pointer< Rhs_noref >::value\ - >::value,\ + )||\ /* Lhs==fundamental and Rhs==fundamental and Lhs==const */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ - ::boost::is_fundamental< Rhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ + ::boost::is_fundamental< Rhs_nocv >::value && \ ::boost::is_const< Lhs_noref >::value\ - >::value\ - >::value + )\ + ) #include <boost/type_traits/detail/has_binary_operator.hpp> diff --git a/boost/type_traits/has_complement.hpp b/boost/type_traits/has_complement.hpp index dafd9f5215..d323e12936 100644 --- a/boost/type_traits/has_complement.hpp +++ b/boost/type_traits/has_complement.hpp @@ -12,15 +12,15 @@ #define BOOST_TT_TRAIT_NAME has_complement #define BOOST_TT_TRAIT_OP ~ #define BOOST_TT_FORBIDDEN_IF\ - ::boost::type_traits::ice_or<\ + (\ /* pointer */\ - ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value || \ /* fundamental non integral */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Rhs_noref >::value,\ - ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ - >::value\ - >::value + (\ + ::boost::is_fundamental< Rhs_noref >::value && \ + (! ::boost::is_integral< Rhs_noref >::value )\ + )\ + ) #include <boost/type_traits/detail/has_prefix_operator.hpp> diff --git a/boost/type_traits/has_dereference.hpp b/boost/type_traits/has_dereference.hpp index fe48e11878..1e514cdf41 100644 --- a/boost/type_traits/has_dereference.hpp +++ b/boost/type_traits/has_dereference.hpp @@ -13,13 +13,13 @@ #define BOOST_TT_TRAIT_OP * #define BOOST_TT_FORBIDDEN_IF\ /* void* or fundamental */\ - ::boost::type_traits::ice_or<\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Rhs_noref >::value,\ + (\ + (\ + ::boost::is_pointer< Rhs_noref >::value && \ ::boost::is_void< Rhs_noptr >::value\ - >::value,\ + ) || \ ::boost::is_fundamental< Rhs_nocv >::value\ - >::value + ) #include <boost/type_traits/detail/has_prefix_operator.hpp> diff --git a/boost/type_traits/has_divides.hpp b/boost/type_traits/has_divides.hpp index 277c2da4b6..869e907f6a 100644 --- a/boost/type_traits/has_divides.hpp +++ b/boost/type_traits/has_divides.hpp @@ -13,22 +13,22 @@ #define BOOST_TT_TRAIT_OP / #define BOOST_TT_FORBIDDEN_IF\ /* pointer with pointer or fundamental */\ - ::boost::type_traits::ice_or<\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ - ::boost::type_traits::ice_or<\ - ::boost::is_fundamental< Rhs_nocv >::value,\ + (\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ + ( \ + ::boost::is_fundamental< Rhs_nocv >::value || \ ::boost::is_pointer< Rhs_noref >::value\ - >::value\ - >::value,\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Rhs_noref >::value,\ - ::boost::type_traits::ice_or<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ + )\ + )||\ + (\ + ::boost::is_pointer< Rhs_noref >::value && \ + ( \ + ::boost::is_fundamental< Lhs_nocv >::value || \ ::boost::is_pointer< Lhs_noref >::value\ - >::value\ - >::value\ - >::value + )\ + )\ + ) #include <boost/type_traits/detail/has_binary_operator.hpp> diff --git a/boost/type_traits/has_divides_assign.hpp b/boost/type_traits/has_divides_assign.hpp index b21a05aff8..1a8e3c1e63 100644 --- a/boost/type_traits/has_divides_assign.hpp +++ b/boost/type_traits/has_divides_assign.hpp @@ -12,30 +12,30 @@ #define BOOST_TT_TRAIT_NAME has_divides_assign #define BOOST_TT_TRAIT_OP /= #define BOOST_TT_FORBIDDEN_IF\ - ::boost::type_traits::ice_or<\ + (\ /* Lhs==fundamental and Lhs==const and Rhs==fundamental */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ - ::boost::is_const< Lhs_noref >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ + ::boost::is_const< Lhs_noref >::value && \ ::boost::is_fundamental< Rhs_nocv >::value\ - >::value,\ + ) || \ /* Lhs==pointer and (Rhs==fundamental or Rhs==pointer) */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ - ::boost::type_traits::ice_or<\ - ::boost::is_fundamental< Rhs_nocv >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ + ( \ + ::boost::is_fundamental< Rhs_nocv >::value || \ ::boost::is_pointer< Rhs_noref >::value\ - >::value\ - >::value,\ + )\ + )||\ /* Rhs==pointer and (Lhs==fundamental or Lhs==pointer) */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Rhs_noref >::value,\ - ::boost::type_traits::ice_or<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ + (\ + ::boost::is_pointer< Rhs_noref >::value && \ + ( \ + ::boost::is_fundamental< Lhs_nocv >::value || \ ::boost::is_pointer< Lhs_noref >::value\ - >::value\ - >::value\ - >::value + )\ + )\ + ) #include <boost/type_traits/detail/has_binary_operator.hpp> diff --git a/boost/type_traits/has_equal_to.hpp b/boost/type_traits/has_equal_to.hpp index c2245c2d2f..d80a55d8e5 100644 --- a/boost/type_traits/has_equal_to.hpp +++ b/boost/type_traits/has_equal_to.hpp @@ -12,32 +12,32 @@ #define BOOST_TT_TRAIT_NAME has_equal_to #define BOOST_TT_TRAIT_OP == #define BOOST_TT_FORBIDDEN_IF\ - ::boost::type_traits::ice_or<\ + (\ /* Lhs==pointer and Rhs==fundamental */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ ::boost::is_fundamental< Rhs_nocv >::value\ - >::value,\ + ) || \ /* Rhs==pointer and Lhs==fundamental */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Rhs_noref >::value,\ + (\ + ::boost::is_pointer< Rhs_noref >::value && \ ::boost::is_fundamental< Lhs_nocv >::value\ - >::value,\ + ) || \ /* Lhs==pointer and Rhs==pointer and Lhs!=base(Rhs) and Rhs!=base(Lhs) and Lhs!=void* and Rhs!=void* */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ - ::boost::is_pointer< Rhs_noref >::value,\ - ::boost::type_traits::ice_not<\ - ::boost::type_traits::ice_or<\ - ::boost::is_base_of< Lhs_noptr, Rhs_noptr >::value,\ - ::boost::is_base_of< Rhs_noptr, Lhs_noptr >::value,\ - ::boost::is_same< Lhs_noptr, Rhs_noptr >::value,\ - ::boost::is_void< Lhs_noptr >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ + ::boost::is_pointer< Rhs_noref >::value && \ + (! \ + (\ + ::boost::is_base_of< Lhs_noptr, Rhs_noptr >::value || \ + ::boost::is_base_of< Rhs_noptr, Lhs_noptr >::value || \ + ::boost::is_same< Lhs_noptr, Rhs_noptr >::value || \ + ::boost::is_void< Lhs_noptr >::value || \ ::boost::is_void< Rhs_noptr >::value\ - >::value\ - >::value\ - >::value\ - >::value + )\ + )\ + )\ + ) #include <boost/type_traits/detail/has_binary_operator.hpp> diff --git a/boost/type_traits/has_greater.hpp b/boost/type_traits/has_greater.hpp index ce32658405..32e0a12404 100644 --- a/boost/type_traits/has_greater.hpp +++ b/boost/type_traits/has_greater.hpp @@ -12,32 +12,32 @@ #define BOOST_TT_TRAIT_NAME has_greater #define BOOST_TT_TRAIT_OP > #define BOOST_TT_FORBIDDEN_IF\ - ::boost::type_traits::ice_or<\ + (\ /* Lhs==pointer and Rhs==fundamental */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ ::boost::is_fundamental< Rhs_nocv >::value\ - >::value,\ + ) || \ /* Rhs==pointer and Lhs==fundamental */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Rhs_noref >::value,\ + (\ + ::boost::is_pointer< Rhs_noref >::value && \ ::boost::is_fundamental< Lhs_nocv >::value\ - >::value,\ + ) || \ /* Lhs==pointer and Rhs==pointer and Lhs!=base(Rhs) and Rhs!=base(Lhs) and Lhs!=void* and Rhs!=void* */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ - ::boost::is_pointer< Rhs_noref >::value,\ - ::boost::type_traits::ice_not<\ - ::boost::type_traits::ice_or<\ - ::boost::is_base_of< Lhs_noptr, Rhs_noptr >::value,\ - ::boost::is_base_of< Rhs_noptr, Lhs_noptr >::value,\ - ::boost::is_same< Lhs_noptr, Rhs_noptr >::value,\ - ::boost::is_void< Lhs_noptr >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ + ::boost::is_pointer< Rhs_noref >::value && \ + (! \ + ( \ + ::boost::is_base_of< Lhs_noptr, Rhs_noptr >::value || \ + ::boost::is_base_of< Rhs_noptr, Lhs_noptr >::value || \ + ::boost::is_same< Lhs_noptr, Rhs_noptr >::value || \ + ::boost::is_void< Lhs_noptr >::value || \ ::boost::is_void< Rhs_noptr >::value\ - >::value\ - >::value\ - >::value\ - >::value + )\ + )\ + )\ + ) #include <boost/type_traits/detail/has_binary_operator.hpp> diff --git a/boost/type_traits/has_greater_equal.hpp b/boost/type_traits/has_greater_equal.hpp index 681685a23d..a933a6beb8 100644 --- a/boost/type_traits/has_greater_equal.hpp +++ b/boost/type_traits/has_greater_equal.hpp @@ -12,32 +12,32 @@ #define BOOST_TT_TRAIT_NAME has_greater_equal #define BOOST_TT_TRAIT_OP >= #define BOOST_TT_FORBIDDEN_IF\ - ::boost::type_traits::ice_or<\ + (\ /* Lhs==pointer and Rhs==fundamental */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ ::boost::is_fundamental< Rhs_nocv >::value\ - >::value,\ + ) || \ /* Rhs==pointer and Lhs==fundamental */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Rhs_noref >::value,\ + (\ + ::boost::is_pointer< Rhs_noref >::value && \ ::boost::is_fundamental< Lhs_nocv >::value\ - >::value,\ + ) || \ /* Lhs==pointer and Rhs==pointer and Lhs!=base(Rhs) and Rhs!=base(Lhs) and Lhs!=void* and Rhs!=void* */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ - ::boost::is_pointer< Rhs_noref >::value,\ - ::boost::type_traits::ice_not<\ - ::boost::type_traits::ice_or<\ - ::boost::is_base_of< Lhs_noptr, Rhs_noptr >::value,\ - ::boost::is_base_of< Rhs_noptr, Lhs_noptr >::value,\ - ::boost::is_same< Lhs_noptr, Rhs_noptr >::value,\ - ::boost::is_void< Lhs_noptr >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ + ::boost::is_pointer< Rhs_noref >::value && \ + (! \ + ( \ + ::boost::is_base_of< Lhs_noptr, Rhs_noptr >::value || \ + ::boost::is_base_of< Rhs_noptr, Lhs_noptr >::value || \ + ::boost::is_same< Lhs_noptr, Rhs_noptr >::value || \ + ::boost::is_void< Lhs_noptr >::value || \ ::boost::is_void< Rhs_noptr >::value\ - >::value\ - >::value\ - >::value\ - >::value + )\ + )\ + )\ + ) #include <boost/type_traits/detail/has_binary_operator.hpp> diff --git a/boost/type_traits/has_left_shift.hpp b/boost/type_traits/has_left_shift.hpp index 88205d9939..e95c12a80a 100644 --- a/boost/type_traits/has_left_shift.hpp +++ b/boost/type_traits/has_left_shift.hpp @@ -12,32 +12,32 @@ #define BOOST_TT_TRAIT_NAME has_left_shift #define BOOST_TT_TRAIT_OP << #define BOOST_TT_FORBIDDEN_IF\ - ::boost::type_traits::ice_or<\ + (\ /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ - ::boost::is_fundamental< Rhs_nocv >::value,\ - ::boost::type_traits::ice_or<\ - ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ - ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ - >::value\ - >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ + ::boost::is_fundamental< Rhs_nocv >::value && \ + ( \ + (! ::boost::is_integral< Lhs_noref >::value ) || \ + (! ::boost::is_integral< Rhs_noref >::value )\ + )\ + )||\ /* Lhs==fundamental and Rhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ ::boost::is_pointer< Rhs_noref >::value\ - >::value,\ + )||\ /* Rhs==fundamental and Lhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Rhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Rhs_nocv >::value && \ ::boost::is_pointer< Lhs_noref >::value\ - >::value,\ + )||\ /* Lhs==pointer and Rhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ ::boost::is_pointer< Rhs_noref >::value\ - >::value\ - >::value + )\ + ) #include <boost/type_traits/detail/has_binary_operator.hpp> diff --git a/boost/type_traits/has_left_shift_assign.hpp b/boost/type_traits/has_left_shift_assign.hpp index 0b3b9b1f9b..74e0df9580 100644 --- a/boost/type_traits/has_left_shift_assign.hpp +++ b/boost/type_traits/has_left_shift_assign.hpp @@ -12,38 +12,38 @@ #define BOOST_TT_TRAIT_NAME has_left_shift_assign #define BOOST_TT_TRAIT_OP <<= #define BOOST_TT_FORBIDDEN_IF\ - ::boost::type_traits::ice_or<\ + (\ /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ - ::boost::is_fundamental< Rhs_nocv >::value,\ - ::boost::type_traits::ice_or<\ - ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ - ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ - >::value\ - >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ + ::boost::is_fundamental< Rhs_nocv >::value && \ + ( \ + (! ::boost::is_integral< Lhs_noref >::value ) || \ + (! ::boost::is_integral< Rhs_noref >::value )\ + )\ + )||\ /* Lhs==fundamental and Rhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ ::boost::is_pointer< Rhs_noref >::value\ - >::value,\ + )||\ /* Rhs==fundamental and Lhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Rhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Rhs_nocv >::value && \ ::boost::is_pointer< Lhs_noref >::value\ - >::value,\ + )||\ /* Lhs==pointer and Rhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ ::boost::is_pointer< Rhs_noref >::value\ - >::value,\ + )||\ /* Lhs==fundamental and Rhs==fundamental and Lhs==const */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ - ::boost::is_fundamental< Rhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ + ::boost::is_fundamental< Rhs_nocv >::value && \ ::boost::is_const< Lhs_noref >::value\ - >::value\ - >::value + )\ + ) #include <boost/type_traits/detail/has_binary_operator.hpp> diff --git a/boost/type_traits/has_less.hpp b/boost/type_traits/has_less.hpp index e1a045e592..0eefcd22dd 100644 --- a/boost/type_traits/has_less.hpp +++ b/boost/type_traits/has_less.hpp @@ -12,32 +12,32 @@ #define BOOST_TT_TRAIT_NAME has_less #define BOOST_TT_TRAIT_OP < #define BOOST_TT_FORBIDDEN_IF\ - ::boost::type_traits::ice_or<\ + (\ /* Lhs==pointer and Rhs==fundamental */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ ::boost::is_fundamental< Rhs_nocv >::value\ - >::value,\ + ) || \ /* Rhs==pointer and Lhs==fundamental */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Rhs_noref >::value,\ + (\ + ::boost::is_pointer< Rhs_noref >::value && \ ::boost::is_fundamental< Lhs_nocv >::value\ - >::value,\ + ) || \ /* Lhs==pointer and Rhs==pointer and Lhs!=base(Rhs) and Rhs!=base(Lhs) and Lhs!=void* and Rhs!=void* */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ - ::boost::is_pointer< Rhs_noref >::value,\ - ::boost::type_traits::ice_not<\ - ::boost::type_traits::ice_or<\ - ::boost::is_base_of< Lhs_noptr, Rhs_noptr >::value,\ - ::boost::is_base_of< Rhs_noptr, Lhs_noptr >::value,\ - ::boost::is_same< Lhs_noptr, Rhs_noptr >::value,\ - ::boost::is_void< Lhs_noptr >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ + ::boost::is_pointer< Rhs_noref >::value && \ + (! \ + ( \ + ::boost::is_base_of< Lhs_noptr, Rhs_noptr >::value || \ + ::boost::is_base_of< Rhs_noptr, Lhs_noptr >::value || \ + ::boost::is_same< Lhs_noptr, Rhs_noptr >::value || \ + ::boost::is_void< Lhs_noptr >::value || \ ::boost::is_void< Rhs_noptr >::value\ - >::value\ - >::value\ - >::value\ - >::value + )\ + )\ + )\ + ) #include <boost/type_traits/detail/has_binary_operator.hpp> diff --git a/boost/type_traits/has_less_equal.hpp b/boost/type_traits/has_less_equal.hpp index c633b8b81d..4725bbd421 100644 --- a/boost/type_traits/has_less_equal.hpp +++ b/boost/type_traits/has_less_equal.hpp @@ -12,32 +12,32 @@ #define BOOST_TT_TRAIT_NAME has_less_equal #define BOOST_TT_TRAIT_OP <= #define BOOST_TT_FORBIDDEN_IF\ - ::boost::type_traits::ice_or<\ + (\ /* Lhs==pointer and Rhs==fundamental */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ ::boost::is_fundamental< Rhs_nocv >::value\ - >::value,\ + ) || \ /* Rhs==pointer and Lhs==fundamental */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Rhs_noref >::value,\ + (\ + ::boost::is_pointer< Rhs_noref >::value && \ ::boost::is_fundamental< Lhs_nocv >::value\ - >::value,\ + ) || \ /* Lhs==pointer and Rhs==pointer and Lhs!=base(Rhs) and Rhs!=base(Lhs) and Lhs!=void* and Rhs!=void* */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ - ::boost::is_pointer< Rhs_noref >::value,\ - ::boost::type_traits::ice_not<\ - ::boost::type_traits::ice_or<\ - ::boost::is_base_of< Lhs_noptr, Rhs_noptr >::value,\ - ::boost::is_base_of< Rhs_noptr, Lhs_noptr >::value,\ - ::boost::is_same< Lhs_noptr, Rhs_noptr >::value,\ - ::boost::is_void< Lhs_noptr >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ + ::boost::is_pointer< Rhs_noref >::value && \ + (! \ + ( \ + ::boost::is_base_of< Lhs_noptr, Rhs_noptr >::value || \ + ::boost::is_base_of< Rhs_noptr, Lhs_noptr >::value || \ + ::boost::is_same< Lhs_noptr, Rhs_noptr >::value || \ + ::boost::is_void< Lhs_noptr >::value || \ ::boost::is_void< Rhs_noptr >::value\ - >::value\ - >::value\ - >::value\ - >::value + )\ + )\ + )\ + ) #include <boost/type_traits/detail/has_binary_operator.hpp> diff --git a/boost/type_traits/has_logical_and.hpp b/boost/type_traits/has_logical_and.hpp index 5bfa1c334d..3bb1733d54 100644 --- a/boost/type_traits/has_logical_and.hpp +++ b/boost/type_traits/has_logical_and.hpp @@ -13,22 +13,22 @@ #define BOOST_TT_TRAIT_OP && #define BOOST_TT_FORBIDDEN_IF\ /* pointer with fundamental non convertible to bool */\ - ::boost::type_traits::ice_or<\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Rhs_nocv >::value,\ - ::boost::type_traits::ice_not< ::boost::is_convertible< Rhs_nocv, bool >::value >::value\ - >::value\ - >::value,\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Rhs_noref >::value,\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ - ::boost::type_traits::ice_not< ::boost::is_convertible< Lhs_nocv, bool >::value >::value\ - >::value\ - >::value\ - >::value + (\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ + ( \ + ::boost::is_fundamental< Rhs_nocv >::value && \ + (! ::boost::is_convertible< Rhs_nocv, bool >::value )\ + )\ + )||\ + (\ + ::boost::is_pointer< Rhs_noref >::value && \ + ( \ + ::boost::is_fundamental< Lhs_nocv >::value && \ + (! ::boost::is_convertible< Lhs_nocv, bool >::value )\ + )\ + )\ + ) #include <boost/type_traits/detail/has_binary_operator.hpp> diff --git a/boost/type_traits/has_logical_or.hpp b/boost/type_traits/has_logical_or.hpp index a4ae6c5f47..a188726e15 100644 --- a/boost/type_traits/has_logical_or.hpp +++ b/boost/type_traits/has_logical_or.hpp @@ -13,22 +13,22 @@ #define BOOST_TT_TRAIT_OP || #define BOOST_TT_FORBIDDEN_IF\ /* pointer with fundamental non convertible to bool */\ - ::boost::type_traits::ice_or<\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Rhs_nocv >::value,\ - ::boost::type_traits::ice_not< ::boost::is_convertible< Rhs_nocv, bool >::value >::value\ - >::value\ - >::value,\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Rhs_noref >::value,\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ - ::boost::type_traits::ice_not< ::boost::is_convertible< Lhs_nocv, bool >::value >::value\ - >::value\ - >::value\ - >::value + (\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ + (\ + ::boost::is_fundamental< Rhs_nocv >::value && \ + (! ::boost::is_convertible< Rhs_nocv, bool >::value )\ + )\ + )||\ + (\ + ::boost::is_pointer< Rhs_noref >::value && \ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ + (! ::boost::is_convertible< Lhs_nocv, bool >::value )\ + )\ + )\ + ) #include <boost/type_traits/detail/has_binary_operator.hpp> diff --git a/boost/type_traits/has_minus.hpp b/boost/type_traits/has_minus.hpp index cc1d06b5c3..5e13c16014 100644 --- a/boost/type_traits/has_minus.hpp +++ b/boost/type_traits/has_minus.hpp @@ -12,43 +12,43 @@ #define BOOST_TT_TRAIT_NAME has_minus #define BOOST_TT_TRAIT_OP - #define BOOST_TT_FORBIDDEN_IF\ - ::boost::type_traits::ice_or<\ + (\ /* Lhs==pointer and Rhs==fundamental and Rhs!=integral */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ - ::boost::is_fundamental< Rhs_nocv >::value,\ - ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ - >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ + ::boost::is_fundamental< Rhs_nocv >::value && \ + (! ::boost::is_integral< Rhs_noref >::value )\ + ) || \ /* Lhs==void* and (Rhs==fundamental or Rhs==pointer) */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ - ::boost::is_void< Lhs_noptr >::value,\ - ::boost::type_traits::ice_or<\ - ::boost::is_fundamental< Rhs_nocv >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ + ::boost::is_void< Lhs_noptr >::value && \ + ( \ + ::boost::is_fundamental< Rhs_nocv >::value || \ ::boost::is_pointer< Rhs_noref >::value\ - >::value\ - >::value,\ + )\ + ) || \ /* Rhs==void* and (Lhs==fundamental or Lhs==pointer) */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Rhs_noref >::value,\ - ::boost::is_void< Rhs_noptr >::value,\ - ::boost::type_traits::ice_or<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ + (\ + ::boost::is_pointer< Rhs_noref >::value && \ + ::boost::is_void< Rhs_noptr >::value && \ + (\ + ::boost::is_fundamental< Lhs_nocv >::value || \ ::boost::is_pointer< Lhs_noref >::value\ - >::value\ - >::value,\ + )\ + ) ||\ /* Lhs=fundamental and Rhs=pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ ::boost::is_pointer< Rhs_noref >::value\ - >::value,\ + ) ||\ /* two different pointers */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ - ::boost::is_pointer< Rhs_noref >::value,\ - ::boost::type_traits::ice_not< ::boost::is_same< Lhs_nocv, Rhs_nocv >::value >::value\ - >::value\ - >::value + (\ + ::boost::is_pointer< Lhs_noref >::value && \ + ::boost::is_pointer< Rhs_noref >::value && \ + (! ::boost::is_same< Lhs_nocv, Rhs_nocv >::value )\ + )\ + ) #include <boost/type_traits/detail/has_binary_operator.hpp> diff --git a/boost/type_traits/has_minus_assign.hpp b/boost/type_traits/has_minus_assign.hpp index 84ba3594d6..b53474e756 100644 --- a/boost/type_traits/has_minus_assign.hpp +++ b/boost/type_traits/has_minus_assign.hpp @@ -12,48 +12,48 @@ #define BOOST_TT_TRAIT_NAME has_minus_assign #define BOOST_TT_TRAIT_OP -= #define BOOST_TT_FORBIDDEN_IF\ - ::boost::type_traits::ice_or<\ + (\ /* Lhs==pointer and Rhs==fundamental and Rhs!=integral */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ - ::boost::is_fundamental< Rhs_nocv >::value,\ - ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ - >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ + ::boost::is_fundamental< Rhs_nocv >::value && \ + (! ::boost::is_integral< Rhs_noref >::value )\ + ) || \ /* Lhs==void* and Rhs==fundamental */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ - ::boost::is_void< Lhs_noptr >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ + ::boost::is_void< Lhs_noptr >::value && \ ::boost::is_fundamental< Rhs_nocv >::value\ - >::value,\ + ) || \ /* Rhs==void* and Lhs==fundamental */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Rhs_noref >::value,\ - ::boost::is_void< Rhs_noptr >::value,\ + (\ + ::boost::is_pointer< Rhs_noref >::value && \ + ::boost::is_void< Rhs_noptr >::value && \ ::boost::is_fundamental< Lhs_nocv >::value\ - >::value,\ + ) || \ /* Lhs=fundamental and Rhs=pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ ::boost::is_pointer< Rhs_noref >::value\ - >::value,\ + ) || \ /* Lhs==pointer and Rhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ ::boost::is_pointer< Rhs_noref >::value\ - >::value,\ + ) || \ /* (Lhs==fundamental or Lhs==pointer) and (Rhs==fundamental or Rhs==pointer) and (Lhs==const) */\ - ::boost::type_traits::ice_and<\ - ::boost::type_traits::ice_or<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ + (\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value || \ ::boost::is_pointer< Lhs_noref >::value\ - >::value,\ - ::boost::type_traits::ice_or<\ - ::boost::is_fundamental< Rhs_nocv >::value,\ + ) && \ + (\ + ::boost::is_fundamental< Rhs_nocv >::value || \ ::boost::is_pointer< Rhs_noref >::value\ - >::value,\ + ) && \ ::boost::is_const< Lhs_noref >::value\ - >::value\ - >::value + )\ + ) #include <boost/type_traits/detail/has_binary_operator.hpp> diff --git a/boost/type_traits/has_modulus.hpp b/boost/type_traits/has_modulus.hpp index 6948728058..24a815f3df 100644 --- a/boost/type_traits/has_modulus.hpp +++ b/boost/type_traits/has_modulus.hpp @@ -12,32 +12,32 @@ #define BOOST_TT_TRAIT_NAME has_modulus #define BOOST_TT_TRAIT_OP % #define BOOST_TT_FORBIDDEN_IF\ - ::boost::type_traits::ice_or<\ + (\ /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ - ::boost::is_fundamental< Rhs_nocv >::value,\ - ::boost::type_traits::ice_or<\ - ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ - ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ - >::value\ - >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ + ::boost::is_fundamental< Rhs_nocv >::value && \ + (\ + (! ::boost::is_integral< Lhs_noref >::value ) || \ + (! ::boost::is_integral< Rhs_noref >::value )\ + )\ + )||\ /* Lhs==fundamental and Rhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ ::boost::is_pointer< Rhs_noref >::value\ - >::value,\ + )||\ /* Rhs==fundamental and Lhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Rhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Rhs_nocv >::value && \ ::boost::is_pointer< Lhs_noref >::value\ - >::value,\ + )||\ /* Lhs==pointer and Rhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ ::boost::is_pointer< Rhs_noref >::value\ - >::value\ - >::value + )\ + ) #include <boost/type_traits/detail/has_binary_operator.hpp> diff --git a/boost/type_traits/has_modulus_assign.hpp b/boost/type_traits/has_modulus_assign.hpp index f0531f0747..5e3e83fa07 100644 --- a/boost/type_traits/has_modulus_assign.hpp +++ b/boost/type_traits/has_modulus_assign.hpp @@ -12,38 +12,38 @@ #define BOOST_TT_TRAIT_NAME has_modulus_assign #define BOOST_TT_TRAIT_OP %= #define BOOST_TT_FORBIDDEN_IF\ - ::boost::type_traits::ice_or<\ + (\ /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ - ::boost::is_fundamental< Rhs_nocv >::value,\ - ::boost::type_traits::ice_or<\ - ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ - ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ - >::value\ - >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ + ::boost::is_fundamental< Rhs_nocv >::value && \ + ( \ + (! ::boost::is_integral< Lhs_noref >::value ) || \ + (! ::boost::is_integral< Rhs_noref >::value )\ + )\ + )||\ /* Lhs==fundamental and Rhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ ::boost::is_pointer< Rhs_noref >::value\ - >::value,\ + )||\ /* Rhs==fundamental and Lhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Rhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Rhs_nocv >::value && \ ::boost::is_pointer< Lhs_noref >::value\ - >::value,\ + )||\ /* Lhs==pointer and Rhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ ::boost::is_pointer< Rhs_noref >::value\ - >::value,\ + )||\ /* Lhs==fundamental and Rhs==fundamental and Lhs==const */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ - ::boost::is_fundamental< Rhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ + ::boost::is_fundamental< Rhs_nocv >::value && \ ::boost::is_const< Lhs_noref >::value\ - >::value\ - >::value + )\ + ) #include <boost/type_traits/detail/has_binary_operator.hpp> diff --git a/boost/type_traits/has_multiplies.hpp b/boost/type_traits/has_multiplies.hpp index 4b578c5d78..591a0ceae8 100644 --- a/boost/type_traits/has_multiplies.hpp +++ b/boost/type_traits/has_multiplies.hpp @@ -13,22 +13,22 @@ #define BOOST_TT_TRAIT_OP * #define BOOST_TT_FORBIDDEN_IF\ /* pointer with pointer or fundamental */\ - ::boost::type_traits::ice_or<\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ - ::boost::type_traits::ice_or<\ - ::boost::is_fundamental< Rhs_nocv >::value,\ + (\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ + (\ + ::boost::is_fundamental< Rhs_nocv >::value || \ ::boost::is_pointer< Rhs_noref >::value\ - >::value\ - >::value,\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Rhs_noref >::value,\ - ::boost::type_traits::ice_or<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ + )\ + )||\ + (\ + ::boost::is_pointer< Rhs_noref >::value && \ + (\ + ::boost::is_fundamental< Lhs_nocv >::value || \ ::boost::is_pointer< Lhs_noref >::value\ - >::value\ - >::value\ - >::value + )\ + )\ + ) #include <boost/type_traits/detail/has_binary_operator.hpp> diff --git a/boost/type_traits/has_multiplies_assign.hpp b/boost/type_traits/has_multiplies_assign.hpp index 1678b7bda5..b24f87944e 100644 --- a/boost/type_traits/has_multiplies_assign.hpp +++ b/boost/type_traits/has_multiplies_assign.hpp @@ -12,30 +12,30 @@ #define BOOST_TT_TRAIT_NAME has_multiplies_assign #define BOOST_TT_TRAIT_OP *= #define BOOST_TT_FORBIDDEN_IF\ - ::boost::type_traits::ice_or<\ + (\ /* Lhs==fundamental and Lhs==const and Rhs==fundamental */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ - ::boost::is_const< Lhs_noref >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ + ::boost::is_const< Lhs_noref >::value && \ ::boost::is_fundamental< Rhs_nocv >::value\ - >::value,\ + ) || \ /* Lhs==pointer and (Rhs==fundamental or Rhs==pointer) */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ - ::boost::type_traits::ice_or<\ - ::boost::is_fundamental< Rhs_nocv >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ + ( \ + ::boost::is_fundamental< Rhs_nocv >::value || \ ::boost::is_pointer< Rhs_noref >::value\ - >::value\ - >::value,\ + )\ + )||\ /* Rhs==pointer and (Lhs==fundamental or Lhs==pointer) */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Rhs_noref >::value,\ - ::boost::type_traits::ice_or<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ + (\ + ::boost::is_pointer< Rhs_noref >::value && \ + ( \ + ::boost::is_fundamental< Lhs_nocv >::value || \ ::boost::is_pointer< Lhs_noref >::value\ - >::value\ - >::value\ - >::value + )\ + )\ + ) #include <boost/type_traits/detail/has_binary_operator.hpp> diff --git a/boost/type_traits/has_new_operator.hpp b/boost/type_traits/has_new_operator.hpp index c615127da3..4def872ddf 100644 --- a/boost/type_traits/has_new_operator.hpp +++ b/boost/type_traits/has_new_operator.hpp @@ -11,12 +11,9 @@ #include <new> // std::nothrow_t #include <cstddef> // std::size_t -#include <boost/type_traits/config.hpp> +#include <boost/type_traits/integral_constant.hpp> #include <boost/type_traits/detail/yes_no_type.hpp> -#include <boost/type_traits/detail/ice_or.hpp> - -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#include <boost/detail/workaround.hpp> #if defined(new) # if BOOST_WORKAROUND(BOOST_MSVC, >= 1310) @@ -129,19 +126,17 @@ namespace detail { #endif #endif BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_or< - (s1 == sizeof(type_traits::yes_type)), - (s2 == sizeof(type_traits::yes_type)), - (s3 == sizeof(type_traits::yes_type)), - (s4 == sizeof(type_traits::yes_type)), - (s5 == sizeof(type_traits::yes_type)), + (s1 == sizeof(type_traits::yes_type)) || + (s2 == sizeof(type_traits::yes_type)) || + (s3 == sizeof(type_traits::yes_type)) || + (s4 == sizeof(type_traits::yes_type)) || + (s5 == sizeof(type_traits::yes_type)) || (s6 == sizeof(type_traits::yes_type)) - >::value) ); }; } // namespace detail -BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_new_operator,T,::boost::detail::has_new_operator_impl<T>::value) +template <class T> struct has_new_operator : public integral_constant<bool, ::boost::detail::has_new_operator_impl<T>::value>{}; } // namespace boost @@ -149,6 +144,4 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_new_operator,T,::boost::detail::has_new_operato # pragma pop_macro("new") #endif -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_HAS_NEW_OPERATOR_HPP_INCLUDED diff --git a/boost/type_traits/has_not_equal_to.hpp b/boost/type_traits/has_not_equal_to.hpp index e7e370013d..c2b6705e7c 100644 --- a/boost/type_traits/has_not_equal_to.hpp +++ b/boost/type_traits/has_not_equal_to.hpp @@ -12,32 +12,32 @@ #define BOOST_TT_TRAIT_NAME has_not_equal_to #define BOOST_TT_TRAIT_OP != #define BOOST_TT_FORBIDDEN_IF\ - ::boost::type_traits::ice_or<\ + (\ /* Lhs==pointer and Rhs==fundamental */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ ::boost::is_fundamental< Rhs_nocv >::value\ - >::value,\ + ) || \ /* Rhs==pointer and Lhs==fundamental */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Rhs_noref >::value,\ + (\ + ::boost::is_pointer< Rhs_noref >::value && \ ::boost::is_fundamental< Lhs_nocv >::value\ - >::value,\ + ) || \ /* Lhs==pointer and Rhs==pointer and Lhs!=base(Rhs) and Rhs!=base(Lhs) and Lhs!=void* and Rhs!=void* */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ - ::boost::is_pointer< Rhs_noref >::value,\ - ::boost::type_traits::ice_not<\ - ::boost::type_traits::ice_or<\ - ::boost::is_base_of< Lhs_noptr, Rhs_noptr >::value,\ - ::boost::is_base_of< Rhs_noptr, Lhs_noptr >::value,\ - ::boost::is_same< Lhs_noptr, Rhs_noptr >::value,\ - ::boost::is_void< Lhs_noptr >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ + ::boost::is_pointer< Rhs_noref >::value && \ + (! \ + (\ + ::boost::is_base_of< Lhs_noptr, Rhs_noptr >::value || \ + ::boost::is_base_of< Rhs_noptr, Lhs_noptr >::value || \ + ::boost::is_same< Lhs_noptr, Rhs_noptr >::value || \ + ::boost::is_void< Lhs_noptr >::value || \ ::boost::is_void< Rhs_noptr >::value\ - >::value\ - >::value\ - >::value\ - >::value + )\ + )\ + )\ + ) #include <boost/type_traits/detail/has_binary_operator.hpp> diff --git a/boost/type_traits/has_nothrow_assign.hpp b/boost/type_traits/has_nothrow_assign.hpp index 83e59687a0..a7312a19e9 100644 --- a/boost/type_traits/has_nothrow_assign.hpp +++ b/boost/type_traits/has_nothrow_assign.hpp @@ -9,36 +9,75 @@ #ifndef BOOST_TT_HAS_NOTHROW_ASSIGN_HPP_INCLUDED #define BOOST_TT_HAS_NOTHROW_ASSIGN_HPP_INCLUDED -#include <boost/type_traits/has_trivial_assign.hpp> +#include <boost/type_traits/integral_constant.hpp> +#include <boost/type_traits/intrinsics.hpp> -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#if !defined(BOOST_HAS_NOTHROW_ASSIGN) || defined(BOOST_MSVC) || defined(BOOST_INTEL) +#include <boost/type_traits/has_trivial_assign.hpp> +#if !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +#include <boost/type_traits/declval.hpp> +#include <boost/type_traits/is_const.hpp> +#include <boost/type_traits/is_volatile.hpp> +#include <boost/type_traits/is_reference.hpp> +#include <boost/type_traits/is_assignable.hpp> +#include <boost/type_traits/add_reference.hpp> +#include <boost/type_traits/remove_reference.hpp> +#endif +#endif +#if defined(__GNUC__) || defined(__SUNPRO_CC) +#include <boost/type_traits/is_const.hpp> +#include <boost/type_traits/is_volatile.hpp> +#include <boost/type_traits/is_assignable.hpp> +#include <boost/type_traits/is_array.hpp> +#ifdef BOOST_INTEL +#include <boost/type_traits/is_pod.hpp> +#endif +#endif namespace boost { -namespace detail{ +#if !defined(BOOST_HAS_NOTHROW_ASSIGN) && !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + + namespace detail + { + template <class T, bool b1, bool b2> struct has_nothrow_assign_imp{ static const bool value = false; }; + template <class T> struct has_nothrow_assign_imp<T, false, true>{ static const bool value = noexcept(boost::declval<typename add_reference<T>::type>() = boost::declval<typename add_reference<T const>::type>()); }; + template <class T, std::size_t N> struct has_nothrow_assign_imp<T[N], false, true>{ static const bool value = has_nothrow_assign_imp<T, false, true>::value; }; + template <class T> struct has_nothrow_assign_imp<T[], false, true>{ static const bool value = has_nothrow_assign_imp<T, false, true>::value; }; + } -template <class T> -struct has_nothrow_assign_imp{ +#endif + + template <class T> + struct has_nothrow_assign : public integral_constant < bool, #ifndef BOOST_HAS_NOTHROW_ASSIGN - BOOST_STATIC_CONSTANT(bool, value = ::boost::has_trivial_assign<T>::value); +#if !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + // Portable C++11 version: + detail::has_nothrow_assign_imp<T, + (is_const<typename remove_reference<T>::type>::value || is_volatile<typename remove_reference<T>::type>::value || is_reference<T>::value), + is_assignable<typename add_reference<T>::type, typename add_reference<const T>::type>::value + >::value #else - BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_NOTHROW_ASSIGN(T)); + ::boost::has_trivial_assign<T>::value #endif -}; - -} +#else + BOOST_HAS_NOTHROW_ASSIGN(T) +#endif + > {}; -BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_assign,T,::boost::detail::has_nothrow_assign_imp<T>::value) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_assign,void,false) +template <class T, std::size_t N> struct has_nothrow_assign <T[N]> : public has_nothrow_assign<T> {}; +template <> struct has_nothrow_assign<void> : public false_type{}; +template <class T> struct has_nothrow_assign<T volatile> : public false_type{}; +template <class T> struct has_nothrow_assign<T&> : public false_type{}; +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +template <class T> struct has_nothrow_assign<T&&> : public false_type{}; +#endif #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_assign,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_assign,void const volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_assign,void volatile,false) +template <> struct has_nothrow_assign<void const> : public false_type{}; +template <> struct has_nothrow_assign<void const volatile> : public false_type{}; +template <> struct has_nothrow_assign<void volatile> : public false_type{}; #endif } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_HAS_NOTHROW_ASSIGN_HPP_INCLUDED diff --git a/boost/type_traits/has_nothrow_constructor.hpp b/boost/type_traits/has_nothrow_constructor.hpp index 3bc4f802c2..e5af89fe59 100644 --- a/boost/type_traits/has_nothrow_constructor.hpp +++ b/boost/type_traits/has_nothrow_constructor.hpp @@ -9,45 +9,64 @@ #ifndef BOOST_TT_HAS_NOTHROW_CONSTRUCTOR_HPP_INCLUDED #define BOOST_TT_HAS_NOTHROW_CONSTRUCTOR_HPP_INCLUDED -#include <boost/type_traits/has_trivial_constructor.hpp> +#include <boost/type_traits/intrinsics.hpp> +#include <boost/type_traits/integral_constant.hpp> + +#ifdef BOOST_HAS_NOTHROW_CONSTRUCTOR -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#if defined(BOOST_MSVC) || defined(BOOST_INTEL) +#include <boost/type_traits/has_trivial_constructor.hpp> +#endif +#if defined(__GNUC__ ) || defined(__SUNPRO_CC) +#include <boost/type_traits/is_default_constructible.hpp> +#endif namespace boost { -namespace detail{ +template <class T> struct has_nothrow_constructor : public integral_constant<bool, BOOST_HAS_NOTHROW_CONSTRUCTOR(T)>{}; -template <class T> -struct has_nothrow_constructor_imp{ -#ifdef BOOST_HAS_NOTHROW_CONSTRUCTOR - BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_NOTHROW_CONSTRUCTOR(T)); -#else - BOOST_STATIC_CONSTANT(bool, value = ::boost::has_trivial_constructor<T>::value); +#elif !defined(BOOST_NO_CXX11_NOEXCEPT) + +#include <boost/type_traits/is_default_constructible.hpp> +#include <boost/type_traits/remove_all_extents.hpp> + +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4197) // top-level volatile in cast is ignored #endif -}; +namespace boost { namespace detail{ + + template <class T, bool b> struct has_nothrow_constructor_imp : public boost::integral_constant<bool, false>{}; + template <class T> struct has_nothrow_constructor_imp<T, true> : public boost::integral_constant<bool, noexcept(T())>{}; + template <class T, std::size_t N> struct has_nothrow_constructor_imp<T[N], true> : public has_nothrow_constructor_imp<T, true> {}; } -BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_constructor,T,::boost::detail::has_nothrow_constructor_imp<T>::value) -BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_default_constructor,T,::boost::detail::has_nothrow_constructor_imp<T>::value) +template <class T> struct has_nothrow_constructor : public detail::has_nothrow_constructor_imp<T, is_default_constructible<T>::value>{}; -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_constructor,void,false) -#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_constructor,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_constructor,void const volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_constructor,void volatile,false) +#ifdef BOOST_MSVC +#pragma warning(pop) #endif -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_default_constructor,void,false) +#else + +#include <boost/type_traits/has_trivial_constructor.hpp> + +namespace boost { + +template <class T> struct has_nothrow_constructor : public ::boost::has_trivial_constructor<T> {}; + +#endif + +template<> struct has_nothrow_constructor<void> : public false_type {}; #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_default_constructor,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_default_constructor,void const volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_default_constructor,void volatile,false) +template<> struct has_nothrow_constructor<void const> : public false_type{}; +template<> struct has_nothrow_constructor<void const volatile> : public false_type{}; +template<> struct has_nothrow_constructor<void volatile> : public false_type{}; #endif -} // namespace boost +template <class T> struct has_nothrow_default_constructor : public has_nothrow_constructor<T>{}; -#include <boost/type_traits/detail/bool_trait_undef.hpp> +} // namespace boost #endif // BOOST_TT_HAS_NOTHROW_CONSTRUCTOR_HPP_INCLUDED diff --git a/boost/type_traits/has_nothrow_copy.hpp b/boost/type_traits/has_nothrow_copy.hpp index 9c3c9030a4..0d9bb18379 100644 --- a/boost/type_traits/has_nothrow_copy.hpp +++ b/boost/type_traits/has_nothrow_copy.hpp @@ -9,45 +9,74 @@ #ifndef BOOST_TT_HAS_NOTHROW_COPY_HPP_INCLUDED #define BOOST_TT_HAS_NOTHROW_COPY_HPP_INCLUDED -#include <boost/type_traits/has_trivial_copy.hpp> +#include <boost/type_traits/intrinsics.hpp> +#include <boost/type_traits/integral_constant.hpp> + +#ifdef BOOST_HAS_NOTHROW_COPY -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#if defined(BOOST_CLANG) || defined(__GNUC__) || defined(__ghs__) || defined(__CODEGEARC__) || defined(__SUNPRO_CC) +#include <boost/type_traits/is_volatile.hpp> +#include <boost/type_traits/is_copy_constructible.hpp> +#include <boost/type_traits/is_reference.hpp> +#include <boost/type_traits/is_array.hpp> +#ifdef BOOST_INTEL +#include <boost/type_traits/is_pod.hpp> +#endif +#elif defined(BOOST_MSVC) || defined(BOOST_INTEL) +#include <boost/type_traits/has_trivial_copy.hpp> +#include <boost/type_traits/is_array.hpp> +#ifdef BOOST_INTEL +#include <boost/type_traits/add_lvalue_reference.hpp> +#include <boost/type_traits/add_const.hpp> +#endif +#endif namespace boost { +template <class T> struct has_nothrow_copy_constructor : public integral_constant<bool, BOOST_HAS_NOTHROW_COPY(T)>{}; + +#elif !defined(BOOST_NO_CXX11_NOEXCEPT) + +#include <boost/type_traits/declval.hpp> +#include <boost/type_traits/is_copy_constructible.hpp> + +namespace boost{ + namespace detail{ +template <class T, bool b> +struct has_nothrow_copy_constructor_imp : public boost::integral_constant<bool, false>{}; template <class T> -struct has_nothrow_copy_imp{ -#ifdef BOOST_HAS_NOTHROW_COPY - BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_NOTHROW_COPY(T)); -#else - BOOST_STATIC_CONSTANT(bool, value = ::boost::has_trivial_copy<T>::value); -#endif -}; +struct has_nothrow_copy_constructor_imp<T, true> : public boost::integral_constant<bool, noexcept(T(boost::declval<const T&>()))>{}; } -BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_copy,T,::boost::detail::has_nothrow_copy_imp<T>::value) -BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_copy_constructor,T,::boost::detail::has_nothrow_copy_imp<T>::value) +template <class T> struct has_nothrow_copy_constructor : public detail::has_nothrow_copy_constructor_imp<T, boost::is_copy_constructible<T>::value>{}; + +#else + +#include <boost/type_traits/has_trivial_copy.hpp> + +namespace boost{ + +template <class T> struct has_nothrow_copy_constructor : public integral_constant<bool, ::boost::has_trivial_copy<T>::value>{}; -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy,void,false) -#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy,void const volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy,void volatile,false) #endif -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy_constructor,void,false) +template <> struct has_nothrow_copy_constructor<void> : public false_type{}; +template <class T> struct has_nothrow_copy_constructor<T volatile> : public false_type{}; +template <class T> struct has_nothrow_copy_constructor<T&> : public false_type{}; +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +template <class T> struct has_nothrow_copy_constructor<T&&> : public false_type{}; +#endif #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy_constructor,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy_constructor,void const volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy_constructor,void volatile,false) +template <> struct has_nothrow_copy_constructor<void const> : public false_type{}; +template <> struct has_nothrow_copy_constructor<void volatile> : public false_type{}; +template <> struct has_nothrow_copy_constructor<void const volatile> : public false_type{}; #endif -} // namespace boost +template <class T> struct has_nothrow_copy : public has_nothrow_copy_constructor<T>{}; -#include <boost/type_traits/detail/bool_trait_undef.hpp> +} // namespace boost #endif // BOOST_TT_HAS_NOTHROW_COPY_HPP_INCLUDED diff --git a/boost/type_traits/has_nothrow_destructor.hpp b/boost/type_traits/has_nothrow_destructor.hpp index 4f5882afc0..273eb9f198 100644 --- a/boost/type_traits/has_nothrow_destructor.hpp +++ b/boost/type_traits/has_nothrow_destructor.hpp @@ -11,15 +11,37 @@ #include <boost/type_traits/has_trivial_destructor.hpp> -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#if !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(__SUNPRO_CC) && !defined(BOOST_MSVC) + +#include <boost/type_traits/declval.hpp> +#include <boost/type_traits/is_destructible.hpp> + +namespace boost{ + + namespace detail{ + + template <class T, bool b> + struct has_nothrow_destructor_imp : public boost::integral_constant<bool, false>{}; + template <class T> + struct has_nothrow_destructor_imp<T, true> : public boost::integral_constant<bool, noexcept(boost::declval<T*&>()->~T())>{}; + + } + + template <class T> struct has_nothrow_destructor : public detail::has_nothrow_destructor_imp<T, boost::is_destructible<T>::value>{}; + template <class T, std::size_t N> struct has_nothrow_destructor<T[N]> : public has_nothrow_destructor<T>{}; + template <class T> struct has_nothrow_destructor<T&> : public integral_constant<bool, false>{}; +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + template <class T> struct has_nothrow_destructor<T&&> : public integral_constant<bool, false>{}; +#endif +} +#else namespace boost { -BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_destructor,T,::boost::has_trivial_destructor<T>::value) +template <class T> struct has_nothrow_destructor : public ::boost::has_trivial_destructor<T> {}; } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> +#endif #endif // BOOST_TT_HAS_NOTHROW_DESTRUCTOR_HPP_INCLUDED diff --git a/boost/type_traits/has_plus.hpp b/boost/type_traits/has_plus.hpp index 70c12008f4..2d7932884d 100644 --- a/boost/type_traits/has_plus.hpp +++ b/boost/type_traits/has_plus.hpp @@ -12,37 +12,37 @@ #define BOOST_TT_TRAIT_NAME has_plus #define BOOST_TT_TRAIT_OP + #define BOOST_TT_FORBIDDEN_IF\ - ::boost::type_traits::ice_or<\ + (\ /* Lhs==pointer and Rhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ ::boost::is_pointer< Rhs_noref >::value\ - >::value,\ + ) || \ /* Lhs==void* and Rhs==fundamental */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ - ::boost::is_void< Lhs_noptr >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ + ::boost::is_void< Lhs_noptr >::value && \ ::boost::is_fundamental< Rhs_nocv >::value\ - >::value,\ + ) || \ /* Rhs==void* and Lhs==fundamental */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Rhs_noref >::value,\ - ::boost::is_void< Rhs_noptr >::value,\ + (\ + ::boost::is_pointer< Rhs_noref >::value && \ + ::boost::is_void< Rhs_noptr >::value && \ ::boost::is_fundamental< Lhs_nocv >::value\ - >::value,\ + ) || \ /* Lhs==pointer and Rhs==fundamental and Rhs!=integral */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ - ::boost::is_fundamental< Rhs_nocv >::value,\ - ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ - >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ + ::boost::is_fundamental< Rhs_nocv >::value && \ + (! ::boost::is_integral< Rhs_noref >::value )\ + ) || \ /* Rhs==pointer and Lhs==fundamental and Lhs!=integral */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Rhs_noref >::value,\ - ::boost::is_fundamental< Lhs_nocv >::value,\ - ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value\ - >::value\ - >::value + (\ + ::boost::is_pointer< Rhs_noref >::value && \ + ::boost::is_fundamental< Lhs_nocv >::value && \ + (! ::boost::is_integral< Lhs_noref >::value )\ + )\ + ) #include <boost/type_traits/detail/has_binary_operator.hpp> diff --git a/boost/type_traits/has_plus_assign.hpp b/boost/type_traits/has_plus_assign.hpp index 6d65204dcf..5ef6f23289 100644 --- a/boost/type_traits/has_plus_assign.hpp +++ b/boost/type_traits/has_plus_assign.hpp @@ -12,49 +12,49 @@ #define BOOST_TT_TRAIT_NAME has_plus_assign #define BOOST_TT_TRAIT_OP += #define BOOST_TT_FORBIDDEN_IF\ - ::boost::type_traits::ice_or<\ + (\ /* Lhs==pointer and Rhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ ::boost::is_pointer< Rhs_noref >::value\ - >::value,\ + ) || \ /* Lhs==void* and Rhs==fundamental */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ - ::boost::is_void< Lhs_noptr >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ + ::boost::is_void< Lhs_noptr >::value && \ ::boost::is_fundamental< Rhs_nocv >::value\ - >::value,\ + ) || \ /* Rhs==void* and Lhs==fundamental */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Rhs_noref >::value,\ - ::boost::is_void< Rhs_noptr >::value,\ + (\ + ::boost::is_pointer< Rhs_noref >::value && \ + ::boost::is_void< Rhs_noptr >::value && \ ::boost::is_fundamental< Lhs_nocv >::value\ - >::value,\ + ) || \ /* Lhs==pointer and Rhs==fundamental and Rhs!=integral */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ - ::boost::is_fundamental< Rhs_nocv >::value,\ - ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ - >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ + ::boost::is_fundamental< Rhs_nocv >::value && \ + (! ::boost::is_integral< Rhs_noref >::value )\ + ) || \ /* Rhs==pointer and Lhs==fundamental and Lhs!=bool */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Rhs_noref >::value,\ - ::boost::is_fundamental< Lhs_nocv >::value,\ - ::boost::type_traits::ice_not< ::boost::is_same< Lhs_nocv, bool >::value >::value\ - >::value,\ + (\ + ::boost::is_pointer< Rhs_noref >::value && \ + ::boost::is_fundamental< Lhs_nocv >::value && \ + (! ::boost::is_same< Lhs_nocv, bool >::value )\ + ) || \ /* (Lhs==fundamental or Lhs==pointer) and (Rhs==fundamental or Rhs==pointer) and (Lhs==const) */\ - ::boost::type_traits::ice_and<\ - ::boost::type_traits::ice_or<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ + (\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value || \ ::boost::is_pointer< Lhs_noref >::value\ - >::value,\ - ::boost::type_traits::ice_or<\ - ::boost::is_fundamental< Rhs_nocv >::value,\ + ) && \ + ( \ + ::boost::is_fundamental< Rhs_nocv >::value || \ ::boost::is_pointer< Rhs_noref >::value\ - >::value,\ + ) && \ ::boost::is_const< Lhs_noref >::value\ - >::value\ - >::value + )\ + ) #include <boost/type_traits/detail/has_binary_operator.hpp> diff --git a/boost/type_traits/has_post_decrement.hpp b/boost/type_traits/has_post_decrement.hpp index 024acb06e2..e3f98fff1c 100644 --- a/boost/type_traits/has_post_decrement.hpp +++ b/boost/type_traits/has_post_decrement.hpp @@ -14,25 +14,25 @@ #define BOOST_TT_TRAIT_NAME has_post_decrement #define BOOST_TT_TRAIT_OP -- #define BOOST_TT_FORBIDDEN_IF\ - ::boost::type_traits::ice_or<\ + (\ /* bool */\ - ::boost::is_same< bool, Lhs_nocv >::value,\ + ::boost::is_same< bool, Lhs_nocv >::value || \ /* void* */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ ::boost::is_void< Lhs_noptr >::value\ - >::value,\ + ) || \ /* (fundamental or pointer) and const */\ - ::boost::type_traits::ice_and<\ - ::boost::type_traits::ice_or<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ + (\ + ( \ + ::boost::is_fundamental< Lhs_nocv >::value || \ ::boost::is_pointer< Lhs_noref >::value\ - >::value,\ + ) && \ ::boost::is_const< Lhs_noref >::value\ - >::value,\ + )||\ /* Arrays */ \ ::boost::is_array<Lhs_noref>::value\ - >::value + ) #include <boost/type_traits/detail/has_postfix_operator.hpp> diff --git a/boost/type_traits/has_post_increment.hpp b/boost/type_traits/has_post_increment.hpp index b055607d52..3861a2bbde 100644 --- a/boost/type_traits/has_post_increment.hpp +++ b/boost/type_traits/has_post_increment.hpp @@ -14,25 +14,25 @@ #define BOOST_TT_TRAIT_NAME has_post_increment #define BOOST_TT_TRAIT_OP ++ #define BOOST_TT_FORBIDDEN_IF\ - ::boost::type_traits::ice_or<\ + (\ /* bool */\ - ::boost::is_same< bool, Lhs_nocv >::value,\ + ::boost::is_same< bool, Lhs_nocv >::value || \ /* void* */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ ::boost::is_void< Lhs_noptr >::value\ - >::value,\ + ) || \ /* (fundamental or pointer) and const */\ - ::boost::type_traits::ice_and<\ - ::boost::type_traits::ice_or<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ + (\ + ( \ + ::boost::is_fundamental< Lhs_nocv >::value || \ ::boost::is_pointer< Lhs_noref >::value\ - >::value,\ + ) && \ ::boost::is_const< Lhs_noref >::value\ - >::value,\ + )||\ /* Arrays */ \ ::boost::is_array<Lhs_noref>::value\ - >::value + ) #include <boost/type_traits/detail/has_postfix_operator.hpp> diff --git a/boost/type_traits/has_pre_decrement.hpp b/boost/type_traits/has_pre_decrement.hpp index feb3d9d2e6..7ef078329b 100644 --- a/boost/type_traits/has_pre_decrement.hpp +++ b/boost/type_traits/has_pre_decrement.hpp @@ -14,25 +14,25 @@ #define BOOST_TT_TRAIT_NAME has_pre_decrement #define BOOST_TT_TRAIT_OP -- #define BOOST_TT_FORBIDDEN_IF\ - ::boost::type_traits::ice_or<\ + (\ /* bool */\ - ::boost::is_same< bool, Rhs_nocv >::value,\ + ::boost::is_same< bool, Rhs_nocv >::value || \ /* void* */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Rhs_noref >::value,\ + (\ + ::boost::is_pointer< Rhs_noref >::value && \ ::boost::is_void< Rhs_noptr >::value\ - >::value,\ + ) || \ /* (fundamental or pointer) and const */\ - ::boost::type_traits::ice_and<\ - ::boost::type_traits::ice_or<\ - ::boost::is_fundamental< Rhs_nocv >::value,\ + (\ + ( \ + ::boost::is_fundamental< Rhs_nocv >::value || \ ::boost::is_pointer< Rhs_noref >::value\ - >::value,\ + ) && \ ::boost::is_const< Rhs_noref >::value\ - >::value,\ + )||\ /* Arrays */ \ ::boost::is_array<Rhs_noref>::value\ - >::value + ) #include <boost/type_traits/detail/has_prefix_operator.hpp> diff --git a/boost/type_traits/has_pre_increment.hpp b/boost/type_traits/has_pre_increment.hpp index 6a2411de69..c4c973487c 100644 --- a/boost/type_traits/has_pre_increment.hpp +++ b/boost/type_traits/has_pre_increment.hpp @@ -14,25 +14,25 @@ #define BOOST_TT_TRAIT_NAME has_pre_increment #define BOOST_TT_TRAIT_OP ++ #define BOOST_TT_FORBIDDEN_IF\ - ::boost::type_traits::ice_or<\ + (\ /* bool */\ - ::boost::is_same< bool, Rhs_nocv >::value,\ + ::boost::is_same< bool, Rhs_nocv >::value || \ /* void* */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Rhs_noref >::value,\ + (\ + ::boost::is_pointer< Rhs_noref >::value && \ ::boost::is_void< Rhs_noptr >::value\ - >::value,\ + ) || \ /* (fundamental or pointer) and const */\ - ::boost::type_traits::ice_and<\ - ::boost::type_traits::ice_or<\ - ::boost::is_fundamental< Rhs_nocv >::value,\ + (\ + ( \ + ::boost::is_fundamental< Rhs_nocv >::value || \ ::boost::is_pointer< Rhs_noref >::value\ - >::value,\ + ) && \ ::boost::is_const< Rhs_noref >::value\ - >::value,\ + )||\ /* Arrays */ \ ::boost::is_array<Rhs_noref>::value\ - >::value + ) #include <boost/type_traits/detail/has_prefix_operator.hpp> diff --git a/boost/type_traits/has_right_shift.hpp b/boost/type_traits/has_right_shift.hpp index 5735870159..5562911233 100644 --- a/boost/type_traits/has_right_shift.hpp +++ b/boost/type_traits/has_right_shift.hpp @@ -12,32 +12,32 @@ #define BOOST_TT_TRAIT_NAME has_right_shift #define BOOST_TT_TRAIT_OP >> #define BOOST_TT_FORBIDDEN_IF\ - ::boost::type_traits::ice_or<\ + (\ /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ - ::boost::is_fundamental< Rhs_nocv >::value,\ - ::boost::type_traits::ice_or<\ - ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ - ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ - >::value\ - >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ + ::boost::is_fundamental< Rhs_nocv >::value && \ + ( \ + (! ::boost::is_integral< Lhs_noref >::value ) || \ + (! ::boost::is_integral< Rhs_noref >::value )\ + )\ + )||\ /* Lhs==fundamental and Rhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ ::boost::is_pointer< Rhs_noref >::value\ - >::value,\ + )||\ /* Rhs==fundamental and Lhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Rhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Rhs_nocv >::value && \ ::boost::is_pointer< Lhs_noref >::value\ - >::value,\ + )||\ /* Lhs==pointer and Rhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ ::boost::is_pointer< Rhs_noref >::value\ - >::value\ - >::value + )\ + ) #include <boost/type_traits/detail/has_binary_operator.hpp> diff --git a/boost/type_traits/has_right_shift_assign.hpp b/boost/type_traits/has_right_shift_assign.hpp index 0536e71b6a..0e2c263559 100644 --- a/boost/type_traits/has_right_shift_assign.hpp +++ b/boost/type_traits/has_right_shift_assign.hpp @@ -12,38 +12,38 @@ #define BOOST_TT_TRAIT_NAME has_right_shift_assign #define BOOST_TT_TRAIT_OP >>= #define BOOST_TT_FORBIDDEN_IF\ - ::boost::type_traits::ice_or<\ + (\ /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ - ::boost::is_fundamental< Rhs_nocv >::value,\ - ::boost::type_traits::ice_or<\ - ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ - ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ - >::value\ - >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ + ::boost::is_fundamental< Rhs_nocv >::value && \ + ( \ + (! ::boost::is_integral< Lhs_noref >::value ) || \ + (! ::boost::is_integral< Rhs_noref >::value )\ + )\ + )||\ /* Lhs==fundamental and Rhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ ::boost::is_pointer< Rhs_noref >::value\ - >::value,\ + )||\ /* Rhs==fundamental and Lhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Rhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Rhs_nocv >::value && \ ::boost::is_pointer< Lhs_noref >::value\ - >::value,\ + )||\ /* Lhs==pointer and Rhs==pointer */\ - ::boost::type_traits::ice_and<\ - ::boost::is_pointer< Lhs_noref >::value,\ + (\ + ::boost::is_pointer< Lhs_noref >::value && \ ::boost::is_pointer< Rhs_noref >::value\ - >::value,\ + )||\ /* Lhs==fundamental and Rhs==fundamental and Lhs==const */\ - ::boost::type_traits::ice_and<\ - ::boost::is_fundamental< Lhs_nocv >::value,\ - ::boost::is_fundamental< Rhs_nocv >::value,\ + (\ + ::boost::is_fundamental< Lhs_nocv >::value && \ + ::boost::is_fundamental< Rhs_nocv >::value && \ ::boost::is_const< Lhs_noref >::value\ - >::value\ - >::value + )\ + ) #include <boost/type_traits/detail/has_binary_operator.hpp> diff --git a/boost/type_traits/has_trivial_assign.hpp b/boost/type_traits/has_trivial_assign.hpp index 404b62c70d..a5e625d1ae 100644 --- a/boost/type_traits/has_trivial_assign.hpp +++ b/boost/type_traits/has_trivial_assign.hpp @@ -9,49 +9,43 @@ #ifndef BOOST_TT_HAS_TRIVIAL_ASSIGN_HPP_INCLUDED #define BOOST_TT_HAS_TRIVIAL_ASSIGN_HPP_INCLUDED -#include <boost/type_traits/config.hpp> +#include <boost/type_traits/detail/config.hpp> #include <boost/type_traits/intrinsics.hpp> +#include <boost/type_traits/integral_constant.hpp> + +#if !defined(BOOST_HAS_TRIVIAL_ASSIGN) || defined(BOOST_MSVC) || defined(__GNUC__) || defined(BOOST_INTEL) || defined(__SUNPRO_CC) || defined(__clang) #include <boost/type_traits/is_pod.hpp> #include <boost/type_traits/is_const.hpp> #include <boost/type_traits/is_volatile.hpp> -#include <boost/type_traits/detail/ice_and.hpp> -#include <boost/type_traits/detail/ice_or.hpp> -#include <boost/type_traits/detail/ice_not.hpp> - -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#include <boost/type_traits/is_assignable.hpp> +#endif namespace boost { -namespace detail { - -template <typename T> -struct has_trivial_assign_impl -{ + template <typename T> + struct has_trivial_assign : public integral_constant < bool, #ifdef BOOST_HAS_TRIVIAL_ASSIGN - BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_TRIVIAL_ASSIGN(T)); + BOOST_HAS_TRIVIAL_ASSIGN(T) #else - BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_and< - ::boost::is_pod<T>::value, - ::boost::type_traits::ice_not< ::boost::is_const<T>::value >::value, - ::boost::type_traits::ice_not< ::boost::is_volatile<T>::value >::value - >::value)); + ::boost::is_pod<T>::value && !::boost::is_const<T>::value && !::boost::is_volatile<T>::value #endif -}; + > {}; -} // namespace detail - -BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_assign,T,::boost::detail::has_trivial_assign_impl<T>::value) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_assign,void,false) + template<> struct has_trivial_assign<void> : public false_type{}; #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_assign,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_assign,void const volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_assign,void volatile,false) + template<> struct has_trivial_assign<void const> : public false_type{}; + template<> struct has_trivial_assign<void const volatile> : public false_type{}; + template<> struct has_trivial_assign<void volatile> : public false_type{}; +#endif + template <class T> struct has_trivial_assign<T volatile> : public false_type{}; + template <class T> struct has_trivial_assign<T&> : public false_type{}; +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + template <class T> struct has_trivial_assign<T&&> : public false_type{}; #endif + // Arrays are not explictly assignable: + template <typename T, std::size_t N> struct has_trivial_assign<T[N]> : public false_type{}; + template <typename T> struct has_trivial_assign<T[]> : public false_type{}; } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_HAS_TRIVIAL_ASSIGN_HPP_INCLUDED diff --git a/boost/type_traits/has_trivial_constructor.hpp b/boost/type_traits/has_trivial_constructor.hpp index 30dbdd8f93..06c137d1de 100644 --- a/boost/type_traits/has_trivial_constructor.hpp +++ b/boost/type_traits/has_trivial_constructor.hpp @@ -9,43 +9,49 @@ #ifndef BOOST_TT_HAS_TRIVIAL_CONSTRUCTOR_HPP_INCLUDED #define BOOST_TT_HAS_TRIVIAL_CONSTRUCTOR_HPP_INCLUDED -#include <boost/type_traits/config.hpp> #include <boost/type_traits/intrinsics.hpp> #include <boost/type_traits/is_pod.hpp> -#include <boost/type_traits/detail/ice_or.hpp> +#include <boost/type_traits/is_default_constructible.hpp> -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#ifdef BOOST_HAS_TRIVIAL_CONSTRUCTOR +#ifdef BOOST_HAS_SGI_TYPE_TRAITS +#include <boost/type_traits/is_same.hpp> +#elif defined(__GNUC__) || defined(__SUNPRO_CC) +#include <boost/type_traits/is_volatile.hpp> +#ifdef BOOST_INTEL +#include <boost/type_traits/is_pod.hpp> +#endif +#endif +#endif -namespace boost { -namespace detail { +#if (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 409)) || defined(BOOST_CLANG) || (defined(__SUNPRO_CC) && defined(BOOST_HAS_TRIVIAL_CONSTRUCTOR)) +#include <boost/type_traits/is_default_constructible.hpp> +#define BOOST_TT_TRIVIAL_CONSTRUCT_FIX && is_default_constructible<T>::value +#else +// +// Mot all compilers, particularly older GCC versions can handle the fix above. +#define BOOST_TT_TRIVIAL_CONSTRUCT_FIX +#endif + +namespace boost { -template <typename T> -struct has_trivial_ctor_impl -{ +template <typename T> struct has_trivial_constructor #ifdef BOOST_HAS_TRIVIAL_CONSTRUCTOR - BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_or< - ::boost::is_pod<T>::value, - BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) - >::value)); + : public integral_constant <bool, ((::boost::is_pod<T>::value || BOOST_HAS_TRIVIAL_CONSTRUCTOR(T)) BOOST_TT_TRIVIAL_CONSTRUCT_FIX)>{}; #else - BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_or< - ::boost::is_pod<T>::value, - false - >::value)); + : public integral_constant <bool, ::boost::is_pod<T>::value>{}; #endif -}; -} // namespace detail +template <> struct has_trivial_constructor<void> : public boost::false_type{}; +template <> struct has_trivial_constructor<void const> : public boost::false_type{}; +template <> struct has_trivial_constructor<void const volatile> : public boost::false_type{}; +template <> struct has_trivial_constructor<void volatile> : public boost::false_type{}; -BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_constructor,T,::boost::detail::has_trivial_ctor_impl<T>::value) -BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_default_constructor,T,::boost::detail::has_trivial_ctor_impl<T>::value) +template <class T> struct has_trivial_default_constructor : public has_trivial_constructor<T> {}; -} // namespace boost +#undef BOOST_TT_TRIVIAL_CONSTRUCT_FIX -#include <boost/type_traits/detail/bool_trait_undef.hpp> +} // namespace boost #endif // BOOST_TT_HAS_TRIVIAL_CONSTRUCTOR_HPP_INCLUDED diff --git a/boost/type_traits/has_trivial_copy.hpp b/boost/type_traits/has_trivial_copy.hpp index 1c567cf042..9d3265d1dc 100644 --- a/boost/type_traits/has_trivial_copy.hpp +++ b/boost/type_traits/has_trivial_copy.hpp @@ -9,74 +9,54 @@ #ifndef BOOST_TT_HAS_TRIVIAL_COPY_HPP_INCLUDED #define BOOST_TT_HAS_TRIVIAL_COPY_HPP_INCLUDED -#include <boost/type_traits/config.hpp> #include <boost/type_traits/intrinsics.hpp> -#include <boost/type_traits/is_volatile.hpp> #include <boost/type_traits/is_pod.hpp> -#include <boost/type_traits/detail/ice_and.hpp> -#include <boost/type_traits/detail/ice_or.hpp> -#include <boost/type_traits/detail/ice_not.hpp> +#include <boost/type_traits/is_reference.hpp> -#ifdef __clang__ +#if (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 409)) || defined(BOOST_CLANG) || (defined(__SUNPRO_CC) && defined(BOOST_HAS_TRIVIAL_COPY)) #include <boost/type_traits/is_copy_constructible.hpp> +#define BOOST_TT_TRIVIAL_CONSTRUCT_FIX && is_copy_constructible<T>::value +#else +#define BOOST_TT_TRIVIAL_CONSTRUCT_FIX #endif -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#ifdef BOOST_INTEL +#include <boost/type_traits/add_const.hpp> +#include <boost/type_traits/add_lvalue_reference.hpp> +#endif namespace boost { -namespace detail { - -template <typename T> -struct has_trivial_copy_impl -{ +template <typename T> struct has_trivial_copy +: public integral_constant<bool, #ifdef BOOST_HAS_TRIVIAL_COPY -# ifdef __clang__ - BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_TRIVIAL_COPY(T) && boost::is_copy_constructible<T>::value); -# else - BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_TRIVIAL_COPY(T)); -# endif + BOOST_HAS_TRIVIAL_COPY(T) BOOST_TT_TRIVIAL_CONSTRUCT_FIX #else - BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_and< - ::boost::is_pod<T>::value, - ::boost::type_traits::ice_not< ::boost::is_volatile<T>::value >::value - >::value)); -#endif -}; - -#ifdef __clang__ - -template <typename T, std::size_t N> -struct has_trivial_copy_impl<T[N]> -{ - static const bool value = has_trivial_copy_impl<T>::value; -}; - + ::boost::is_pod<T>::value #endif - -} // namespace detail - -BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_copy,T,::boost::detail::has_trivial_copy_impl<T>::value) -BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_copy_constructor,T,::boost::detail::has_trivial_copy_impl<T>::value) - -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy,void,false) +>{}; +// Arrays are not explicitly copyable: +template <typename T, std::size_t N> struct has_trivial_copy<T[N]> : public false_type{}; +template <typename T> struct has_trivial_copy<T[]> : public false_type{}; +// Are volatile types ever trivial? We don't really know, so assume not: +template <typename T> struct has_trivial_copy<T volatile> : public false_type{}; + +template <> struct has_trivial_copy<void> : public false_type{}; #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy,void const volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy,void volatile,false) +template <> struct has_trivial_copy<void const> : public false_type{}; +template <> struct has_trivial_copy<void volatile> : public false_type{}; +template <> struct has_trivial_copy<void const volatile> : public false_type{}; #endif -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy_constructor,void,false) -#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy_constructor,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy_constructor,void const volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy_constructor,void volatile,false) +template <class T> struct has_trivial_copy<T&> : public false_type{}; +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +template <class T> struct has_trivial_copy<T&&> : public false_type{}; #endif -} // namespace boost +template <class T> struct has_trivial_copy_constructor : public has_trivial_copy<T>{}; + +#undef BOOST_TT_TRIVIAL_CONSTRUCT_FIX -#include <boost/type_traits/detail/bool_trait_undef.hpp> +} // namespace boost #endif // BOOST_TT_HAS_TRIVIAL_COPY_HPP_INCLUDED diff --git a/boost/type_traits/has_trivial_destructor.hpp b/boost/type_traits/has_trivial_destructor.hpp index 79d7522fdc..763283d78c 100644 --- a/boost/type_traits/has_trivial_destructor.hpp +++ b/boost/type_traits/has_trivial_destructor.hpp @@ -9,41 +9,40 @@ #ifndef BOOST_TT_HAS_TRIVIAL_DESTRUCTOR_HPP_INCLUDED #define BOOST_TT_HAS_TRIVIAL_DESTRUCTOR_HPP_INCLUDED -#include <boost/type_traits/config.hpp> #include <boost/type_traits/intrinsics.hpp> +#include <boost/type_traits/integral_constant.hpp> + +#ifdef BOOST_HAS_TRIVIAL_DESTRUCTOR + +#if defined(BOOST_INTEL) || defined(BOOST_MSVC) #include <boost/type_traits/is_pod.hpp> -#include <boost/type_traits/detail/ice_or.hpp> +#endif +#ifdef BOOST_HAS_SGI_TYPE_TRAITS +#include <boost/type_traits/is_same.hpp> +#endif -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#if defined(__GNUC__) || defined(__clang) || defined(__SUNPRO_CC) +#include <boost/type_traits/is_destructible.hpp> +#endif namespace boost { -namespace detail { - -template <typename T> -struct has_trivial_dtor_impl -{ -#ifdef BOOST_HAS_TRIVIAL_DESTRUCTOR - BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_TRIVIAL_DESTRUCTOR(T)); +template <typename T> struct has_trivial_destructor : public integral_constant<bool, BOOST_HAS_TRIVIAL_DESTRUCTOR(T)>{}; #else - BOOST_STATIC_CONSTANT(bool, value = ::boost::is_pod<T>::value); -#endif -}; +#include <boost/type_traits/is_pod.hpp> -} // namespace detail +namespace boost{ -BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_destructor,T,::boost::detail::has_trivial_dtor_impl<T>::value) +template <typename T> struct has_trivial_destructor : public integral_constant<bool, ::boost::is_pod<T>::value>{}; +#endif -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_destructor,void,false) +template <> struct has_trivial_destructor<void> : public false_type{}; #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_destructor,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_destructor,void const volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_destructor,void volatile,false) +template <> struct has_trivial_destructor<void const> : public false_type{}; +template <> struct has_trivial_destructor<void const volatile> : public false_type{}; +template <> struct has_trivial_destructor<void volatile> : public false_type{}; #endif } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_HAS_TRIVIAL_DESTRUCTOR_HPP_INCLUDED diff --git a/boost/type_traits/has_trivial_move_assign.hpp b/boost/type_traits/has_trivial_move_assign.hpp index db337f77e8..f7bb1987cb 100644 --- a/boost/type_traits/has_trivial_move_assign.hpp +++ b/boost/type_traits/has_trivial_move_assign.hpp @@ -11,47 +11,62 @@ #ifndef BOOST_TT_HAS_TRIVIAL_MOVE_ASSIGN_HPP_INCLUDED #define BOOST_TT_HAS_TRIVIAL_MOVE_ASSIGN_HPP_INCLUDED -#include <boost/type_traits/config.hpp> +#include <boost/type_traits/intrinsics.hpp> +#include <boost/type_traits/integral_constant.hpp> + +#if !defined(BOOST_HAS_TRIVIAL_MOVE_ASSIGN) || defined(BOOST_MSVC) || defined(BOOST_INTEL) #include <boost/type_traits/is_pod.hpp> #include <boost/type_traits/is_const.hpp> #include <boost/type_traits/is_volatile.hpp> -#include <boost/type_traits/detail/ice_and.hpp> -#include <boost/type_traits/detail/ice_not.hpp> +#ifdef BOOST_MSVC +#include <boost/type_traits/is_reference.hpp> +#endif +#endif -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#if defined(__GNUC__) || defined(__clang) +#include <boost/type_traits/is_assignable.hpp> +#include <boost/type_traits/is_volatile.hpp> +#endif -namespace boost { +#ifdef __SUNPRO_CC +#include <boost/type_traits/is_assignable.hpp> +#include <boost/type_traits/remove_const.hpp> +#if __cplusplus >= 201103 +#define SOLARIS_EXTRA_CHECK && is_assignable<typename remove_const<T>::type&, typename remove_const<T>::type&&>::value +#endif +#endif + +#ifndef SOLARIS_EXTRA_CHECK +#define SOLARIS_EXTRA_CHECK +#endif -namespace detail { +namespace boost{ template <typename T> -struct has_trivial_move_assign_impl -{ +struct has_trivial_move_assign : public integral_constant<bool, #ifdef BOOST_HAS_TRIVIAL_MOVE_ASSIGN - BOOST_STATIC_CONSTANT(bool, value = (BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T))); + BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) #else - BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_and< - ::boost::is_pod<T>::value, - ::boost::type_traits::ice_not< ::boost::is_const<T>::value >::value, - ::boost::type_traits::ice_not< ::boost::is_volatile<T>::value >::value - >::value)); + ::boost::is_pod<T>::value && !::boost::is_const<T>::value && !::boost::is_volatile<T>::value SOLARIS_EXTRA_CHECK #endif -}; + > {}; -} // namespace detail - -BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_move_assign,T,::boost::detail::has_trivial_move_assign_impl<T>::value) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_move_assign,void,false) +template <> struct has_trivial_move_assign<void> : public false_type{}; #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_move_assign,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_move_assign,void const volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_move_assign,void volatile,false) +template <> struct has_trivial_move_assign<void const> : public false_type{}; +template <> struct has_trivial_move_assign<void const volatile> : public false_type{}; +template <> struct has_trivial_move_assign<void volatile> : public false_type{}; +#endif +template <class T> struct has_trivial_move_assign<T&> : public false_type{}; +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES +template <class T> struct has_trivial_move_assign<T&&> : public false_type{}; #endif +// Array types are not assignable: +template <class T, std::size_t N> struct has_trivial_move_assign<T[N]> : public false_type{}; +template <class T> struct has_trivial_move_assign<T[]> : public false_type{}; } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> +#undef SOLARIS_EXTRA_CHECK #endif // BOOST_TT_HAS_TRIVIAL_MOVE_ASSIGN_HPP_INCLUDED diff --git a/boost/type_traits/has_trivial_move_constructor.hpp b/boost/type_traits/has_trivial_move_constructor.hpp index a3418340b4..9e601f38ae 100644 --- a/boost/type_traits/has_trivial_move_constructor.hpp +++ b/boost/type_traits/has_trivial_move_constructor.hpp @@ -11,47 +11,67 @@ #ifndef BOOST_TT_HAS_TRIVIAL_MOVE_CONSTRUCTOR_HPP_INCLUDED #define BOOST_TT_HAS_TRIVIAL_MOVE_CONSTRUCTOR_HPP_INCLUDED -#include <boost/type_traits/config.hpp> #include <boost/type_traits/intrinsics.hpp> +#include <boost/type_traits/integral_constant.hpp> + +#ifdef BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR + +#if defined(BOOST_MSVC) || defined(BOOST_INTEL) #include <boost/type_traits/is_pod.hpp> #include <boost/type_traits/is_volatile.hpp> -#include <boost/type_traits/detail/ice_and.hpp> -#include <boost/type_traits/detail/ice_not.hpp> +#endif + +#if defined(__GNUC__) || defined(__clang) +#include <boost/type_traits/is_constructible.hpp> +#include <boost/type_traits/is_volatile.hpp> +#endif -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { -namespace detail { +template <typename T> struct has_trivial_move_constructor : public integral_constant<bool, BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T)>{}; -template <typename T> -struct has_trivial_move_ctor_impl -{ -#ifdef BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR - BOOST_STATIC_CONSTANT(bool, value = (BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T))); #else - BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_and< - ::boost::is_pod<T>::value, - ::boost::type_traits::ice_not< ::boost::is_volatile<T>::value >::value - >::value)); + +#ifdef __SUNPRO_CC +#include <boost/type_traits/is_constructible.hpp> +#include <boost/type_traits/remove_const.hpp> +#if __cplusplus >= 201103 +#define SOLARIS_EXTRA_CHECK && is_constructible<typename remove_const<T>::type, typename remove_const<T>::type&&>::value +#endif #endif -}; -} // namespace detail +#ifndef SOLARIS_EXTRA_CHECK +#define SOLARIS_EXTRA_CHECK +#endif -BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_move_constructor,T,::boost::detail::has_trivial_move_ctor_impl<T>::value) +#include <boost/type_traits/is_pod.hpp> +#include <boost/type_traits/is_volatile.hpp> + +namespace boost { + +template <typename T> struct has_trivial_move_constructor + : public integral_constant<bool, ::boost::is_pod<T>::value && !::boost::is_volatile<T>::value SOLARIS_EXTRA_CHECK>{}; -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_move_constructor,void,false) +#undef SOLARIS_EXTRA_CHECK + +#endif + +template <> struct has_trivial_move_constructor<void> : public false_type{}; #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_move_constructor,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_move_constructor,void const volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_move_constructor,void volatile,false) +template <> struct has_trivial_move_constructor<void const> : public false_type{}; +template <> struct has_trivial_move_constructor<void volatile> : public false_type{}; +template <> struct has_trivial_move_constructor<void const volatile> : public false_type{}; #endif +// What should we do with reference types??? The standard seems to suggest these are trivial, even if the thing they reference is not: +template <class T> struct has_trivial_move_constructor<T&> : public true_type{}; +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES +template <class T> struct has_trivial_move_constructor<T&&> : public true_type{}; +#endif +// Arrays can not be explicitly copied: +template <class T, std::size_t N> struct has_trivial_move_constructor<T[N]> : public false_type{}; +template <class T> struct has_trivial_move_constructor<T[]> : public false_type{}; } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_HAS_TRIVIAL_MOVE_CONSTRUCTOR_HPP_INCLUDED diff --git a/boost/type_traits/has_virtual_destructor.hpp b/boost/type_traits/has_virtual_destructor.hpp index b741197d3a..4b0f38368a 100644 --- a/boost/type_traits/has_virtual_destructor.hpp +++ b/boost/type_traits/has_virtual_destructor.hpp @@ -11,19 +11,16 @@ #define BOOST_TT_HAS_VIRTUAL_DESTRUCTOR_HPP_INCLUDED #include <boost/type_traits/intrinsics.hpp> -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#include <boost/type_traits/integral_constant.hpp> namespace boost { #ifdef BOOST_HAS_VIRTUAL_DESTRUCTOR -BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_virtual_destructor,T,BOOST_HAS_VIRTUAL_DESTRUCTOR(T)) + template <class T> struct has_virtual_destructor : public integral_constant<bool, BOOST_HAS_VIRTUAL_DESTRUCTOR(T)>{}; #else -BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_virtual_destructor,T,false) + template <class T> struct has_virtual_destructor : public integral_constant<bool, false>{}; #endif } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/boost/type_traits/integral_constant.hpp b/boost/type_traits/integral_constant.hpp index c6847715e0..ae2448d070 100644 --- a/boost/type_traits/integral_constant.hpp +++ b/boost/type_traits/integral_constant.hpp @@ -1,4 +1,4 @@ -// (C) Copyright John Maddock 2005. +// (C) Copyright John Maddock 2015. // Use, modification and distribution are subject to 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) @@ -7,32 +7,99 @@ #define BOOST_TYPE_TRAITS_INTEGRAL_CONSTANT_HPP #include <boost/config.hpp> -#include <boost/mpl/bool.hpp> -#include <boost/mpl/integral_c.hpp> +#include <boost/detail/workaround.hpp> + +#if (BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) \ + || BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) \ + || BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) \ + || BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, BOOST_TESTED_AT(810)) ) + namespace boost{ + namespace mpl + { + template <bool B> struct bool_; + template <class I, I val> struct integral_c; + struct integral_c_tag; + } +} -#if defined(BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS) || defined(__BORLANDC__) -template <class T, int val> #else -template <class T, T val> -#endif -struct integral_constant : public mpl::integral_c<T, val> -{ - typedef integral_constant<T,val> type; -}; -template<> struct integral_constant<bool,true> : public mpl::true_ -{ - typedef integral_constant<bool,true> type; -}; -template<> struct integral_constant<bool,false> : public mpl::false_ +namespace mpl_{ + + template <bool B> struct bool_; + template <class I, I val> struct integral_c; + struct integral_c_tag; +} + +namespace boost { - typedef integral_constant<bool,false> type; -}; + namespace mpl + { + using ::mpl_::bool_; + using ::mpl_::integral_c; + using ::mpl_::integral_c_tag; + } +} + +#endif + +namespace boost{ + + template <class T, T val> + struct integral_constant + { + typedef mpl::integral_c_tag tag; + typedef T value_type; + typedef integral_constant<T, val> type; + static const T value = val; + // + // This helper function is just to disable type-punning + // warnings from GCC: + // + template <class U> + static U& dereference(U* p) { return *p; } + + operator const mpl::integral_c<T, val>& ()const + { + static const char data[sizeof(long)] = { 0 }; + return dereference(reinterpret_cast<const mpl::integral_c<T, val>*>(&data)); + } + BOOST_CONSTEXPR operator T()const { return val; } + }; + + template <class T, T val> + T const integral_constant<T, val>::value; + + template <bool val> + struct integral_constant<bool, val> + { + typedef mpl::integral_c_tag tag; + typedef bool value_type; + typedef integral_constant<bool, val> type; + static const bool value = val; + // + // This helper function is just to disable type-punning + // warnings from GCC: + // + template <class T> + static T& dereference(T* p) { return *p; } + + operator const mpl::bool_<val>& ()const + { + static const char data = 0; + return dereference(reinterpret_cast<const mpl::bool_<val>*>(&data)); + } + BOOST_CONSTEXPR operator bool()const { return val; } + }; + + template <bool val> + bool const integral_constant<bool, val>::value; -typedef integral_constant<bool,true> true_type; -typedef integral_constant<bool,false> false_type; + typedef integral_constant<bool, true> true_type; + typedef integral_constant<bool, false> false_type; } diff --git a/boost/type_traits/integral_promotion.hpp b/boost/type_traits/integral_promotion.hpp index 9c5514b115..0478f56349 100644 --- a/boost/type_traits/integral_promotion.hpp +++ b/boost/type_traits/integral_promotion.hpp @@ -7,18 +7,12 @@ #define FILE_boost_type_traits_integral_promotion_hpp_INCLUDED #include <boost/config.hpp> - -#include <boost/mpl/eval_if.hpp> -#include <boost/mpl/identity.hpp> #include <boost/type_traits/integral_constant.hpp> #include <boost/type_traits/is_const.hpp> #include <boost/type_traits/is_enum.hpp> #include <boost/type_traits/is_volatile.hpp> #include <boost/type_traits/remove_cv.hpp> -// Should be the last #include -#include <boost/type_traits/detail/type_trait_def.hpp> - namespace boost { namespace type_traits { namespace detail { @@ -168,27 +162,20 @@ struct integral_promotion_impl >::type type; }; -template<class T> -struct integral_promotion - : public boost::mpl::eval_if< - need_promotion<BOOST_DEDUCED_TYPENAME remove_cv<T>::type> - , integral_promotion_impl<T> - , boost::mpl::identity<T> - > -{ -}; +template<class T, bool b> struct integral_promotion { typedef T type; }; +template<class T> struct integral_promotion<T, true> : public integral_promotion_impl<T>{}; } } -BOOST_TT_AUX_TYPE_TRAIT_DEF1( - integral_promotion - , T - , BOOST_DEDUCED_TYPENAME - boost::type_traits::detail::integral_promotion<T>::type - ) -} +template <class T> struct integral_promotion +{ +private: + typedef boost::type_traits::detail::need_promotion<typename remove_cv<T>::type> tag_type; +public: + typedef typename boost::type_traits::detail::integral_promotion<T, tag_type::value>::type type; +}; -#include <boost/type_traits/detail/type_trait_undef.hpp> +} #endif // #ifndef FILE_boost_type_traits_integral_promotion_hpp_INCLUDED diff --git a/boost/type_traits/intrinsics.hpp b/boost/type_traits/intrinsics.hpp index e8a87b04e4..e2246be4d3 100644 --- a/boost/type_traits/intrinsics.hpp +++ b/boost/type_traits/intrinsics.hpp @@ -8,8 +8,12 @@ #ifndef BOOST_TT_INTRINSICS_HPP_INCLUDED #define BOOST_TT_INTRINSICS_HPP_INCLUDED +#ifndef BOOST_TT_DISABLE_INTRINSICS + +#include <boost/config.hpp> + #ifndef BOOST_TT_CONFIG_HPP_INCLUDED -#include <boost/type_traits/config.hpp> +#include <boost/type_traits/detail/config.hpp> #endif // @@ -44,6 +48,9 @@ // BOOST_IS_ENUM(T) true is T is an enum // BOOST_IS_POLYMORPHIC(T) true if T is a polymorphic type // BOOST_ALIGNMENT_OF(T) should evaluate to the alignment requirements of type T. +// +// define BOOST_TT_DISABLE_INTRINSICS to prevent any intrinsics being used (mostly used when testing) +// #ifdef BOOST_HAS_SGI_TYPE_TRAITS // Hook into SGI's __type_traits class, this will pick up user supplied @@ -85,18 +92,25 @@ #if (defined(BOOST_MSVC) && defined(BOOST_MSVC_FULL_VER) && (BOOST_MSVC_FULL_VER >=140050215))\ || (defined(BOOST_INTEL) && defined(_MSC_VER) && (_MSC_VER >= 1500)) -# include <boost/type_traits/is_same.hpp> -# include <boost/type_traits/is_function.hpp> - +// +// Note that even though these intrinsics rely on other type traits classes +// we do not #include those here as it produces cyclic dependencies and +// can cause the intrinsics to not even be used at all! +// # define BOOST_IS_UNION(T) __is_union(T) # define BOOST_IS_POD(T) (__is_pod(T) && __has_trivial_constructor(T)) # define BOOST_IS_EMPTY(T) __is_empty(T) # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T) -# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T)|| ( ::boost::is_pod<T>::value && !::boost::is_volatile<T>::value)) # define BOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) || ( ::boost::is_pod<T>::value && ! ::boost::is_const<T>::value && !::boost::is_volatile<T>::value)) # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) || ::boost::is_pod<T>::value) # define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_constructor(T) || ::boost::has_trivial_constructor<T>::value) -# define BOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T) || ::boost::has_trivial_copy<T>::value) +#if !defined(BOOST_INTEL) +# define BOOST_HAS_NOTHROW_COPY(T) ((__has_nothrow_copy(T) || ::boost::has_trivial_copy<T>::value) && !is_array<T>::value) +# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) || ::boost::is_pod<T>::value) +#elif (_MSC_VER >= 1900) +# define BOOST_HAS_NOTHROW_COPY(T) ((__is_nothrow_constructible(T, typename add_lvalue_reference<typename add_const<T>::type>::type)) && !is_array<T>::value) +# define BOOST_HAS_TRIVIAL_COPY(T) (__is_trivially_constructible(T, typename add_lvalue_reference<typename add_const<T>::type>::type)) +#endif # define BOOST_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) || ::boost::has_trivial_assign<T>::value) # define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T) @@ -105,15 +119,18 @@ # define BOOST_IS_CLASS(T) __is_class(T) # define BOOST_IS_CONVERTIBLE(T,U) ((__is_convertible_to(T,U) || (is_same<T,U>::value && !is_function<U>::value)) && !__is_abstract(U)) # define BOOST_IS_ENUM(T) __is_enum(T) -// This one doesn't quite always do the right thing: -// # define BOOST_IS_POLYMORPHIC(T) __is_polymorphic(T) // This one fails if the default alignment has been changed with /Zp: // # define BOOST_ALIGNMENT_OF(T) __alignof(T) # if defined(_MSC_VER) && (_MSC_VER >= 1700) -# define BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) ((__has_trivial_move_constructor(T) || __is_pod(T)) && !::boost::is_volatile<T>::value && !::boost::is_reference<T>::value) -# define BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) ((__has_trivial_move_assign(T) || __is_pod(T)) && ! ::boost::is_const<T>::value && !::boost::is_volatile<T>::value && !::boost::is_reference<T>::value) +# define BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) ((__has_trivial_move_constructor(T) || boost::is_pod<T>::value) && ! ::boost::is_volatile<T>::value && ! ::boost::is_reference<T>::value) +# define BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) ((__has_trivial_move_assign(T) || boost::is_pod<T>::value) && ! ::boost::is_const<T>::value && !::boost::is_volatile<T>::value && ! ::boost::is_reference<T>::value) # endif +#ifndef BOOST_NO_CXX11_FINAL +// This one doesn't quite always do the right thing on older VC++ versions +// we really need it when the final keyword is supporyted though: +# define BOOST_IS_POLYMORPHIC(T) __is_polymorphic(T) +#endif #if _MSC_FULL_VER >= 180020827 # define BOOST_IS_NOTHROW_MOVE_ASSIGN(T) (__is_nothrow_assignable(T&, T&&)) # define BOOST_IS_NOTHROW_MOVE_CONSTRUCT(T) (__is_nothrow_constructible(T, T&&)) @@ -144,10 +161,12 @@ // This is a rubbish fix as it basically stops type traits from working correctly, // but maybe the best we can do for now. See https://svn.boost.org/trac/boost/ticket/10694 // +// +// Note that even though these intrinsics rely on other type traits classes +// we do not #include those here as it produces cyclic dependencies and +// can cause the intrinsics to not even be used at all! +// # include <cstddef> -# include <boost/type_traits/is_same.hpp> -# include <boost/type_traits/is_reference.hpp> -# include <boost/type_traits/is_volatile.hpp> # if __has_feature(is_union) # define BOOST_IS_UNION(T) __is_union(T) @@ -162,22 +181,22 @@ # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T) # endif # if __has_feature(has_trivial_copy) -# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) && !is_reference<T>::value && !is_volatile<T>::value) +# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) && !is_reference<T>::value) # endif # if __has_feature(has_trivial_assign) -# define BOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) && !is_volatile<T>::value) +# define BOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) && !is_volatile<T>::value && is_assignable<T&, const T&>::value) # endif # if __has_feature(has_trivial_destructor) -# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T) +# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) && is_destructible<T>::value) # endif # if __has_feature(has_nothrow_constructor) -# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) __has_nothrow_constructor(T) +# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_constructor(T) && is_default_constructible<T>::value) # endif # if __has_feature(has_nothrow_copy) -# define BOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T) && !is_volatile<T>::value && !is_reference<T>::value) +# define BOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T) && !is_volatile<T>::value && !is_reference<T>::value && is_copy_constructible<T>::value) # endif # if __has_feature(has_nothrow_assign) -# define BOOST_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) && !is_volatile<T>::value) +# define BOOST_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) && !is_volatile<T>::value && is_assignable<T&, const T&>::value) # endif # if __has_feature(has_virtual_destructor) # define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T) @@ -201,12 +220,17 @@ # define BOOST_IS_POLYMORPHIC(T) __is_polymorphic(T) # endif # if __has_feature(has_trivial_move_constructor) -# define BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) __has_trivial_move_constructor(T) +# define BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) (__has_trivial_move_constructor(T) && is_constructible<T, T&&>::value && !::boost::is_volatile<T>::value) # endif # if __has_feature(has_trivial_move_assign) -# define BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) __has_trivial_move_assign(T) +# define BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) (__has_trivial_move_assign(T) && is_assignable<T&, T&&>::value && !::boost::is_volatile<T>::value) +# endif +# if (!defined(unix) && !defined(__unix__)) || defined(__LP64__) || !defined(__GNUC__) +// GCC sometimes lies about alignment requirements +// of type double on 32-bit unix platforms, use the +// old implementation instead in that case: +# define BOOST_ALIGNMENT_OF(T) __alignof(T) # endif -# define BOOST_ALIGNMENT_OF(T) __alignof(T) # if __has_feature(is_final) # define BOOST_IS_FINAL(T) __is_final(T) # endif @@ -215,9 +239,11 @@ #endif #if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3) && !defined(__GCCXML__))) && !defined(BOOST_CLANG) -# include <boost/type_traits/is_same.hpp> -# include <boost/type_traits/is_reference.hpp> -# include <boost/type_traits/is_volatile.hpp> +// +// Note that even though these intrinsics rely on other type traits classes +// we do not #include those here as it produces cyclic dependencies and +// can cause the intrinsics to not even be used at all! +// #ifdef BOOST_INTEL # define BOOST_INTEL_TT_OPTS || is_pod<T>::value @@ -229,12 +255,20 @@ # define BOOST_IS_POD(T) __is_pod(T) # define BOOST_IS_EMPTY(T) __is_empty(T) # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) ((__has_trivial_constructor(T) BOOST_INTEL_TT_OPTS) && ! ::boost::is_volatile<T>::value) -# define BOOST_HAS_TRIVIAL_COPY(T) ((__has_trivial_copy(T) BOOST_INTEL_TT_OPTS) && !is_reference<T>::value && ! ::boost::is_volatile<T>::value) +# define BOOST_HAS_TRIVIAL_COPY(T) ((__has_trivial_copy(T) BOOST_INTEL_TT_OPTS) && !is_reference<T>::value) +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 +# define BOOST_HAS_TRIVIAL_ASSIGN(T) ((__has_trivial_assign(T) BOOST_INTEL_TT_OPTS) && ! ::boost::is_volatile<T>::value && ! ::boost::is_const<T>::value && is_assignable<T&, const T&>::value) +# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) BOOST_INTEL_TT_OPTS && is_destructible<T>::value) +# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_constructor(T) && is_default_constructible<T>::value BOOST_INTEL_TT_OPTS) +# define BOOST_HAS_NOTHROW_COPY(T) ((__has_nothrow_copy(T) BOOST_INTEL_TT_OPTS) && !is_volatile<T>::value && !is_reference<T>::value && is_copy_constructible<T>::value) +# define BOOST_HAS_NOTHROW_ASSIGN(T) ((__has_nothrow_assign(T) BOOST_INTEL_TT_OPTS) && !is_volatile<T>::value && !is_const<T>::value && is_assignable<T&, const T&>::value) +#else # define BOOST_HAS_TRIVIAL_ASSIGN(T) ((__has_trivial_assign(T) BOOST_INTEL_TT_OPTS) && ! ::boost::is_volatile<T>::value && ! ::boost::is_const<T>::value) # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) BOOST_INTEL_TT_OPTS) # define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_constructor(T) BOOST_INTEL_TT_OPTS) -# define BOOST_HAS_NOTHROW_COPY(T) ((__has_nothrow_copy(T) BOOST_INTEL_TT_OPTS) && !is_volatile<T>::value && !is_reference<T>::value) -# define BOOST_HAS_NOTHROW_ASSIGN(T) ((__has_nothrow_assign(T) BOOST_INTEL_TT_OPTS) && !is_volatile<T>::value && !is_const<T>::value) +# define BOOST_HAS_NOTHROW_COPY(T) ((__has_nothrow_copy(T) BOOST_INTEL_TT_OPTS) && !is_volatile<T>::value && !is_reference<T>::value && !is_array<T>::value) +# define BOOST_HAS_NOTHROW_ASSIGN(T) ((__has_nothrow_assign(T) BOOST_INTEL_TT_OPTS) && !is_volatile<T>::value && !is_const<T>::value && !is_array<T>::value) +#endif # define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T) # define BOOST_IS_ABSTRACT(T) __is_abstract(T) @@ -252,24 +286,26 @@ # define BOOST_IS_FINAL(T) __is_final(T) # endif +# if (__GNUC__ >= 5) && (__cplusplus >= 201103) +# define BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) (__is_trivially_assignable(T&, T&&) && is_assignable<T&, T&&>::value && !::boost::is_volatile<T>::value) +# define BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) (__is_trivially_constructible(T, T&&) && is_constructible<T, T&&>::value && !::boost::is_volatile<T>::value) +# endif + # define BOOST_HAS_TYPE_TRAITS_INTRINSICS #endif #if defined(__SUNPRO_CC) && (__SUNPRO_CC >= 0x5130) -# include <boost/type_traits/is_same.hpp> -# include <boost/type_traits/is_reference.hpp> -# include <boost/type_traits/is_volatile.hpp> - # define BOOST_IS_UNION(T) __oracle_is_union(T) -# define BOOST_IS_POD(T) __oracle_is_pod(T) +# define BOOST_IS_POD(T) (__oracle_is_pod(T) && !is_function<T>::value) # define BOOST_IS_EMPTY(T) __oracle_is_empty(T) # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) (__oracle_has_trivial_constructor(T) && ! ::boost::is_volatile<T>::value) -# define BOOST_HAS_TRIVIAL_COPY(T) (__oracle_has_trivial_copy(T) && !is_reference<T>::value && ! ::boost::is_volatile<T>::value) -# define BOOST_HAS_TRIVIAL_ASSIGN(T) ((__oracle_has_trivial_assign(T) || __oracle_is_trivial(T)) && ! ::boost::is_volatile<T>::value && ! ::boost::is_const<T>::value) -# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) __oracle_has_trivial_destructor(T) -# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__oracle_has_nothrow_constructor(T) || __oracle_has_trivial_constructor(T) || __oracle_is_trivial(T)) -# define BOOST_HAS_NOTHROW_COPY(T) ((__oracle_has_nothrow_copy(T) || __oracle_has_trivial_copy(T) || __oracle_is_trivial(T)) && !is_volatile<T>::value && !is_reference<T>::value) -# define BOOST_HAS_NOTHROW_ASSIGN(T) ((__oracle_has_nothrow_assign(T) || __oracle_has_trivial_assign(T) || __oracle_is_trivial(T)) && !is_volatile<T>::value && !is_const<T>::value) +# define BOOST_HAS_TRIVIAL_COPY(T) (__oracle_has_trivial_copy(T) && !is_reference<T>::value) +# define BOOST_HAS_TRIVIAL_ASSIGN(T) ((__oracle_has_trivial_assign(T) || __oracle_is_trivial(T)) && ! ::boost::is_volatile<T>::value && ! ::boost::is_const<T>::value && is_assignable<T&, const T&>::value) +# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__oracle_has_trivial_destructor(T) && is_destructible<T>::value) +# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) ((__oracle_has_nothrow_constructor(T) || __oracle_has_trivial_constructor(T) || __oracle_is_trivial(T)) && is_default_constructible<T>::value) +// __oracle_has_nothrow_copy appears to behave the same as __oracle_has_nothrow_assign, disabled for now: +//# define BOOST_HAS_NOTHROW_COPY(T) ((__oracle_has_nothrow_copy(T) || __oracle_has_trivial_copy(T) || __oracle_is_trivial(T)) && !is_volatile<T>::value && !is_reference<T>::value && is_copy_constructible<T>::value) +# define BOOST_HAS_NOTHROW_ASSIGN(T) ((__oracle_has_nothrow_assign(T) || __oracle_has_trivial_assign(T) || __oracle_is_trivial(T)) && !is_volatile<T>::value && !is_const<T>::value && is_assignable<T&, const T&>::value) # define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __oracle_has_virtual_destructor(T) # define BOOST_IS_ABSTRACT(T) __oracle_is_abstract(T) @@ -292,7 +328,7 @@ # define BOOST_IS_POD(T) __is_pod(T) # define BOOST_IS_EMPTY(T) __is_empty(T) # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T) -# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) && !is_reference<T>::value && !is_volatile<T>::value) +# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) && !is_reference<T>::value) # define BOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) && !is_volatile<T>::value) # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T) # define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) __has_nothrow_constructor(T) @@ -319,7 +355,7 @@ # define BOOST_IS_POD(T) __is_pod(T) # define BOOST_IS_EMPTY(T) __is_empty(T) # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) (__has_trivial_default_constructor(T)) -# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy_constructor(T) && !is_volatile<T>::value && !is_reference<T>::value) +# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy_constructor(T) && !is_reference<T>::value) # define BOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) && !is_volatile<T>::value) # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T)) # define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_default_constructor(T)) @@ -338,11 +374,7 @@ # define BOOST_HAS_TYPE_TRAITS_INTRINSICS #endif -#endif // BOOST_TT_INTRINSICS_HPP_INCLUDED - - - - - +#endif // BOOST_TT_DISABLE_INTRINSICS +#endif // BOOST_TT_INTRINSICS_HPP_INCLUDED diff --git a/boost/type_traits/is_abstract.hpp b/boost/type_traits/is_abstract.hpp index f1cd92c67c..7715c5ca37 100644 --- a/boost/type_traits/is_abstract.hpp +++ b/boost/type_traits/is_abstract.hpp @@ -49,20 +49,18 @@ // #include <boost/type_traits/intrinsics.hpp> +#include <boost/type_traits/integral_constant.hpp> #ifndef BOOST_IS_ABSTRACT #include <boost/static_assert.hpp> #include <boost/type_traits/detail/yes_no_type.hpp> #include <boost/type_traits/is_class.hpp> -#include <boost/type_traits/detail/ice_and.hpp> #ifdef BOOST_NO_IS_ABSTRACT #include <boost/type_traits/is_polymorphic.hpp> #endif #endif -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> - namespace boost { + namespace detail{ #ifdef BOOST_IS_ABSTRACT @@ -141,13 +139,11 @@ struct is_abstract_imp } #ifndef BOOST_NO_IS_ABSTRACT -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_abstract,T,::boost::detail::is_abstract_imp<T>::value) +template <class T> struct is_abstract : public integral_constant<bool, ::boost::detail::is_abstract_imp<T>::value> {}; #else -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_abstract,T,::boost::detail::is_polymorphic_imp<T>::value) +template <class T> struct is_abstract : public integral_constant<bool, ::boost::detail::is_polymorphic_imp<T>::value> {}; #endif } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif //BOOST_TT_IS_ABSTRACT_CLASS_HPP diff --git a/boost/type_traits/is_arithmetic.hpp b/boost/type_traits/is_arithmetic.hpp index a1d8c46d5f..c23811ebea 100644 --- a/boost/type_traits/is_arithmetic.hpp +++ b/boost/type_traits/is_arithmetic.hpp @@ -9,43 +9,14 @@ #ifndef BOOST_TT_IS_ARITHMETIC_HPP_INCLUDED #define BOOST_TT_IS_ARITHMETIC_HPP_INCLUDED -#if !defined( __CODEGEARC__ ) #include <boost/type_traits/is_integral.hpp> -#include <boost/type_traits/is_float.hpp> -#include <boost/type_traits/detail/ice_or.hpp> -#include <boost/config.hpp> -#endif - -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#include <boost/type_traits/is_floating_point.hpp> namespace boost { -#if !defined(__CODEGEARC__) -namespace detail { - -template< typename T > -struct is_arithmetic_impl -{ - BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_or< - ::boost::is_integral<T>::value, - ::boost::is_float<T>::value - >::value)); -}; - -} // namespace detail -#endif - -//* is a type T an arithmetic type described in the standard (3.9.1p8) -#if defined(__CODEGEARC__) -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_arithmetic,T,__is_arithmetic(T)) -#else -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_arithmetic,T,::boost::detail::is_arithmetic_impl<T>::value) -#endif +template <class T> +struct is_arithmetic : public integral_constant<bool, is_integral<T>::value || is_floating_point<T>::value> {}; } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_ARITHMETIC_HPP_INCLUDED diff --git a/boost/type_traits/is_array.hpp b/boost/type_traits/is_array.hpp index c381ca4e70..497dc49327 100644 --- a/boost/type_traits/is_array.hpp +++ b/boost/type_traits/is_array.hpp @@ -14,30 +14,25 @@ #ifndef BOOST_TT_IS_ARRAY_HPP_INCLUDED #define BOOST_TT_IS_ARRAY_HPP_INCLUDED -#include <boost/type_traits/config.hpp> - - +#include <boost/type_traits/integral_constant.hpp> #include <cstddef> -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> - namespace boost { #if defined( __CODEGEARC__ ) -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_array,T,__is_array(T)) + template <class T> struct is_array : public integral_constant<bool, __is_array(T)> {}; #else -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_array,T,false) + template <class T> struct is_array : public false_type {}; #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,is_array,T[N],true) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,is_array,T const[N],true) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,is_array,T volatile[N],true) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,is_array,T const volatile[N],true) + template <class T, std::size_t N> struct is_array<T[N]> : public true_type {}; + template <class T, std::size_t N> struct is_array<T const[N]> : public true_type{}; + template <class T, std::size_t N> struct is_array<T volatile[N]> : public true_type{}; + template <class T, std::size_t N> struct is_array<T const volatile[N]> : public true_type{}; #if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_array,T[],true) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_array,T const[],true) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_array,T volatile[],true) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_array,T const volatile[],true) + template <class T> struct is_array<T[]> : public true_type{}; + template <class T> struct is_array<T const[]> : public true_type{}; + template <class T> struct is_array<T const volatile[]> : public true_type{}; + template <class T> struct is_array<T volatile[]> : public true_type{}; #endif #endif @@ -45,6 +40,4 @@ BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_array,T const volatile[],t } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_ARRAY_HPP_INCLUDED diff --git a/boost/type_traits/is_assignable.hpp b/boost/type_traits/is_assignable.hpp new file mode 100644 index 0000000000..9cf681dd31 --- /dev/null +++ b/boost/type_traits/is_assignable.hpp @@ -0,0 +1,76 @@ + +// (C) Copyright John Maddock 2015. +// Use, modification and distribution are subject to 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_IS_ASSIGNABLE_HPP_INCLUDED +#define BOOST_TT_IS_ASSIGNABLE_HPP_INCLUDED + +#include <boost/type_traits/integral_constant.hpp> +#include <boost/detail/workaround.hpp> + +namespace boost{ + + template <class T, class U = T> struct is_assignable; + +} + +#if !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) + +#include <boost/type_traits/detail/yes_no_type.hpp> +#include <boost/type_traits/declval.hpp> + +namespace boost{ + + namespace detail{ + + struct is_assignable_imp + { + template<typename T, typename U, typename = decltype(boost::declval<T>() = boost::declval<U>())> + static boost::type_traits::yes_type test(int); + + template<typename, typename> + static boost::type_traits::no_type test(...); + }; + + } + + template <class T, class U> struct is_assignable : public integral_constant<bool, sizeof(detail::is_assignable_imp::test<T, U>(0)) == sizeof(boost::type_traits::yes_type)>{}; + template <class T, std::size_t N, class U> struct is_assignable<T[N], U> : public is_assignable<T, U>{}; + template <class T, std::size_t N, class U> struct is_assignable<T(&)[N], U> : public is_assignable<T&, U>{}; + template <class T, class U> struct is_assignable<T[], U> : public is_assignable<T, U>{}; + template <class T, class U> struct is_assignable<T(&)[], U> : public is_assignable<T&, U>{}; + template <class U> struct is_assignable<void, U> : public integral_constant<bool, false>{}; + template <class U> struct is_assignable<void const, U> : public integral_constant<bool, false>{}; + template <class U> struct is_assignable<void volatile, U> : public integral_constant<bool, false>{}; + template <class U> struct is_assignable<void const volatile, U> : public integral_constant<bool, false>{}; + +#else + +#include <boost/type_traits/has_trivial_assign.hpp> +#include <boost/type_traits/remove_reference.hpp> + +namespace boost{ + + // We don't know how to implement this: + template <class T, class U> struct is_assignable : public integral_constant<bool, false>{}; + template <class T, class U> struct is_assignable<T&, U> : public integral_constant<bool, is_pod<T>::value && is_pod<typename remove_reference<U>::type>::value>{}; + template <class T, class U> struct is_assignable<const T&, U> : public integral_constant<bool, false>{}; + template <class U> struct is_assignable<void, U> : public integral_constant<bool, false>{}; + template <class U> struct is_assignable<void const, U> : public integral_constant<bool, false>{}; + template <class U> struct is_assignable<void volatile, U> : public integral_constant<bool, false>{}; + template <class U> struct is_assignable<void const volatile, U> : public integral_constant<bool, false>{}; + /* + template <> struct is_assignable<void, void> : public integral_constant<bool, false>{}; + template <> struct is_assignable<void const, void const> : public integral_constant<bool, false>{}; + template <> struct is_assignable<void volatile, void volatile> : public integral_constant<bool, false>{}; + template <> struct is_assignable<void const volatile, void const volatile> : public integral_constant<bool, false>{}; + */ +#endif + +} // namespace boost + +#endif // BOOST_TT_IS_ASSIGNABLE_HPP_INCLUDED diff --git a/boost/type_traits/is_base_and_derived.hpp b/boost/type_traits/is_base_and_derived.hpp index 632b699445..ee3dce597c 100644 --- a/boost/type_traits/is_base_and_derived.hpp +++ b/boost/type_traits/is_base_and_derived.hpp @@ -10,18 +10,16 @@ #define BOOST_TT_IS_BASE_AND_DERIVED_HPP_INCLUDED #include <boost/type_traits/intrinsics.hpp> +#include <boost/type_traits/integral_constant.hpp> #ifndef BOOST_IS_BASE_OF #include <boost/type_traits/is_class.hpp> #include <boost/type_traits/is_same.hpp> #include <boost/type_traits/is_convertible.hpp> -#include <boost/type_traits/detail/ice_and.hpp> #include <boost/config.hpp> #include <boost/static_assert.hpp> #endif #include <boost/type_traits/remove_cv.hpp> - -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#include <boost/type_traits/is_same.hpp> namespace boost { @@ -230,23 +228,17 @@ struct is_base_and_derived_impl #endif } // namespace detail -BOOST_TT_AUX_BOOL_TRAIT_DEF2( - is_base_and_derived - , Base - , Derived - , (::boost::detail::is_base_and_derived_impl<Base,Derived>::value) - ) +template <class Base, class Derived> struct is_base_and_derived + : public integral_constant<bool, (::boost::detail::is_base_and_derived_impl<Base, Derived>::value)> {}; -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_and_derived,Base&,Derived,false) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_and_derived,Base,Derived&,false) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_and_derived,Base&,Derived&,false) +template <class Base, class Derived> struct is_base_and_derived<Base&, Derived> : public false_type{}; +template <class Base, class Derived> struct is_base_and_derived<Base, Derived&> : public false_type{}; +template <class Base, class Derived> struct is_base_and_derived<Base&, Derived&> : public false_type{}; #if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610)) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_1(typename Base,is_base_and_derived,Base,Base,false) +template <class Base> struct is_base_and_derived<Base, Base> : public true_type{}; #endif } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_BASE_AND_DERIVED_HPP_INCLUDED diff --git a/boost/type_traits/is_base_of.hpp b/boost/type_traits/is_base_of.hpp index 3655b0bd23..89f2f67980 100644 --- a/boost/type_traits/is_base_of.hpp +++ b/boost/type_traits/is_base_of.hpp @@ -12,11 +12,6 @@ #include <boost/type_traits/is_base_and_derived.hpp> #include <boost/type_traits/is_same.hpp> #include <boost/type_traits/is_class.hpp> -#include <boost/type_traits/detail/ice_or.hpp> -#include <boost/type_traits/detail/ice_and.hpp> - -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { @@ -26,24 +21,19 @@ namespace boost { { typedef typename remove_cv<B>::type ncvB; typedef typename remove_cv<D>::type ncvD; - BOOST_STATIC_CONSTANT(bool, value = (::boost::type_traits::ice_or< - (::boost::detail::is_base_and_derived_impl<ncvB,ncvD>::value), - (::boost::type_traits::ice_and< ::boost::is_same<ncvB,ncvD>::value, ::boost::is_class<ncvB>::value>::value)>::value)); + BOOST_STATIC_CONSTANT(bool, value = ( + (::boost::detail::is_base_and_derived_impl<ncvB,ncvD>::value) || + (::boost::is_same<ncvB,ncvD>::value && ::boost::is_class<ncvB>::value))); }; } -BOOST_TT_AUX_BOOL_TRAIT_DEF2( - is_base_of - , Base - , Derived - , (::boost::detail::is_base_of_imp<Base, Derived>::value)) + template <class Base, class Derived> struct is_base_of + : public integral_constant<bool, (::boost::detail::is_base_of_imp<Base, Derived>::value)> {}; -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base&,Derived,false) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base,Derived&,false) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base&,Derived&,false) + template <class Base, class Derived> struct is_base_of<Base, Derived&> : false_type{}; + template <class Base, class Derived> struct is_base_of<Base&, Derived&> : false_type{}; + template <class Base, class Derived> struct is_base_of<Base&, Derived> : false_type{}; } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_BASE_AND_DERIVED_HPP_INCLUDED diff --git a/boost/type_traits/is_base_of_tr1.hpp b/boost/type_traits/is_base_of_tr1.hpp index 7264f159fc..210bf54e7b 100644 --- a/boost/type_traits/is_base_of_tr1.hpp +++ b/boost/type_traits/is_base_of_tr1.hpp @@ -12,10 +12,6 @@ #include <boost/type_traits/is_base_and_derived.hpp> #include <boost/type_traits/is_same.hpp> #include <boost/type_traits/is_class.hpp> -#include <boost/type_traits/detail/ice_or.hpp> - -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { namespace tr1{ @@ -25,24 +21,17 @@ namespace boost { namespace tr1{ { typedef typename remove_cv<B>::type ncvB; typedef typename remove_cv<D>::type ncvD; - BOOST_STATIC_CONSTANT(bool, value = (::boost::type_traits::ice_or< - (::boost::detail::is_base_and_derived_impl<ncvB,ncvD>::value), - (::boost::is_same<ncvB,ncvD>::value)>::value)); + BOOST_STATIC_CONSTANT(bool, value = ((::boost::detail::is_base_and_derived_impl<ncvB,ncvD>::value) || (::boost::is_same<ncvB,ncvD>::value))); }; } -BOOST_TT_AUX_BOOL_TRAIT_DEF2( - is_base_of - , Base - , Derived - , (::boost::tr1::detail::is_base_of_imp<Base, Derived>::value)) + template <class Base, class Derived> struct is_base_of + : public integral_constant<bool, (::boost::tr1::detail::is_base_of_imp<Base, Derived>::value)>{}; -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base&,Derived,false) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base,Derived&,false) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base&,Derived&,false) + template <class Base, class Derived> struct is_base_of<Base, Derived&> : public false_type{}; + template <class Base, class Derived> struct is_base_of<Base&, Derived&> : public false_type{}; + template <class Base, class Derived> struct is_base_of<Base&, Derived> : public false_type{}; } } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_BASE_OF_TR1_HPP_INCLUDED diff --git a/boost/type_traits/is_class.hpp b/boost/type_traits/is_class.hpp index 0675b57822..e3a22d2b63 100644 --- a/boost/type_traits/is_class.hpp +++ b/boost/type_traits/is_class.hpp @@ -10,12 +10,11 @@ #ifndef BOOST_TT_IS_CLASS_HPP_INCLUDED #define BOOST_TT_IS_CLASS_HPP_INCLUDED -#include <boost/type_traits/config.hpp> +#include <boost/type_traits/detail/config.hpp> #include <boost/type_traits/intrinsics.hpp> +#include <boost/type_traits/integral_constant.hpp> #ifndef BOOST_IS_CLASS # include <boost/type_traits/is_union.hpp> -# include <boost/type_traits/detail/ice_and.hpp> -# include <boost/type_traits/detail/ice_not.hpp> #ifdef BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION # include <boost/type_traits/detail/yes_no_type.hpp> @@ -29,13 +28,6 @@ #endif // BOOST_IS_CLASS -#ifdef __EDG_VERSION__ -# include <boost/type_traits/remove_cv.hpp> -#endif - -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> - namespace boost { namespace detail { @@ -63,10 +55,8 @@ struct is_class_impl { BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_and< - sizeof(is_class_tester<T>(0)) == sizeof(::boost::type_traits::yes_type), - ::boost::type_traits::ice_not< ::boost::is_union<T>::value >::value - >::value) + sizeof(is_class_tester<T>(0)) == sizeof(::boost::type_traits::yes_type) + && ! ::boost::is_union<T>::value ); }; @@ -79,10 +69,8 @@ struct is_class_impl template <class U> static ::boost::type_traits::no_type is_class_tester(...); BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_and< - sizeof(is_class_tester<T>(0)) == sizeof(::boost::type_traits::yes_type), - ::boost::type_traits::ice_not< ::boost::is_union<T>::value >::value - >::value) + sizeof(is_class_tester<T>(0)) == sizeof(::boost::type_traits::yes_type) + && ! ::boost::is_union<T>::value ); }; @@ -94,14 +82,13 @@ template <typename T> struct is_class_impl { BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_and< - ::boost::type_traits::ice_not< ::boost::is_union<T>::value >::value, - ::boost::type_traits::ice_not< ::boost::is_scalar<T>::value >::value, - ::boost::type_traits::ice_not< ::boost::is_array<T>::value >::value, - ::boost::type_traits::ice_not< ::boost::is_reference<T>::value>::value, - ::boost::type_traits::ice_not< ::boost::is_void<T>::value >::value, - ::boost::type_traits::ice_not< ::boost::is_function<T>::value >::value - >::value)); + ! ::boost::is_union<T>::value >::value + && ! ::boost::is_scalar<T>::value + && ! ::boost::is_array<T>::value + && ! ::boost::is_reference<T>::value + && ! ::boost::is_void<T>::value + && ! ::boost::is_function<T>::value + ); }; # endif // BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION @@ -115,15 +102,13 @@ struct is_class_impl } // namespace detail +template <class T> struct is_class : public integral_constant<bool, ::boost::detail::is_class_impl<T>::value> {}; # ifdef __EDG_VERSION__ -BOOST_TT_AUX_BOOL_TRAIT_DEF1( - is_class,T, boost::detail::is_class_impl<typename boost::remove_cv<T>::type>::value) -# else -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_class,T,::boost::detail::is_class_impl<T>::value) +template <class T> struct is_class<const T> : public is_class<T>{}; +template <class T> struct is_class<const volatile T> : public is_class<T>{}; +template <class T> struct is_class<volatile T> : public is_class<T>{}; # endif } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_CLASS_HPP_INCLUDED diff --git a/boost/type_traits/is_complex.hpp b/boost/type_traits/is_complex.hpp index 0813dac903..7cf04b4796 100644 --- a/boost/type_traits/is_complex.hpp +++ b/boost/type_traits/is_complex.hpp @@ -8,27 +8,17 @@ #ifndef BOOST_TT_IS_COMPLEX_HPP #define BOOST_TT_IS_COMPLEX_HPP -#include <boost/type_traits/is_convertible.hpp> #include <complex> -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> - +#include <boost/type_traits/integral_constant.hpp> namespace boost { -namespace detail{ - -struct is_convertible_from_tester -{ - template <class T> - is_convertible_from_tester(const std::complex<T>&); -}; -} - -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_complex,T,(::boost::is_convertible<T, boost::detail::is_convertible_from_tester>::value)) + template <class T> struct is_complex : public false_type {}; + template <class T> struct is_complex<const T > : public is_complex<T>{}; + template <class T> struct is_complex<volatile const T > : public is_complex<T>{}; + template <class T> struct is_complex<volatile T > : public is_complex<T>{}; + template <class T> struct is_complex<std::complex<T> > : public true_type{}; } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif //BOOST_TT_IS_COMPLEX_HPP diff --git a/boost/type_traits/is_compound.hpp b/boost/type_traits/is_compound.hpp index bbaaa42cd7..7995eb8a23 100644 --- a/boost/type_traits/is_compound.hpp +++ b/boost/type_traits/is_compound.hpp @@ -9,38 +9,16 @@ #ifndef BOOST_TT_IS_COMPOUND_HPP_INCLUDED #define BOOST_TT_IS_COMPOUND_HPP_INCLUDED -#include <boost/config.hpp> #include <boost/type_traits/is_fundamental.hpp> -#include <boost/type_traits/detail/ice_not.hpp> - -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { -#if !defined( __CODEGEARC__ ) -namespace detail { - -template <typename T> -struct is_compound_impl -{ - BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_not< - ::boost::is_fundamental<T>::value - >::value)); -}; - -} // namespace detail -#endif // !defined( __CODEGEARC__ ) - #if defined( __CODEGEARC__ ) -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_compound,T,__is_compound(T)) + template <class T> struct is_compound : public integral_constant<bool, __is_compound(T)> {}; #else -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_compound,T,::boost::detail::is_compound_impl<T>::value) + template <class T> struct is_compound : public integral_constant<bool, ! ::boost::is_fundamental<T>::value> {}; #endif } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_COMPOUND_HPP_INCLUDED diff --git a/boost/type_traits/is_const.hpp b/boost/type_traits/is_const.hpp index e3e62b697c..d9dd2aa326 100644 --- a/boost/type_traits/is_const.hpp +++ b/boost/type_traits/is_const.hpp @@ -21,70 +21,26 @@ #ifndef BOOST_TT_IS_CONST_HPP_INCLUDED #define BOOST_TT_IS_CONST_HPP_INCLUDED -#include <boost/config.hpp> -#include <boost/detail/workaround.hpp> - -# include <boost/type_traits/detail/cv_traits_impl.hpp> -# ifdef __GNUC__ -# include <boost/type_traits/is_reference.hpp> -# endif -# if BOOST_WORKAROUND(BOOST_MSVC, < 1400) -# include <boost/type_traits/remove_bounds.hpp> -# endif - -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#include <boost/type_traits/integral_constant.hpp> namespace boost { #if defined( __CODEGEARC__ ) -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_const,T,__is_const(T)) + template <class T> + struct is_const : public integral_constant<bool, __is_const(T)> {}; #else -namespace detail{ -// -// We can't filter out rvalue_references at the same level as -// references or we get ambiguities from msvc: -// -template <class T> -struct is_const_rvalue_filter -{ -#if BOOST_WORKAROUND(BOOST_MSVC, < 1400) - BOOST_STATIC_CONSTANT(bool, value = ::boost::detail::cv_traits_imp<typename boost::remove_bounds<T>::type*>::is_const); -#else - BOOST_STATIC_CONSTANT(bool, value = ::boost::detail::cv_traits_imp<BOOST_TT_AUX_CV_TRAITS_IMPL_PARAM(T)>::is_const); -#endif -}; -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -template <class T> -struct is_const_rvalue_filter<T&&> -{ - BOOST_STATIC_CONSTANT(bool, value = false); -}; -#endif -} - -//* is a type T declared const - is_const<T> -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_const,T,::boost::detail::is_const_rvalue_filter<T>::value) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_const,T&,false) - -#if defined(BOOST_ILLEGAL_CV_REFERENCES) -// these are illegal specialisations; cv-qualifies applied to -// references have no effect according to [8.3.2p1], -// C++ Builder requires them though as it treats cv-qualified -// references as distinct types... -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_const,T& const,false) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_const,T& volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_const,T& const volatile,false) -#endif + template <class T> + struct is_const : public false_type {}; + template <class T> struct is_const<T const> : public true_type{}; + template <class T, size_t N> struct is_const<T const[N]> : public true_type{}; + template <class T> struct is_const<T const[]> : public true_type{}; #endif } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_CONST_HPP_INCLUDED diff --git a/boost/type_traits/is_constructible.hpp b/boost/type_traits/is_constructible.hpp new file mode 100644 index 0000000000..20173172ce --- /dev/null +++ b/boost/type_traits/is_constructible.hpp @@ -0,0 +1,80 @@ + +// (C) Copyright John Maddock 2015. +// Use, modification and distribution are subject to 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_IS_CONSTRUCTIBLE_HPP_INCLUDED +#define BOOST_TT_IS_CONSTRUCTIBLE_HPP_INCLUDED + +#include <boost/type_traits/integral_constant.hpp> +#include <boost/detail/workaround.hpp> + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) && !BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40500) + +#include <boost/type_traits/is_destructible.hpp> +#include <boost/type_traits/is_default_constructible.hpp> +#include <boost/type_traits/detail/yes_no_type.hpp> +#include <boost/type_traits/declval.hpp> + +namespace boost{ + + namespace detail{ + + struct is_constructible_imp + { + template<typename T, typename ...TheArgs, typename = decltype(T(boost::declval<TheArgs>()...))> + static boost::type_traits::yes_type test(int); + template<typename, typename...> + static boost::type_traits::no_type test(...); + + template<typename T, typename Arg, typename = decltype(::new T(boost::declval<Arg>()))> + static boost::type_traits::yes_type test1(int); + template<typename, typename> + static boost::type_traits::no_type test1(...); + + template <typename T> + static boost::type_traits::yes_type ref_test(T); + template <typename T> + static boost::type_traits::no_type ref_test(...); + }; + + } + + template <class T, class ...Args> struct is_constructible : public integral_constant<bool, sizeof(detail::is_constructible_imp::test<T, Args...>(0)) == sizeof(boost::type_traits::yes_type)>{}; + template <class T, class Arg> struct is_constructible<T, Arg> : public integral_constant<bool, is_destructible<T>::value && sizeof(detail::is_constructible_imp::test1<T, Arg>(0)) == sizeof(boost::type_traits::yes_type)>{}; + template <class Ref, class Arg> struct is_constructible<Ref&, Arg> : public integral_constant<bool, sizeof(detail::is_constructible_imp::ref_test<Ref&>(boost::declval<Arg>())) == sizeof(boost::type_traits::yes_type)>{}; + template <class Ref, class Arg> struct is_constructible<Ref&&, Arg> : public integral_constant<bool, sizeof(detail::is_constructible_imp::ref_test<Ref&&>(boost::declval<Arg>())) == sizeof(boost::type_traits::yes_type)>{}; + + template <> struct is_constructible<void> : public false_type{}; + template <> struct is_constructible<void const> : public false_type{}; + template <> struct is_constructible<void const volatile> : public false_type{}; + template <> struct is_constructible<void volatile> : public false_type{}; + + template <class T> struct is_constructible<T> : public is_default_constructible<T>{}; + +#else + +#include <boost/type_traits/is_convertible.hpp> +#include <boost/type_traits/is_default_constructible.hpp> + +namespace boost{ + + // We don't know how to implement this: + template <class T, class U = void> struct is_constructible : public is_convertible<U, T>{}; + template <class T> struct is_constructible<T, void> : public is_default_constructible<T>{}; + template <> struct is_constructible<void, void> : public false_type{}; + template <> struct is_constructible<void const, void> : public false_type{}; + template <> struct is_constructible<void const volatile, void> : public false_type{}; + template <> struct is_constructible<void volatile, void> : public false_type{}; + template <class Ref> struct is_constructible<Ref&, void> : public false_type{}; +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + template <class Ref> struct is_constructible<Ref&&, void> : public false_type{}; +#endif +#endif + +} // namespace boost + +#endif // BOOST_TT_IS_CONSTRUCTIBLE_HPP_INCLUDED diff --git a/boost/type_traits/is_convertible.hpp b/boost/type_traits/is_convertible.hpp index a844cecb36..417ece20b4 100644 --- a/boost/type_traits/is_convertible.hpp +++ b/boost/type_traits/is_convertible.hpp @@ -13,14 +13,14 @@ #define BOOST_TT_IS_CONVERTIBLE_HPP_INCLUDED #include <boost/type_traits/intrinsics.hpp> +#include <boost/type_traits/integral_constant.hpp> #ifndef BOOST_IS_CONVERTIBLE #include <boost/type_traits/detail/yes_no_type.hpp> -#include <boost/type_traits/config.hpp> +#include <boost/type_traits/detail/config.hpp> #include <boost/type_traits/is_array.hpp> -#include <boost/type_traits/ice.hpp> #include <boost/type_traits/is_arithmetic.hpp> #include <boost/type_traits/is_void.hpp> -#ifndef BOOST_NO_IS_ABSTRACT +#if !defined(BOOST_NO_IS_ABSTRACT) #include <boost/type_traits/is_abstract.hpp> #endif #include <boost/type_traits/add_lvalue_reference.hpp> @@ -31,13 +31,13 @@ #include <boost/type_traits/remove_reference.hpp> #endif #if !defined(BOOST_NO_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) -# include <boost/utility/declval.hpp> +# include <boost/type_traits/declval.hpp> #endif +#elif defined(BOOST_MSVC) || defined(BOOST_INTEL) +#include <boost/type_traits/is_function.hpp> +#include <boost/type_traits/is_same.hpp> #endif // BOOST_IS_CONVERTIBLE -// should be always the last #include directive -#include <boost/type_traits/detail/bool_trait_def.hpp> - namespace boost { #ifndef BOOST_IS_CONVERTIBLE @@ -54,7 +54,7 @@ namespace boost { namespace detail { -#if !defined(BOOST_NO_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +#if !defined(BOOST_NO_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !(defined(BOOST_GCC) && (BOOST_GCC < 40700)) // This is a C++11 conforming version, place this first and use it wherever possible: @@ -300,13 +300,26 @@ struct is_convertible_basic_impl: // This version seems to work pretty well for a wide spectrum of compilers, // however it does rely on undefined behaviour by passing UDT's through (...). // + +//Workaround for old compilers like MSVC 7.1 to avoid +//forming a reference to an array of unknown bound +template <typename From> +struct is_convertible_basic_impl_add_lvalue_reference + : add_lvalue_reference<From> +{}; + +template <typename From> +struct is_convertible_basic_impl_add_lvalue_reference<From[]> +{ + typedef From type []; +}; + template <typename From, typename To> struct is_convertible_basic_impl { static ::boost::type_traits::no_type BOOST_TT_DECL _m_check(...); static ::boost::type_traits::yes_type BOOST_TT_DECL _m_check(To); - typedef typename add_lvalue_reference<From>::type lvalue_type; - typedef typename add_rvalue_reference<From>::type rvalue_type; + typedef typename is_convertible_basic_impl_add_lvalue_reference<From>::type lvalue_type; static lvalue_type _m_from; #ifdef BOOST_MSVC #pragma warning(push) @@ -316,6 +329,7 @@ struct is_convertible_basic_impl #endif #endif #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + typedef typename add_rvalue_reference<From>::type rvalue_type; BOOST_STATIC_CONSTANT(bool, value = sizeof( _m_check(static_cast<rvalue_type>(_m_from)) ) == sizeof(::boost::type_traits::yes_type) ); @@ -336,38 +350,15 @@ struct is_convertible_basic_impl template <typename From, typename To> struct is_convertible_impl { - enum { value = - (::boost::type_traits::ice_and< - ::boost::type_traits::ice_or< - ::boost::detail::is_convertible_basic_impl<From,To>::value, - ::boost::is_void<To>::value - >::value, - ::boost::type_traits::ice_not< - ::boost::is_array<To>::value - >::value, - ::boost::type_traits::ice_not< - ::boost::is_function<To>::value - >::value - >::value) }; + enum { + value = ( ::boost::detail::is_convertible_basic_impl<From,To>::value && ! ::boost::is_array<To>::value && ! ::boost::is_function<To>::value) + }; }; #elif !defined(__BORLANDC__) || __BORLANDC__ > 0x551 template <typename From, typename To> struct is_convertible_impl { - BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_and< - ::boost::type_traits::ice_or< - ::boost::detail::is_convertible_basic_impl<From,To>::value, - ::boost::is_void<To>::value - >::value, - ::boost::type_traits::ice_not< - ::boost::is_array<To>::value - >::value, - ::boost::type_traits::ice_not< - ::boost::is_function<To>::value - >::value - >::value) - ); + BOOST_STATIC_CONSTANT(bool, value = ( ::boost::detail::is_convertible_basic_impl<From, To>::value && !::boost::is_array<To>::value && !::boost::is_function<To>::value)); }; #endif @@ -443,52 +434,55 @@ struct is_convertible_impl_dispatch // implementation above: // #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -# define TT_AUX_BOOL_CV_VOID_TRAIT_SPEC2_PART1(trait,spec1,spec2,value) \ - BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC2(trait,spec1,spec2,value) \ - BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC2(trait,spec1,spec2 const,value) \ - BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC2(trait,spec1,spec2 volatile,value) \ - BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC2(trait,spec1,spec2 const volatile,value) \ - /**/ -# define TT_AUX_BOOL_CV_VOID_TRAIT_SPEC2(trait,spec1,spec2,value) \ - TT_AUX_BOOL_CV_VOID_TRAIT_SPEC2_PART1(trait,spec1,spec2,value) \ - TT_AUX_BOOL_CV_VOID_TRAIT_SPEC2_PART1(trait,spec1 const,spec2,value) \ - TT_AUX_BOOL_CV_VOID_TRAIT_SPEC2_PART1(trait,spec1 volatile,spec2,value) \ - TT_AUX_BOOL_CV_VOID_TRAIT_SPEC2_PART1(trait,spec1 const volatile,spec2,value) \ - /**/ +template <> struct is_convertible_impl_dispatch<void, void> : public true_type{}; +template <> struct is_convertible_impl_dispatch<void, void const> : public true_type{}; +template <> struct is_convertible_impl_dispatch<void, void const volatile> : public true_type{}; +template <> struct is_convertible_impl_dispatch<void, void volatile> : public true_type{}; + +template <> struct is_convertible_impl_dispatch<void const, void> : public true_type{}; +template <> struct is_convertible_impl_dispatch<void const, void const> : public true_type{}; +template <> struct is_convertible_impl_dispatch<void const, void const volatile> : public true_type{}; +template <> struct is_convertible_impl_dispatch<void const, void volatile> : public true_type{}; - TT_AUX_BOOL_CV_VOID_TRAIT_SPEC2(is_convertible,void,void,true) +template <> struct is_convertible_impl_dispatch<void const volatile, void> : public true_type{}; +template <> struct is_convertible_impl_dispatch<void const volatile, void const> : public true_type{}; +template <> struct is_convertible_impl_dispatch<void const volatile, void const volatile> : public true_type{}; +template <> struct is_convertible_impl_dispatch<void const volatile, void volatile> : public true_type{}; -# undef TT_AUX_BOOL_CV_VOID_TRAIT_SPEC2 -# undef TT_AUX_BOOL_CV_VOID_TRAIT_SPEC2_PART1 +template <> struct is_convertible_impl_dispatch<void volatile, void> : public true_type{}; +template <> struct is_convertible_impl_dispatch<void volatile, void const> : public true_type{}; +template <> struct is_convertible_impl_dispatch<void volatile, void const volatile> : public true_type{}; +template <> struct is_convertible_impl_dispatch<void volatile, void volatile> : public true_type{}; #else - BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC2(is_convertible,void,void,true) +template <> struct is_convertible_impl_dispatch<void, void> : public true_type{}; #endif // BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename To,is_convertible,void,To,false) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void,false) +template <class To> struct is_convertible_impl_dispatch<void, To> : public false_type{}; +template <class From> struct is_convertible_impl_dispatch<From, void> : public false_type{}; + #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename To,is_convertible,void const,To,false) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename To,is_convertible,void volatile,To,false) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename To,is_convertible,void const volatile,To,false) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void const volatile,false) +template <class To> struct is_convertible_impl_dispatch<void const, To> : public false_type{}; +template <class From> struct is_convertible_impl_dispatch<From, void const> : public false_type{}; +template <class To> struct is_convertible_impl_dispatch<void const volatile, To> : public false_type{}; +template <class From> struct is_convertible_impl_dispatch<From, void const volatile> : public false_type{}; +template <class To> struct is_convertible_impl_dispatch<void volatile, To> : public false_type{}; +template <class From> struct is_convertible_impl_dispatch<From, void volatile> : public false_type{}; #endif } // namespace detail -BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_convertible,From,To,(::boost::detail::is_convertible_impl_dispatch<From,To>::value)) +template <class From, class To> +struct is_convertible : public integral_constant<bool, ::boost::detail::is_convertible_impl_dispatch<From, To>::value> {}; #else -BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_convertible,From,To,BOOST_IS_CONVERTIBLE(From,To)) +template <class From, class To> +struct is_convertible : public integral_constant<bool, BOOST_IS_CONVERTIBLE(From, To)> {}; #endif } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_CONVERTIBLE_HPP_INCLUDED diff --git a/boost/type_traits/is_copy_assignable.hpp b/boost/type_traits/is_copy_assignable.hpp index 48af818849..76afdda5dd 100644 --- a/boost/type_traits/is_copy_assignable.hpp +++ b/boost/type_traits/is_copy_assignable.hpp @@ -18,7 +18,7 @@ && !defined(BOOST_INTEL_CXX_VERSION) && \ !(defined(BOOST_MSVC) && _MSC_VER == 1800) #define BOOST_TT_CXX11_IS_COPY_ASSIGNABLE -#include <boost/utility/declval.hpp> +#include <boost/type_traits/declval.hpp> #else //For compilers without decltype #include <boost/type_traits/is_const.hpp> @@ -27,10 +27,6 @@ #include <boost/type_traits/remove_reference.hpp> #endif - -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> - namespace boost { namespace detail{ @@ -132,16 +128,14 @@ struct is_copy_assignable_impl { } // namespace detail -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_copy_assignable,T,::boost::detail::is_copy_assignable_impl<T>::value) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_copy_assignable,void,false) +template <class T> struct is_copy_assignable : public integral_constant<bool, ::boost::detail::is_copy_assignable_impl<T>::value>{}; +template <> struct is_copy_assignable<void> : public false_type{}; #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_copy_assignable,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_copy_assignable,void const volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_copy_assignable,void volatile,false) +template <> struct is_copy_assignable<void const> : public false_type{}; +template <> struct is_copy_assignable<void const volatile> : public false_type{}; +template <> struct is_copy_assignable<void volatile> : public false_type{}; #endif } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_COPY_ASSIGNABLE_HPP_INCLUDED diff --git a/boost/type_traits/is_copy_constructible.hpp b/boost/type_traits/is_copy_constructible.hpp index 24f5eebc27..c68826431b 100644 --- a/boost/type_traits/is_copy_constructible.hpp +++ b/boost/type_traits/is_copy_constructible.hpp @@ -10,116 +10,178 @@ #define BOOST_TT_IS_COPY_CONSTRUCTIBLE_HPP_INCLUDED #include <boost/config.hpp> +#include <boost/detail/workaround.hpp> + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) && !BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40900) + +#include <boost/type_traits/is_constructible.hpp> + +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1800) + +namespace boost { + +template <class T> struct is_copy_constructible : public boost::is_constructible<T, const T&>{}; + +template <> struct is_copy_constructible<void> : public false_type{}; +template <> struct is_copy_constructible<void const> : public false_type{}; +template <> struct is_copy_constructible<void const volatile> : public false_type{}; +template <> struct is_copy_constructible<void volatile> : public false_type{}; + +} // namespace boost + +#else +// +// Special version for VC12 which has a problem when a base class (such as non_copyable) has a deleted +// copy constructor. In this case the compiler thinks there really is a copy-constructor and tries to +// instantiate the deleted member. std::is_copy_constructible has the same issue (or at least returns +// an incorrect value, which just defers the issue into the users code) as well. We can at least fix +// boost::non_copyable as a base class as a special case: +// +#include <boost/type_traits/is_base_and_derived.hpp> +#include <boost/noncopyable.hpp> + +namespace boost { + + namespace detail + { + + template <class T, bool b> struct is_copy_constructible_imp : public boost::is_constructible<T, const T&>{}; + template <class T> struct is_copy_constructible_imp<T, true> : public false_type{}; + + } + + template <class T> struct is_copy_constructible : public detail::is_copy_constructible_imp<T, is_base_and_derived<boost::noncopyable, T>::value>{}; + + template <> struct is_copy_constructible<void> : public false_type{}; + template <> struct is_copy_constructible<void const> : public false_type{}; + template <> struct is_copy_constructible<void const volatile> : public false_type{}; + template <> struct is_copy_constructible<void volatile> : public false_type{}; + +} // namespace boost + +#endif + +#else + #include <boost/type_traits/detail/yes_no_type.hpp> #include <boost/type_traits/is_base_and_derived.hpp> #include <boost/type_traits/add_reference.hpp> #include <boost/type_traits/is_rvalue_reference.hpp> -#include <boost/utility/declval.hpp> +#include <boost/type_traits/declval.hpp> +#include <boost/type_traits/is_array.hpp> +#include <boost/type_traits/declval.hpp> #include <boost/noncopyable.hpp> -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4181) +#endif namespace boost { -namespace detail{ + namespace detail{ -template <bool DerivedFromNoncopyable, class T> -struct is_copy_constructible_impl2 { + template <bool DerivedFromNoncopyable, class T> + struct is_copy_constructible_impl2 { -// Intel compiler has problems with SFINAE for copy constructors and deleted functions: -// -// error: function *function_name* cannot be referenced -- it is a deleted function -// static boost::type_traits::yes_type test(T1&, decltype(T1(boost::declval<T1&>()))* = 0); -// ^ -// -// MSVC 12.0 (Visual 2013) has problems when the copy constructor has been deleted. See: -// https://connect.microsoft.com/VisualStudio/feedback/details/800328/std-is-copy-constructible-is-broken + // Intel compiler has problems with SFINAE for copy constructors and deleted functions: + // + // error: function *function_name* cannot be referenced -- it is a deleted function + // static boost::type_traits::yes_type test(T1&, decltype(T1(boost::declval<T1&>()))* = 0); + // ^ + // + // MSVC 12.0 (Visual 2013) has problems when the copy constructor has been deleted. See: + // https://connect.microsoft.com/VisualStudio/feedback/details/800328/std-is-copy-constructible-is-broken #if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) && !defined(BOOST_INTEL_CXX_VERSION) && !(defined(BOOST_MSVC) && _MSC_VER == 1800) #ifdef BOOST_NO_CXX11_DECLTYPE - template <class T1> - static boost::type_traits::yes_type test(T1&, boost::mpl::int_<sizeof(T1(boost::declval<T1&>()))>* = 0); + template <class T1> + static boost::type_traits::yes_type test(const T1&, boost::mpl::int_<sizeof(T1(boost::declval<const T1&>()))>* = 0); #else - template <class T1> - static boost::type_traits::yes_type test(T1&, decltype(T1(boost::declval<T1&>()))* = 0); + template <class T1> + static boost::type_traits::yes_type test(const T1&, decltype(T1(boost::declval<const T1&>()))* = 0); #endif - static boost::type_traits::no_type test(...); + static boost::type_traits::no_type test(...); #else - template <class T1> - static boost::type_traits::no_type test(T1&, typename T1::boost_move_no_copy_constructor_or_assign* = 0); - static boost::type_traits::yes_type test(...); + template <class T1> + static boost::type_traits::no_type test(const T1&, typename T1::boost_move_no_copy_constructor_or_assign* = 0); + static boost::type_traits::yes_type test(...); #endif - // If you see errors like this: - // - // `'T::T(const T&)' is private` - // `boost/type_traits/is_copy_constructible.hpp:68:5: error: within this context` - // - // then you are trying to call that macro for a structure defined like that: - // - // struct T { - // ... - // private: - // T(const T &); - // ... - // }; - // - // To fix that you must modify your structure: - // - // // C++03 and C++11 version - // struct T: private boost::noncopyable { - // ... - // private: - // T(const T &); - // ... - // }; - // - // // C++11 version - // struct T { - // ... - // private: - // T(const T &) = delete; - // ... - // }; - BOOST_STATIC_CONSTANT(bool, value = ( + // If you see errors like this: + // + // `'T::T(const T&)' is private` + // `boost/type_traits/is_copy_constructible.hpp:68:5: error: within this context` + // + // then you are trying to call that macro for a structure defined like that: + // + // struct T { + // ... + // private: + // T(const T &); + // ... + // }; + // + // To fix that you must modify your structure: + // + // // C++03 and C++11 version + // struct T: private boost::noncopyable { + // ... + // private: + // T(const T &); + // ... + // }; + // + // // C++11 version + // struct T { + // ... + // private: + // T(const T &) = delete; + // ... + // }; + BOOST_STATIC_CONSTANT(bool, value = ( sizeof(test( - boost::declval<BOOST_DEDUCED_TYPENAME boost::add_reference<T>::type>() + boost::declval<BOOST_DEDUCED_TYPENAME boost::add_reference<T const>::type>() )) == sizeof(boost::type_traits::yes_type) - || - boost::is_rvalue_reference<T>::value - )); -}; - -template <class T> -struct is_copy_constructible_impl2<true, T> { - BOOST_STATIC_CONSTANT(bool, value = false); -}; - -template <class T> -struct is_copy_constructible_impl { - - BOOST_STATIC_CONSTANT(bool, value = ( - boost::detail::is_copy_constructible_impl2< + && + !boost::is_rvalue_reference<T>::value + && !boost::is_array<T>::value + )); + }; + + template <class T> + struct is_copy_constructible_impl2<true, T> { + BOOST_STATIC_CONSTANT(bool, value = false); + }; + + template <class T> + struct is_copy_constructible_impl { + + BOOST_STATIC_CONSTANT(bool, value = ( + boost::detail::is_copy_constructible_impl2< boost::is_base_and_derived<boost::noncopyable, T>::value, T - >::value - )); -}; + >::value + )); + }; -} // namespace detail + } // namespace detail -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_copy_constructible,T,::boost::detail::is_copy_constructible_impl<T>::value) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_copy_constructible,void,false) + template <class T> struct is_copy_constructible : public integral_constant<bool, ::boost::detail::is_copy_constructible_impl<T>::value>{}; + template <> struct is_copy_constructible<void> : public false_type{}; #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_copy_constructible,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_copy_constructible,void const volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_copy_constructible,void volatile,false) + template <> struct is_copy_constructible<void const> : public false_type{}; + template <> struct is_copy_constructible<void volatile> : public false_type{}; + template <> struct is_copy_constructible<void const volatile> : public false_type{}; #endif } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif #endif // BOOST_TT_IS_COPY_CONSTRUCTIBLE_HPP_INCLUDED diff --git a/boost/type_traits/is_default_constructible.hpp b/boost/type_traits/is_default_constructible.hpp new file mode 100644 index 0000000000..7fd63f8969 --- /dev/null +++ b/boost/type_traits/is_default_constructible.hpp @@ -0,0 +1,64 @@ + +// (C) Copyright John Maddock 2015. +// Use, modification and distribution are subject to 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_IS_DEFAULT_CONSTRUCTIBLE_HPP_INCLUDED +#define BOOST_TT_IS_DEFAULT_CONSTRUCTIBLE_HPP_INCLUDED + +#include <boost/type_traits/integral_constant.hpp> +#include <boost/detail/workaround.hpp> + +#if !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) && !BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40500) + +#include <boost/type_traits/detail/yes_no_type.hpp> + +namespace boost{ + + namespace detail{ + + struct is_default_constructible_imp + { + template<typename _Tp, typename = decltype(_Tp())> + static boost::type_traits::yes_type test(int); + + template<typename> + static boost::type_traits::no_type test(...); + }; + + } + + template <class T> struct is_default_constructible : public integral_constant<bool, sizeof(detail::is_default_constructible_imp::test<T>(0)) == sizeof(boost::type_traits::yes_type)>{}; + template <class T, std::size_t N> struct is_default_constructible<T[N]> : public is_default_constructible<T>{}; + template <class T> struct is_default_constructible<T[]> : public is_default_constructible<T>{}; + template <class T> struct is_default_constructible<T&> : public integral_constant<bool, false>{}; +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + template <class T> struct is_default_constructible<T&&> : public integral_constant<bool, false>{}; +#endif + template <> struct is_default_constructible<void> : public integral_constant<bool, false>{}; + template <> struct is_default_constructible<void const> : public integral_constant<bool, false>{}; + template <> struct is_default_constructible<void volatile> : public integral_constant<bool, false>{}; + template <> struct is_default_constructible<void const volatile> : public integral_constant<bool, false>{}; + +#else + +#include <boost/type_traits/is_pod.hpp> + +namespace boost{ + + // We don't know how to implement this, note we can not use has_trivial_constructor here + // because the correct implementation of that trait requires this one: + template <class T> struct is_default_constructible : public is_pod<T>{}; + template <> struct is_default_constructible<void> : public integral_constant<bool, false>{}; + template <> struct is_default_constructible<void const> : public integral_constant<bool, false>{}; + template <> struct is_default_constructible<void volatile> : public integral_constant<bool, false>{}; + template <> struct is_default_constructible<void const volatile> : public integral_constant<bool, false>{}; + +#endif + +} // namespace boost + +#endif // BOOST_TT_IS_DEFAULT_CONSTRUCTIBLE_HPP_INCLUDED diff --git a/boost/type_traits/is_destructible.hpp b/boost/type_traits/is_destructible.hpp new file mode 100644 index 0000000000..9f1e5d9817 --- /dev/null +++ b/boost/type_traits/is_destructible.hpp @@ -0,0 +1,60 @@ + +// (C) Copyright John Maddock 2015. +// Use, modification and distribution are subject to 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_IS_DESTRUCTIBLE_HPP_INCLUDED +#define BOOST_TT_IS_DESTRUCTIBLE_HPP_INCLUDED + +#include <boost/type_traits/integral_constant.hpp> +#include <boost/detail/workaround.hpp> + +#if !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) + +#include <boost/type_traits/detail/yes_no_type.hpp> +#include <boost/type_traits/declval.hpp> + +namespace boost{ + + namespace detail{ + + struct is_destructible_imp + { + template<typename T, typename = decltype(boost::declval<T&>().~T())> + static boost::type_traits::yes_type test(int); + template<typename> + static boost::type_traits::no_type test(...); + }; + + } + + template <class T> struct is_destructible : public integral_constant<bool, sizeof(detail::is_destructible_imp::test<T>(0)) == sizeof(boost::type_traits::yes_type)>{}; + +#else + +#include <boost/type_traits/is_pod.hpp> +#include <boost/type_traits/is_class.hpp> + +namespace boost{ + + // We don't know how to implement this: + template <class T> struct is_destructible : public integral_constant<bool, is_pod<T>::value || is_class<T>::value>{}; +#endif + + template <> struct is_destructible<void> : public false_type{}; + template <> struct is_destructible<void const> : public false_type{}; + template <> struct is_destructible<void volatile> : public false_type{}; + template <> struct is_destructible<void const volatile> : public false_type{}; + template <class T> struct is_destructible<T&> : public is_destructible<T>{}; +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + template <class T> struct is_destructible<T&&> : public is_destructible<T>{}; +#endif + template <class T, std::size_t N> struct is_destructible<T[N]> : public is_destructible<T>{}; + template <class T> struct is_destructible<T[]> : public is_destructible<T>{}; + +} // namespace boost + +#endif // BOOST_TT_IS_DESTRUCTIBLE_HPP_INCLUDED diff --git a/boost/type_traits/is_empty.hpp b/boost/type_traits/is_empty.hpp index adb239ee24..ef288c518b 100644 --- a/boost/type_traits/is_empty.hpp +++ b/boost/type_traits/is_empty.hpp @@ -10,16 +10,12 @@ #define BOOST_TT_IS_EMPTY_HPP_INCLUDED #include <boost/type_traits/is_convertible.hpp> -#include <boost/type_traits/detail/ice_or.hpp> -#include <boost/type_traits/config.hpp> +#include <boost/type_traits/detail/config.hpp> #include <boost/type_traits/intrinsics.hpp> -# include <boost/type_traits/remove_cv.hpp> -# include <boost/type_traits/is_class.hpp> -# include <boost/type_traits/add_reference.hpp> - -// should be always the last #include directive -#include <boost/type_traits/detail/bool_trait_def.hpp> +#include <boost/type_traits/remove_cv.hpp> +#include <boost/type_traits/is_class.hpp> +#include <boost/type_traits/add_reference.hpp> #ifndef BOOST_INTERNAL_IS_EMPTY #define BOOST_INTERNAL_IS_EMPTY(T) false @@ -75,12 +71,8 @@ struct is_empty_impl { typedef typename remove_cv<T>::type cvt; BOOST_STATIC_CONSTANT( - bool, value = ( - ::boost::type_traits::ice_or< - ::boost::detail::empty_helper<cvt,::boost::is_class<T>::value>::value - , BOOST_INTERNAL_IS_EMPTY(cvt) - >::value - )); + bool, + value = ( ::boost::detail::empty_helper<cvt,::boost::is_class<T>::value>::value || BOOST_INTERNAL_IS_EMPTY(cvt))); }; #else // __BORLANDC__ @@ -107,35 +99,21 @@ struct is_empty_impl BOOST_STATIC_CONSTANT( bool, value = ( - ::boost::type_traits::ice_or< ::boost::detail::empty_helper< cvt , ::boost::is_class<T>::value , ::boost::is_convertible< r_type,int>::value - >::value - , BOOST_INTERNAL_IS_EMPTY(cvt) - >::value)); + >::value || BOOST_INTERNAL_IS_EMPTY(cvt)); }; #endif // __BORLANDC__ - -// these help when the compiler has no partial specialization support: -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_empty,void,false) -#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_empty,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_empty,void volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_empty,void const volatile,false) -#endif - } // namespace detail -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_empty,T,::boost::detail::is_empty_impl<T>::value) +template <class T> struct is_empty : integral_constant<bool, ::boost::detail::is_empty_impl<T>::value> {}; } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #undef BOOST_INTERNAL_IS_EMPTY #endif // BOOST_TT_IS_EMPTY_HPP_INCLUDED diff --git a/boost/type_traits/is_enum.hpp b/boost/type_traits/is_enum.hpp index 7929c962a5..eada480a65 100644 --- a/boost/type_traits/is_enum.hpp +++ b/boost/type_traits/is_enum.hpp @@ -12,6 +12,7 @@ #define BOOST_TT_IS_ENUM_HPP_INCLUDED #include <boost/type_traits/intrinsics.hpp> +#include <boost/type_traits/integral_constant.hpp> #ifndef BOOST_IS_ENUM #include <boost/type_traits/add_reference.hpp> #include <boost/type_traits/is_arithmetic.hpp> @@ -21,16 +22,13 @@ #ifdef __GNUC__ #include <boost/type_traits/is_function.hpp> #endif -#include <boost/type_traits/config.hpp> +#include <boost/type_traits/detail/config.hpp> #if defined(BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION) # include <boost/type_traits/is_class.hpp> # include <boost/type_traits/is_union.hpp> #endif #endif -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> - namespace boost { #ifndef BOOST_IS_ENUM @@ -43,11 +41,7 @@ namespace detail { template <typename T> struct is_class_or_union { - BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_or< - ::boost::is_class<T>::value - , ::boost::is_union<T>::value - >::value)); + BOOST_STATIC_CONSTANT(bool, value = ::boost::is_class<T>::value || ::boost::is_union<T>::value); }; #else @@ -94,8 +88,8 @@ template <> struct is_enum_helper<false> { template <typename T> struct type - : public ::boost::is_convertible<typename boost::add_reference<T>::type,::boost::detail::int_convertible> { + static const bool value = ::boost::is_convertible<typename boost::add_reference<T>::type, ::boost::detail::int_convertible>::value; }; }; @@ -112,34 +106,28 @@ template <typename T> struct is_enum_impl // order to correctly deduce that noncopyable types are not enums // (dwa 2002/04/15)... BOOST_STATIC_CONSTANT(bool, selector = - (::boost::type_traits::ice_or< ::boost::is_arithmetic<T>::value - , ::boost::is_reference<T>::value - , ::boost::is_function<T>::value - , is_class_or_union<T>::value - , is_array<T>::value - >::value)); + || ::boost::is_reference<T>::value + || ::boost::is_function<T>::value + || is_class_or_union<T>::value + || is_array<T>::value); #else // ...however, not checking is_class_or_union on non-conforming // compilers prevents a dependency recursion. BOOST_STATIC_CONSTANT(bool, selector = - (::boost::type_traits::ice_or< ::boost::is_arithmetic<T>::value - , ::boost::is_reference<T>::value - , ::boost::is_function<T>::value - , is_array<T>::value - >::value)); + || ::boost::is_reference<T>::value + || ::boost::is_function<T>::value + || is_array<T>::value); #endif // BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION #else // !defined(__GNUC__): BOOST_STATIC_CONSTANT(bool, selector = - (::boost::type_traits::ice_or< ::boost::is_arithmetic<T>::value - , ::boost::is_reference<T>::value - , is_class_or_union<T>::value - , is_array<T>::value - >::value)); + || ::boost::is_reference<T>::value + || is_class_or_union<T>::value + || is_array<T>::value); #endif @@ -155,34 +143,24 @@ template <typename T> struct is_enum_impl BOOST_STATIC_CONSTANT(bool, value = helper::value); }; -// these help on compilers with no partial specialization support: -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_enum,void,false) -#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_enum,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_enum,void volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_enum,void const volatile,false) -#endif - } // namespace detail -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_enum,T,::boost::detail::is_enum_impl<T>::value) +template <class T> struct is_enum : public integral_constant<bool, ::boost::detail::is_enum_impl<T>::value> {}; #else // __BORLANDC__ // // buggy is_convertible prevents working // implementation of is_enum: -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_enum,T,false) +template <class T> struct is_enum : public integral_constant<bool, false> {}; #endif #else // BOOST_IS_ENUM -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_enum,T,BOOST_IS_ENUM(T)) +template <class T> struct is_enum : public integral_constant<bool, BOOST_IS_ENUM(T)> {}; #endif } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_ENUM_HPP_INCLUDED diff --git a/boost/type_traits/is_final.hpp b/boost/type_traits/is_final.hpp index 36bd62e54a..410d18663b 100644 --- a/boost/type_traits/is_final.hpp +++ b/boost/type_traits/is_final.hpp @@ -11,31 +11,20 @@ #ifndef BOOST_TT_IS_FINAL_HPP_INCLUDED #define BOOST_TT_IS_FINAL_HPP_INCLUDED -#include <boost/type_traits/remove_cv.hpp> -#include <boost/type_traits/config.hpp> #include <boost/type_traits/intrinsics.hpp> - -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#include <boost/type_traits/integral_constant.hpp> +#ifdef BOOST_IS_FINAL +#include <boost/type_traits/remove_cv.hpp> +#endif namespace boost { -namespace detail { -template <typename T> struct is_final_impl -{ #ifdef BOOST_IS_FINAL - typedef typename remove_cv<T>::type cvt; - BOOST_STATIC_CONSTANT(bool, value = BOOST_IS_FINAL(cvt)); +template <class T> struct is_final : public integral_constant<bool, BOOST_IS_FINAL(typename remove_cv<T>::type)> {}; #else - BOOST_STATIC_CONSTANT(bool, value = false); +template <class T> struct is_final : public integral_constant<bool, false> {}; #endif -}; -} // namespace detail - -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_final,T,::boost::detail::is_final_impl<T>::value) } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_FINAL_HPP_INCLUDED diff --git a/boost/type_traits/is_float.hpp b/boost/type_traits/is_float.hpp index 25d16f1800..7bf7d1f820 100644 --- a/boost/type_traits/is_float.hpp +++ b/boost/type_traits/is_float.hpp @@ -1,4 +1,3 @@ - // (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. // Use, modification and distribution are subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -10,18 +9,12 @@ #define BOOST_TYPE_TRAITS_IS_FLOAT_HPP_INCLUDED // should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#include <boost/type_traits/is_floating_point.hpp> namespace boost { //* is a type T a floating-point type described in the standard (3.9.1p8) -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_float,T,false) -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_float,float,true) -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_float,double,true) -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_float,long double,true) - + template <class T> struct is_float : public is_floating_point<T> {}; } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TYPE_TRAITS_IS_FLOAT_HPP_INCLUDED diff --git a/boost/type_traits/is_floating_point.hpp b/boost/type_traits/is_floating_point.hpp index 2224453054..196c900cf9 100755..100644 --- a/boost/type_traits/is_floating_point.hpp +++ b/boost/type_traits/is_floating_point.hpp @@ -1,4 +1,3 @@ - // (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000-2005. // Use, modification and distribution are subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -9,19 +8,23 @@ #ifndef BOOST_TYPE_TRAITS_IS_FLOATING_HPP_INCLUDED #define BOOST_TYPE_TRAITS_IS_FLOATING_HPP_INCLUDED -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#include <boost/type_traits/integral_constant.hpp> namespace boost { //* is a type T a floating-point type described in the standard (3.9.1p8) -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_floating_point,T,false) -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_floating_point,float,true) -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_floating_point,double,true) -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_floating_point,long double,true) + template <class T> struct is_floating_point : public false_type{}; + template <class T> struct is_floating_point<const T> : public is_floating_point<T>{}; + template <class T> struct is_floating_point<volatile const T> : public is_floating_point<T>{}; + template <class T> struct is_floating_point<volatile T> : public is_floating_point<T>{}; + template<> struct is_floating_point<float> : public true_type{}; + template<> struct is_floating_point<double> : public true_type{}; + template<> struct is_floating_point<long double> : public true_type{}; + +#if defined(BOOST_HAS_FLOAT128) + template<> struct is_floating_point<__float128> : public true_type{}; +#endif } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TYPE_TRAITS_IS_FLOAT_HPP_INCLUDED diff --git a/boost/type_traits/is_function.hpp b/boost/type_traits/is_function.hpp index eeb4382010..f77c1f0469 100644 --- a/boost/type_traits/is_function.hpp +++ b/boost/type_traits/is_function.hpp @@ -12,8 +12,7 @@ #define BOOST_TT_IS_FUNCTION_HPP_INCLUDED #include <boost/type_traits/is_reference.hpp> -#include <boost/type_traits/detail/false_result.hpp> -#include <boost/config.hpp> +#include <boost/type_traits/detail/config.hpp> #if !defined(BOOST_TT_TEST_MS_FUNC_SIGS) # include <boost/type_traits/detail/is_function_ptr_helper.hpp> @@ -22,9 +21,6 @@ # include <boost/type_traits/detail/yes_no_type.hpp> #endif -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> - // is a type a function? // Please note that this implementation is unnecessarily complex: // we could just use !is_convertible<T*, const volatile void*>::value, @@ -40,17 +36,16 @@ namespace detail { #if !defined(BOOST_TT_TEST_MS_FUNC_SIGS) template<bool is_ref = true> struct is_function_chooser - : public ::boost::type_traits::false_result { + template< typename T > struct result_ + : public false_type {}; }; template <> struct is_function_chooser<false> { template< typename T > struct result_ - : public ::boost::type_traits::is_function_ptr_helper<T*> - { - }; + : public ::boost::type_traits::is_function_ptr_helper<T*> {}; }; template <typename T> @@ -95,15 +90,13 @@ struct is_function_impl<T&&> : public false_type #endif // !defined( __CODEGEARC__ ) #if defined( __CODEGEARC__ ) -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_function,T,__is_function(T)) +template <class T> struct is_function : integral_constant<bool, __is_function(T)> {}; #else -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_function,T,::boost::detail::is_function_impl<T>::value) +template <class T> struct is_function : integral_constant<bool, ::boost::detail::is_function_impl<T>::value> {}; #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_function,T&&,false) +template <class T> struct is_function<T&&> : public false_type {}; #endif #endif } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_FUNCTION_HPP_INCLUDED diff --git a/boost/type_traits/is_fundamental.hpp b/boost/type_traits/is_fundamental.hpp index 138e296887..f58767a489 100644 --- a/boost/type_traits/is_fundamental.hpp +++ b/boost/type_traits/is_fundamental.hpp @@ -11,35 +11,16 @@ #include <boost/type_traits/is_arithmetic.hpp> #include <boost/type_traits/is_void.hpp> -#include <boost/type_traits/detail/ice_or.hpp> - -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { -namespace detail { - -template <typename T> -struct is_fundamental_impl - : public ::boost::type_traits::ice_or< - ::boost::is_arithmetic<T>::value - , ::boost::is_void<T>::value - > -{ -}; - -} // namespace detail - //* is a type T a fundamental type described in the standard (3.9.1) #if defined( __CODEGEARC__ ) -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_fundamental,T,__is_fundamental(T)) +template <class T> struct is_fundamental : public integral_constant<bool, __is_fundamental(T)> {}; #else -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_fundamental,T,::boost::detail::is_fundamental_impl<T>::value) +template <class T> struct is_fundamental : public integral_constant<bool, ::boost::is_arithmetic<T>::value || ::boost::is_void<T>::value> {}; #endif } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_FUNDAMENTAL_HPP_INCLUDED diff --git a/boost/type_traits/is_integral.hpp b/boost/type_traits/is_integral.hpp index 6bfad49d39..7a7e54bb70 100644 --- a/boost/type_traits/is_integral.hpp +++ b/boost/type_traits/is_integral.hpp @@ -10,79 +10,80 @@ #define BOOST_TT_IS_INTEGRAL_HPP_INCLUDED #include <boost/config.hpp> - -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#include <boost/type_traits/integral_constant.hpp> namespace boost { -//* is a type T an [cv-qualified-] integral type described in the standard (3.9.1p3) -// as an extension we include long long, as this is likely to be added to the -// standard at a later date #if defined( __CODEGEARC__ ) -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_integral,T,__is_integral(T)) + template <class T> + struct is_integral : public integral_constant<bool, __is_integral(T)> {}; #else -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_integral,T,false) -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,unsigned char,true) -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,unsigned short,true) -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,unsigned int,true) -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,unsigned long,true) +template <class T> struct is_integral : public false_type {}; +template <class T> struct is_integral<const T> : public is_integral<T> {}; +template <class T> struct is_integral<volatile const T> : public is_integral<T>{}; +template <class T> struct is_integral<volatile T> : public is_integral<T>{}; -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,signed char,true) -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,signed short,true) -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,signed int,true) -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,signed long,true) +//* is a type T an [cv-qualified-] integral type described in the standard (3.9.1p3) +// as an extension we include long long, as this is likely to be added to the +// standard at a later date +template<> struct is_integral<unsigned char> : public true_type {}; +template<> struct is_integral<unsigned short> : public true_type{}; +template<> struct is_integral<unsigned int> : public true_type{}; +template<> struct is_integral<unsigned long> : public true_type{}; -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,bool,true) -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,char,true) +template<> struct is_integral<signed char> : public true_type{}; +template<> struct is_integral<short> : public true_type{}; +template<> struct is_integral<int> : public true_type{}; +template<> struct is_integral<long> : public true_type{}; + +template<> struct is_integral<char> : public true_type{}; +template<> struct is_integral<bool> : public true_type{}; #ifndef BOOST_NO_INTRINSIC_WCHAR_T // If the following line fails to compile and you're using the Intel // compiler, see http://lists.boost.org/MailArchives/boost-users/msg06567.php, // and define BOOST_NO_INTRINSIC_WCHAR_T on the command line. -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,wchar_t,true) +template<> struct is_integral<wchar_t> : public true_type{}; #endif // Same set of integral types as in boost/type_traits/integral_promotion.hpp. // Please, keep in sync. -- Alexander Nasonov #if (defined(BOOST_INTEL_CXX_VERSION) && defined(_MSC_VER) && (BOOST_INTEL_CXX_VERSION <= 600)) \ || (defined(__BORLANDC__) && (__BORLANDC__ == 0x600) && (_MSC_VER < 1300)) -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,unsigned __int8,true) -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,__int8,true) -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,unsigned __int16,true) -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,__int16,true) -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,unsigned __int32,true) -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,__int32,true) +template<> struct is_integral<unsigned __int8> : public true_type{}; +template<> struct is_integral<unsigned __int16> : public true_type{}; +template<> struct is_integral<unsigned __int32> : public true_type{}; +template<> struct is_integral<__int8> : public true_type{}; +template<> struct is_integral<__int16> : public true_type{}; +template<> struct is_integral<__int32> : public true_type{}; #ifdef __BORLANDC__ -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,unsigned __int64,true) -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,__int64,true) +template<> struct is_integral<unsigned __int64> : public true_type{}; +template<> struct is_integral<__int64> : public true_type{}; #endif #endif # if defined(BOOST_HAS_LONG_LONG) -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral, ::boost::ulong_long_type,true) -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral, ::boost::long_long_type,true) +template<> struct is_integral< ::boost::ulong_long_type> : public true_type{}; +template<> struct is_integral< ::boost::long_long_type> : public true_type{}; #elif defined(BOOST_HAS_MS_INT64) -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,unsigned __int64,true) -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,__int64,true) +template<> struct is_integral<unsigned __int64> : public true_type{}; +template<> struct is_integral<__int64> : public true_type{}; #endif #ifdef BOOST_HAS_INT128 -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,boost::int128_type,true) -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,boost::uint128_type,true) +template<> struct is_integral<boost::int128_type> : public true_type{}; +template<> struct is_integral<boost::uint128_type> : public true_type{}; #endif #ifndef BOOST_NO_CXX11_CHAR16_T -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,char16_t,true) +template<> struct is_integral<char16_t> : public true_type{}; #endif #ifndef BOOST_NO_CXX11_CHAR32_T -BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,char32_t,true) +template<> struct is_integral<char32_t> : public true_type{}; #endif #endif // non-CodeGear implementation } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_INTEGRAL_HPP_INCLUDED diff --git a/boost/type_traits/is_lvalue_reference.hpp b/boost/type_traits/is_lvalue_reference.hpp index 0b0130ab2d..e94d787481 100644 --- a/boost/type_traits/is_lvalue_reference.hpp +++ b/boost/type_traits/is_lvalue_reference.hpp @@ -21,36 +21,30 @@ #ifndef BOOST_TT_IS_LVALUE_REFERENCE_HPP_INCLUDED #define BOOST_TT_IS_LVALUE_REFERENCE_HPP_INCLUDED -#include <boost/type_traits/config.hpp> - - -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#include <boost/type_traits/integral_constant.hpp> namespace boost { #if defined( __CODEGEARC__ ) -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_lvalue_reference,T,__is_reference(T)) + template <class T> struct is_lvalue_reference : public integral_constant<bool, __is_reference(T)>{}; #else -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_lvalue_reference,T,false) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_lvalue_reference,T&,true) + template <class T> struct is_lvalue_reference : public false_type{}; + template <class T> struct is_lvalue_reference<T&> : public true_type{}; #if defined(BOOST_ILLEGAL_CV_REFERENCES) // these are illegal specialisations; cv-qualifies applied to // references have no effect according to [8.3.2p1], // C++ Builder requires them though as it treats cv-qualified // references as distinct types... -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_lvalue_reference,T& const,true) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_lvalue_reference,T& volatile,true) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_lvalue_reference,T& const volatile,true) + template <class T> struct is_lvalue_reference<T&const> : public true_type{}; + template <class T> struct is_lvalue_reference<T&volatile> : public true_type{}; + template <class T> struct is_lvalue_reference<T&const volatile> : public true_type{}; #endif #endif } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_REFERENCE_HPP_INCLUDED diff --git a/boost/type_traits/is_member_function_pointer.hpp b/boost/type_traits/is_member_function_pointer.hpp index d1c3690ba7..223197f333 100644 --- a/boost/type_traits/is_member_function_pointer.hpp +++ b/boost/type_traits/is_member_function_pointer.hpp @@ -11,7 +11,7 @@ #ifndef BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED #define BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED -#include <boost/type_traits/config.hpp> +#include <boost/type_traits/detail/config.hpp> #include <boost/detail/workaround.hpp> #if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(BOOST_TT_TEST_MS_FUNC_SIGS) @@ -22,29 +22,22 @@ // # include <boost/type_traits/detail/is_mem_fun_pointer_impl.hpp> # include <boost/type_traits/remove_cv.hpp> +# include <boost/type_traits/integral_constant.hpp> #else # include <boost/type_traits/is_reference.hpp> # include <boost/type_traits/is_array.hpp> # include <boost/type_traits/detail/yes_no_type.hpp> -# include <boost/type_traits/detail/false_result.hpp> -# include <boost/type_traits/detail/ice_or.hpp> # include <boost/type_traits/detail/is_mem_fun_pointer_tester.hpp> #endif -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> - namespace boost { #if defined( __CODEGEARC__ ) -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_function_pointer,T,__is_member_function_pointer( T )) +template <class T> struct is_member_function_pointer : public integral_constant<bool, __is_member_function_pointer( T )> {}; #elif !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(BOOST_TT_TEST_MS_FUNC_SIGS) -BOOST_TT_AUX_BOOL_TRAIT_DEF1( - is_member_function_pointer - , T - , ::boost::type_traits::is_mem_fun_pointer_impl<typename remove_cv<T>::type>::value - ) +template <class T> struct is_member_function_pointer + : public ::boost::integral_constant<bool, ::boost::type_traits::is_mem_fun_pointer_impl<typename remove_cv<T>::type>::value>{}; #else @@ -54,8 +47,8 @@ namespace detail { template <bool> struct is_mem_fun_pointer_select - : public ::boost::type_traits::false_result { + template <class T> struct result_ : public false_type{}; }; template <> @@ -82,14 +75,8 @@ struct is_mem_fun_pointer_select<false> template <typename T> struct is_member_function_pointer_impl - : public is_mem_fun_pointer_select< - ::boost::type_traits::ice_or< - ::boost::is_reference<T>::value - , ::boost::is_array<T>::value - >::value - >::template result_<T> -{ -}; + : public is_mem_fun_pointer_select< + ::boost::is_reference<T>::value || ::boost::is_array<T>::value>::template result_<T>{}; template <typename T> struct is_member_function_pointer_impl<T&> : public false_type{}; @@ -113,21 +100,21 @@ struct is_member_function_pointer_impl<T&> #endif -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_function_pointer,void,false) +template<> struct is_member_function_pointer_impl<void> : public false_type{}; #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_function_pointer,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_function_pointer,void volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_function_pointer,void const volatile,false) +template<> struct is_member_function_pointer_impl<void const> : public false_type{}; +template<> struct is_member_function_pointer_impl<void const volatile> : public false_type{}; +template<> struct is_member_function_pointer_impl<void volatile> : public false_type{}; #endif } // namespace detail -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_function_pointer,T,::boost::detail::is_member_function_pointer_impl<T>::value) +template <class T> +struct is_member_function_pointer + : public integral_constant<bool, ::boost::detail::is_member_function_pointer_impl<T>::value>{}; #endif } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/boost/type_traits/is_member_object_pointer.hpp b/boost/type_traits/is_member_object_pointer.hpp index 66b76c90b3..cb7cf14abf 100755..100644 --- a/boost/type_traits/is_member_object_pointer.hpp +++ b/boost/type_traits/is_member_object_pointer.hpp @@ -10,37 +10,15 @@ #ifndef BOOST_TT_IS_MEMBER_OBJECT_POINTER_HPP_INCLUDED #define BOOST_TT_IS_MEMBER_OBJECT_POINTER_HPP_INCLUDED -#include <boost/type_traits/config.hpp> #include <boost/type_traits/is_member_pointer.hpp> #include <boost/type_traits/is_member_function_pointer.hpp> -#include <boost/type_traits/detail/ice_and.hpp> -#include <boost/type_traits/detail/ice_not.hpp> - -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { -namespace detail{ - -template <typename T> -struct is_member_object_pointer_impl -{ - BOOST_STATIC_CONSTANT( - bool, value = (::boost::type_traits::ice_and< - ::boost::is_member_pointer<T>::value, - ::boost::type_traits::ice_not< - ::boost::is_member_function_pointer<T>::value - >::value - >::value )); -}; - -} // namespace detail - -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_object_pointer,T,::boost::detail::is_member_object_pointer_impl<T>::value) +template <class T> struct is_member_object_pointer + : public integral_constant<bool, + ::boost::is_member_pointer<T>::value && !::boost::is_member_function_pointer<T>::value>{}; } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/boost/type_traits/is_member_pointer.hpp b/boost/type_traits/is_member_pointer.hpp index cba31af0c2..9757afc950 100644 --- a/boost/type_traits/is_member_pointer.hpp +++ b/boost/type_traits/is_member_pointer.hpp @@ -21,45 +21,25 @@ #ifndef BOOST_TT_IS_MEMBER_POINTER_HPP_INCLUDED #define BOOST_TT_IS_MEMBER_POINTER_HPP_INCLUDED -#include <boost/type_traits/config.hpp> #include <boost/detail/workaround.hpp> - -#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) -# include <boost/type_traits/is_member_function_pointer.hpp> -#else -# include <boost/type_traits/is_reference.hpp> -# include <boost/type_traits/is_array.hpp> -# include <boost/type_traits/detail/is_mem_fun_pointer_tester.hpp> -# include <boost/type_traits/detail/yes_no_type.hpp> -# include <boost/type_traits/detail/false_result.hpp> -# include <boost/type_traits/detail/ice_or.hpp> -#endif - -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#include <boost/type_traits/is_member_function_pointer.hpp> namespace boost { #if defined( __CODEGEARC__ ) -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_pointer,T,__is_member_pointer(T)) -#elif BOOST_WORKAROUND(__BORLANDC__, < 0x600) -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_pointer,T,false) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,typename U,is_member_pointer,U T::*,true) - +template <class T> struct is_member_pointer : public integral_constant<bool, __is_member_pointer(T)>{}; #else -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_pointer,T,::boost::is_member_function_pointer<T>::value) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,typename U,is_member_pointer,U T::*,true) +template <class T> struct is_member_pointer : public integral_constant<bool, ::boost::is_member_function_pointer<T>::value>{}; +template <class T, class U> struct is_member_pointer<U T::* > : public true_type{}; #if !BOOST_WORKAROUND(__MWERKS__,<=0x3003) && !BOOST_WORKAROUND(__IBMCPP__, <=600) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,typename U,is_member_pointer,U T::*const,true) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,typename U,is_member_pointer,U T::*volatile,true) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,typename U,is_member_pointer,U T::*const volatile,true) +template <class T, class U> struct is_member_pointer<U T::*const> : public true_type{}; +template <class T, class U> struct is_member_pointer<U T::*const volatile> : public true_type{}; +template <class T, class U> struct is_member_pointer<U T::*volatile> : public true_type{}; #endif #endif } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_MEMBER_POINTER_HPP_INCLUDED diff --git a/boost/type_traits/is_nothrow_move_assignable.hpp b/boost/type_traits/is_nothrow_move_assignable.hpp index 3268307cdf..9755430ecf 100644 --- a/boost/type_traits/is_nothrow_move_assignable.hpp +++ b/boost/type_traits/is_nothrow_move_assignable.hpp @@ -16,37 +16,27 @@ #include <boost/type_traits/has_nothrow_assign.hpp> #include <boost/type_traits/is_array.hpp> #include <boost/type_traits/is_reference.hpp> -#include <boost/type_traits/detail/ice_and.hpp> -#include <boost/type_traits/detail/ice_or.hpp> -#include <boost/type_traits/detail/ice_not.hpp> #include <boost/utility/enable_if.hpp> -#include <boost/utility/declval.hpp> - -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#include <boost/type_traits/declval.hpp> namespace boost { -namespace detail{ - #ifdef BOOST_IS_NOTHROW_MOVE_ASSIGN template <class T> -struct is_nothrow_move_assignable_imp{ BOOST_STATIC_CONSTANT(bool, value = BOOST_IS_NOTHROW_MOVE_ASSIGN(T)); }; -template <class T> -struct is_nothrow_move_assignable_imp<T const>{ BOOST_STATIC_CONSTANT(bool, value = false); }; -template <class T> -struct is_nothrow_move_assignable_imp<T volatile>{ BOOST_STATIC_CONSTANT(bool, value = false); }; -template <class T> -struct is_nothrow_move_assignable_imp<T const volatile>{ BOOST_STATIC_CONSTANT(bool, value = false); }; -template <class T> -struct is_nothrow_move_assignable_imp<T&>{ BOOST_STATIC_CONSTANT(bool, value = false); }; -template <class T> -struct is_nothrow_move_assignable_imp<T&&>{ BOOST_STATIC_CONSTANT(bool, value = false); }; - +struct is_nothrow_move_assignable : public integral_constant<bool, BOOST_IS_NOTHROW_MOVE_ASSIGN(T)>{}; +template <class T> struct is_nothrow_move_assignable<T const> : public false_type{}; +template <class T> struct is_nothrow_move_assignable<T volatile> : public false_type{}; +template <class T> struct is_nothrow_move_assignable<T const volatile> : public false_type{}; +template <class T> struct is_nothrow_move_assignable<T&> : public false_type{}; +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +template <class T> struct is_nothrow_move_assignable<T&&> : public false_type{}; +#endif #elif !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR) +namespace detail{ + template <class T, class Enable = void> struct false_or_cpp11_noexcept_move_assignable: public ::boost::false_type {}; @@ -57,52 +47,35 @@ struct false_or_cpp11_noexcept_move_assignable < > : public ::boost::integral_constant<bool, BOOST_NOEXCEPT_EXPR(::boost::declval<T&>() = ::boost::declval<T>())> {}; -template <class T> -struct is_nothrow_move_assignable_imp{ - BOOST_STATIC_CONSTANT(bool, value = ::boost::detail::false_or_cpp11_noexcept_move_assignable<T>::value); -}; +} template <class T> -struct is_nothrow_move_assignable_imp<T const> : public ::boost::false_type {}; -template <class T> -struct is_nothrow_move_assignable_imp<T volatile> : public ::boost::false_type{}; -template <class T> -struct is_nothrow_move_assignable_imp<T const volatile> : public ::boost::false_type{}; -template <class T> -struct is_nothrow_move_assignable_imp<T&> : public ::boost::false_type{}; +struct is_nothrow_move_assignable : public integral_constant<bool, ::boost::detail::false_or_cpp11_noexcept_move_assignable<T>::value>{}; + +template <class T> struct is_nothrow_move_assignable<T const> : public ::boost::false_type {}; +template <class T> struct is_nothrow_move_assignable<T const volatile> : public ::boost::false_type{}; +template <class T> struct is_nothrow_move_assignable<T volatile> : public ::boost::false_type{}; +template <class T> struct is_nothrow_move_assignable<T&> : public ::boost::false_type{}; #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -template <class T> -struct is_nothrow_move_assignable_imp<T&&> : public ::boost::false_type{}; +template <class T> struct is_nothrow_move_assignable<T&&> : public ::boost::false_type{}; #endif #else template <class T> -struct is_nothrow_move_assignable_imp{ - BOOST_STATIC_CONSTANT(bool, value = ( - ::boost::type_traits::ice_and< - ::boost::type_traits::ice_or< - ::boost::has_trivial_move_assign<T>::value, - ::boost::has_nothrow_assign<T>::value - >::value, - ::boost::type_traits::ice_not< ::boost::is_array<T>::value >::value - >::value)); -}; +struct is_nothrow_move_assignable : public integral_constant<bool, + (::boost::has_trivial_move_assign<T>::value || ::boost::has_nothrow_assign<T>::value) && ! ::boost::is_array<T>::value>{}; #endif -} -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_nothrow_move_assignable,T,::boost::detail::is_nothrow_move_assignable_imp<T>::value) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_nothrow_move_assignable,void,false) +template <> struct is_nothrow_move_assignable<void> : public false_type{}; #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_nothrow_move_assignable,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_nothrow_move_assignable,void const volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_nothrow_move_assignable,void volatile,false) +template <> struct is_nothrow_move_assignable<void const> : public false_type{}; +template <> struct is_nothrow_move_assignable<void const volatile> : public false_type{}; +template <> struct is_nothrow_move_assignable<void volatile> : public false_type{}; #endif } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_NOTHROW_MOVE_ASSIGNABLE_HPP_INCLUDED diff --git a/boost/type_traits/is_nothrow_move_constructible.hpp b/boost/type_traits/is_nothrow_move_constructible.hpp index c09d5d1f94..8f4cee2cf9 100644 --- a/boost/type_traits/is_nothrow_move_constructible.hpp +++ b/boost/type_traits/is_nothrow_move_constructible.hpp @@ -13,41 +13,25 @@ #include <boost/config.hpp> #include <boost/type_traits/intrinsics.hpp> -#include <boost/type_traits/has_trivial_move_constructor.hpp> -#include <boost/type_traits/has_nothrow_copy.hpp> -#include <boost/type_traits/is_array.hpp> -#include <boost/type_traits/is_reference.hpp> -#include <boost/type_traits/detail/ice_or.hpp> -#include <boost/type_traits/detail/ice_and.hpp> -#include <boost/utility/declval.hpp> -#include <boost/utility/enable_if.hpp> +#include <boost/type_traits/integral_constant.hpp> +#include <boost/detail/workaround.hpp> -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#ifdef BOOST_IS_NOTHROW_MOVE_CONSTRUCT namespace boost { -namespace detail{ +template <class T> +struct is_nothrow_move_constructible : public integral_constant<bool, BOOST_IS_NOTHROW_MOVE_CONSTRUCT(T)>{}; -#ifdef BOOST_IS_NOTHROW_MOVE_CONSTRUCT +template <class T> struct is_nothrow_move_constructible<volatile T> : public ::boost::false_type {}; +template <class T> struct is_nothrow_move_constructible<const volatile T> : public ::boost::false_type{}; -template <class T> -struct is_nothrow_move_constructible_imp{ - BOOST_STATIC_CONSTANT(bool, value = BOOST_IS_NOTHROW_MOVE_CONSTRUCT(T)); -}; +#elif !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR) && !BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40700) -template <class T> -struct is_nothrow_move_constructible_imp<volatile T> : public ::boost::false_type {}; -template <class T> -struct is_nothrow_move_constructible_imp<const volatile T> : public ::boost::false_type{}; -template <class T> -struct is_nothrow_move_constructible_imp<T&> : public ::boost::false_type{}; -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -template <class T> -struct is_nothrow_move_constructible_imp<T&&> : public ::boost::false_type{}; -#endif +#include <boost/type_traits/declval.hpp> +#include <boost/utility/enable_if.hpp> -#elif !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR) +namespace boost{ namespace detail{ template <class T, class Enable = void> struct false_or_cpp11_noexcept_move_constructible: public ::boost::false_type {}; @@ -59,51 +43,44 @@ struct false_or_cpp11_noexcept_move_constructible < > : public ::boost::integral_constant<bool, BOOST_NOEXCEPT_EXPR(T(::boost::declval<T>()))> {}; -template <class T> -struct is_nothrow_move_constructible_imp{ - BOOST_STATIC_CONSTANT(bool, value = ::boost::detail::false_or_cpp11_noexcept_move_constructible<T>::value); -}; +} -template <class T> -struct is_nothrow_move_constructible_imp<volatile T> : public ::boost::false_type {}; -template <class T> -struct is_nothrow_move_constructible_imp<const volatile T> : public ::boost::false_type{}; -template <class T> -struct is_nothrow_move_constructible_imp<T&> : public ::boost::false_type{}; -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -template <class T> -struct is_nothrow_move_constructible_imp<T&&> : public ::boost::false_type{}; -#endif +template <class T> struct is_nothrow_move_constructible + : public integral_constant<bool, ::boost::detail::false_or_cpp11_noexcept_move_constructible<T>::value>{}; + +template <class T> struct is_nothrow_move_constructible<volatile T> : public ::boost::false_type {}; +template <class T> struct is_nothrow_move_constructible<const volatile T> : public ::boost::false_type{}; +template <class T, std::size_t N> struct is_nothrow_move_constructible<T[N]> : public ::boost::false_type{}; +template <class T> struct is_nothrow_move_constructible<T[]> : public ::boost::false_type{}; #else -template <class T> -struct is_nothrow_move_constructible_imp{ - BOOST_STATIC_CONSTANT(bool, value =( - ::boost::type_traits::ice_and< - ::boost::type_traits::ice_or< - ::boost::has_trivial_move_constructor<T>::value, - ::boost::has_nothrow_copy<T>::value - >::value, - ::boost::type_traits::ice_not< ::boost::is_array<T>::value >::value - >::value)); -}; +#include <boost/type_traits/has_trivial_move_constructor.hpp> +#include <boost/type_traits/has_nothrow_copy.hpp> +#include <boost/type_traits/is_array.hpp> -#endif +namespace boost{ -} +template <class T> +struct is_nothrow_move_constructible + : public integral_constant<bool, + (::boost::has_trivial_move_constructor<T>::value || ::boost::has_nothrow_copy<T>::value) && !::boost::is_array<T>::value> +{}; -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_nothrow_move_constructible,T,::boost::detail::is_nothrow_move_constructible_imp<T>::value) +#endif -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_nothrow_move_constructible,void,false) +template <> struct is_nothrow_move_constructible<void> : false_type{}; #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_nothrow_move_constructible,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_nothrow_move_constructible,void const volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_nothrow_move_constructible,void volatile,false) +template <> struct is_nothrow_move_constructible<void const> : false_type{}; +template <> struct is_nothrow_move_constructible<void volatile> : false_type{}; +template <> struct is_nothrow_move_constructible<void const volatile> : false_type{}; +#endif +// References are always trivially constructible, even if the thing they reference is not: +template <class T> struct is_nothrow_move_constructible<T&> : public ::boost::true_type{}; +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES +template <class T> struct is_nothrow_move_constructible<T&&> : public ::boost::true_type{}; #endif } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_NOTHROW_MOVE_CONSTRUCTIBLE_HPP_INCLUDED diff --git a/boost/type_traits/is_object.hpp b/boost/type_traits/is_object.hpp index 1d1ae4f02e..fc9d2f25d3 100644 --- a/boost/type_traits/is_object.hpp +++ b/boost/type_traits/is_object.hpp @@ -9,37 +9,20 @@ #ifndef BOOST_TT_IS_OBJECT_HPP_INCLUDED #define BOOST_TT_IS_OBJECT_HPP_INCLUDED +#include <boost/config.hpp> #include <boost/type_traits/is_reference.hpp> #include <boost/type_traits/is_void.hpp> #include <boost/type_traits/is_function.hpp> -#include <boost/type_traits/detail/ice_and.hpp> -#include <boost/type_traits/detail/ice_not.hpp> -#include <boost/config.hpp> - -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { -namespace detail { - -template <typename T> -struct is_object_impl -{ - BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_and< - ::boost::type_traits::ice_not< ::boost::is_reference<T>::value>::value, - ::boost::type_traits::ice_not< ::boost::is_void<T>::value>::value, - ::boost::type_traits::ice_not< ::boost::is_function<T>::value>::value - >::value)); -}; - -} // namespace detail - -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_object,T,::boost::detail::is_object_impl<T>::value) +template <class T> struct is_object + : public + integral_constant< + bool, + ! ::boost::is_reference<T>::value && ! ::boost::is_void<T>::value && ! ::boost::is_function<T>::value > +{}; } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_OBJECT_HPP_INCLUDED diff --git a/boost/type_traits/is_pod.hpp b/boost/type_traits/is_pod.hpp index 820a3ceeb9..9204c93e25 100644 --- a/boost/type_traits/is_pod.hpp +++ b/boost/type_traits/is_pod.hpp @@ -9,16 +9,16 @@ #ifndef BOOST_TT_IS_POD_HPP_INCLUDED #define BOOST_TT_IS_POD_HPP_INCLUDED -#include <boost/type_traits/config.hpp> +#include <boost/type_traits/detail/config.hpp> #include <boost/type_traits/is_void.hpp> #include <boost/type_traits/is_scalar.hpp> -#include <boost/type_traits/detail/ice_or.hpp> #include <boost/type_traits/intrinsics.hpp> -#include <cstddef> +#ifdef __SUNPRO_CC +#include <boost/type_traits/is_function.hpp> +#endif -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#include <cstddef> #ifndef BOOST_IS_POD #define BOOST_INTERNAL_IS_POD(T) false @@ -31,49 +31,28 @@ namespace boost { // forward declaration, needed by 'is_pod_array_helper' template below template< typename T > struct is_POD; -namespace detail { - - -template <typename T> struct is_pod_impl -{ - BOOST_STATIC_CONSTANT( - bool, value = - (::boost::type_traits::ice_or< - ::boost::is_scalar<T>::value, - ::boost::is_void<T>::value, - BOOST_INTERNAL_IS_POD(T) - >::value)); -}; +template <typename T> struct is_pod +: public integral_constant<bool, ::boost::is_scalar<T>::value || ::boost::is_void<T>::value || BOOST_INTERNAL_IS_POD(T)> +{}; #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) -template <typename T, std::size_t sz> -struct is_pod_impl<T[sz]> - : public is_pod_impl<T> -{ -}; +template <typename T, std::size_t sz> struct is_pod<T[sz]> : public is_pod<T>{}; #endif // the following help compilers without partial specialization support: -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,void,true) +template<> struct is_pod<void> : public true_type{}; #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,void const,true) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,void volatile,true) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,void const volatile,true) +template<> struct is_pod<void const> : public true_type{}; +template<> struct is_pod<void const volatile> : public true_type{}; +template<> struct is_pod<void volatile> : public true_type{}; #endif -} // namespace detail - -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_pod,T,::boost::detail::is_pod_impl<T>::value) -// is_POD is the old depricated name for this trait, do not use this as it may -// be removed in future without warning!! -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_POD,T,::boost::is_pod<T>::value) +template<class T> struct is_POD : public is_pod<T>{}; } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #undef BOOST_INTERNAL_IS_POD #endif // BOOST_TT_IS_POD_HPP_INCLUDED diff --git a/boost/type_traits/is_pointer.hpp b/boost/type_traits/is_pointer.hpp index aad30f2541..44b06c227e 100644 --- a/boost/type_traits/is_pointer.hpp +++ b/boost/type_traits/is_pointer.hpp @@ -21,68 +21,27 @@ #ifndef BOOST_TT_IS_POINTER_HPP_INCLUDED #define BOOST_TT_IS_POINTER_HPP_INCLUDED -#include <boost/type_traits/is_member_pointer.hpp> -#include <boost/type_traits/detail/ice_and.hpp> -#include <boost/type_traits/detail/ice_not.hpp> -#include <boost/type_traits/config.hpp> -#include <boost/type_traits/remove_cv.hpp> - - -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#include <boost/type_traits/integral_constant.hpp> namespace boost { #if defined( __CODEGEARC__ ) -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_pointer,T,__is_pointer(T)) +template <class T> struct is_pointer : public integral_constant<bool, __is_pointer(T)>{}; #else - -namespace detail { - -template< typename T > struct is_pointer_helper -{ - BOOST_STATIC_CONSTANT(bool, value = false); -}; - -# define TT_AUX_BOOL_TRAIT_HELPER_PARTIAL_SPEC(helper,sp,result) \ -template< typename T > struct helper<sp> \ -{ \ - BOOST_STATIC_CONSTANT(bool, value = result); \ -}; \ -/**/ - -TT_AUX_BOOL_TRAIT_HELPER_PARTIAL_SPEC(is_pointer_helper,T*,true) - -# undef TT_AUX_BOOL_TRAIT_HELPER_PARTIAL_SPEC - -template< typename T > -struct is_pointer_impl -{ - BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_and< - ::boost::detail::is_pointer_helper<typename remove_cv<T>::type>::value - , ::boost::type_traits::ice_not< - ::boost::is_member_pointer<T>::value - >::value - >::value) - ); -}; - -} // namespace detail - -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_pointer,T,::boost::detail::is_pointer_impl<T>::value) - -#if defined(__BORLANDC__) && !defined(__COMO__) && (__BORLANDC__ < 0x600) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_pointer,T&,false) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_pointer,T& const,false) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_pointer,T& volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_pointer,T& const volatile,false) +template <class T> struct is_pointer : public false_type{}; +template <class T> struct is_pointer<T*> : public true_type{}; +template <class T> struct is_pointer<T*const> : public true_type{}; +template <class T> struct is_pointer<T*const volatile> : public true_type{}; +template <class T> struct is_pointer<T*volatile> : public true_type{}; + +#ifdef BOOST_MSVC +template <class T> struct is_pointer<T const> : public is_pointer<T>{}; +template <class T> struct is_pointer<T const volatile> : public is_pointer<T>{}; +template <class T> struct is_pointer<T volatile> : public is_pointer<T>{}; #endif #endif } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_POINTER_HPP_INCLUDED diff --git a/boost/type_traits/is_polymorphic.hpp b/boost/type_traits/is_polymorphic.hpp index aac985105d..722d8b46b2 100644 --- a/boost/type_traits/is_polymorphic.hpp +++ b/boost/type_traits/is_polymorphic.hpp @@ -9,12 +9,10 @@ #define BOOST_TT_IS_POLYMORPHIC_HPP #include <boost/type_traits/intrinsics.hpp> +#include <boost/type_traits/integral_constant.hpp> #ifndef BOOST_IS_POLYMORPHIC #include <boost/type_traits/is_class.hpp> -#include <boost/type_traits/remove_cv.hpp> #endif -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> #include <boost/detail/workaround.hpp> #if defined(BOOST_MSVC) && (BOOST_MSVC >= 1700) @@ -34,8 +32,7 @@ struct is_polymorphic_imp1 # if BOOST_WORKAROUND(__MWERKS__, <= 0x2407) // CWPro7 should return false always. typedef char d1, (&d2)[2]; # else - typedef typename remove_cv<T>::type ncvT; - struct d1 : public ncvT + struct d1 : public T { d1(); # if !defined(__GNUC__) // this raises warnings with some classes, and buys nothing with GCC @@ -47,7 +44,7 @@ struct is_polymorphic_imp1 d1(const d1&); d1& operator=(const d1&); }; - struct d2 : public ncvT + struct d2 : public T { d2(); virtual ~d2()throw(); @@ -67,6 +64,10 @@ struct is_polymorphic_imp1 BOOST_STATIC_CONSTANT(bool, value = (sizeof(d2) == sizeof(d1))); }; +template <class T> struct is_polymorphic_imp1<T const> : public is_polymorphic_imp1<T>{}; +template <class T> struct is_polymorphic_imp1<T const volatile> : public is_polymorphic_imp1<T>{}; +template <class T> struct is_polymorphic_imp1<T volatile> : public is_polymorphic_imp1<T>{}; + template <class T> struct is_polymorphic_imp2 { @@ -104,18 +105,16 @@ struct is_polymorphic_imp } // namespace detail -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_polymorphic,T,::boost::detail::is_polymorphic_imp<T>::value) +template <class T> struct is_polymorphic : public integral_constant<bool, ::boost::detail::is_polymorphic_imp<T>::value> {}; #else // BOOST_IS_POLYMORPHIC -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_polymorphic,T,BOOST_IS_POLYMORPHIC(T)) +template <class T> struct is_polymorphic : public integral_constant<bool, BOOST_IS_POLYMORPHIC(T)> {}; #endif } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #if defined(BOOST_MSVC) && (BOOST_MSVC >= 1700) #pragma warning(pop) #endif diff --git a/boost/type_traits/is_reference.hpp b/boost/type_traits/is_reference.hpp index 49b5f9ff0f..85f0a63204 100644 --- a/boost/type_traits/is_reference.hpp +++ b/boost/type_traits/is_reference.hpp @@ -12,34 +12,19 @@ #ifndef BOOST_TT_IS_REFERENCE_HPP_INCLUDED #define BOOST_TT_IS_REFERENCE_HPP_INCLUDED -#include <boost/type_traits/config.hpp> #include <boost/type_traits/is_lvalue_reference.hpp> #include <boost/type_traits/is_rvalue_reference.hpp> -#include <boost/type_traits/ice.hpp> - -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { -namespace detail { - -template <typename T> -struct is_reference_impl -{ - BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_or< - ::boost::is_lvalue_reference<T>::value, ::boost::is_rvalue_reference<T>::value - >::value)); -}; - -} // namespace detail - -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_reference,T,::boost::detail::is_reference_impl<T>::value) +template <class T> struct is_reference + : public + integral_constant< + bool, + ::boost::is_lvalue_reference<T>::value || ::boost::is_rvalue_reference<T>::value> +{}; } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_REFERENCE_HPP_INCLUDED diff --git a/boost/type_traits/is_rvalue_reference.hpp b/boost/type_traits/is_rvalue_reference.hpp index 93cd0bf187..50e88edee0 100644 --- a/boost/type_traits/is_rvalue_reference.hpp +++ b/boost/type_traits/is_rvalue_reference.hpp @@ -9,21 +9,17 @@ #ifndef BOOST_TT_IS_RVALUE_REFERENCE_HPP_INCLUDED #define BOOST_TT_IS_RVALUE_REFERENCE_HPP_INCLUDED -#include <boost/type_traits/config.hpp> - -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#include <boost/config.hpp> +#include <boost/type_traits/integral_constant.hpp> namespace boost { -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_rvalue_reference,T,false) +template <class T> struct is_rvalue_reference : public false_type {}; #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_rvalue_reference,T&&,true) +template <class T> struct is_rvalue_reference<T&&> : public true_type {}; #endif } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_REFERENCE_HPP_INCLUDED diff --git a/boost/type_traits/is_same.hpp b/boost/type_traits/is_same.hpp index c8987b07a8..d16f4b2b1a 100644 --- a/boost/type_traits/is_same.hpp +++ b/boost/type_traits/is_same.hpp @@ -21,25 +21,21 @@ #ifndef BOOST_TT_IS_SAME_HPP_INCLUDED #define BOOST_TT_IS_SAME_HPP_INCLUDED -#include <boost/type_traits/config.hpp> -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#include <boost/type_traits/integral_constant.hpp> namespace boost { -BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_same,T,U,false) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_1(typename T,is_same,T,T,true) + template <class T, class U> struct is_same : public false_type {}; + template <class T> struct is_same<T,T> : public true_type {}; #if BOOST_WORKAROUND(__BORLANDC__, < 0x600) // without this, Borland's compiler gives the wrong answer for // references to arrays: -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_1(typename T,is_same,T&,T&,true) + template <class T> struct is_same<T&, T&> : public true_type{}; #endif } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_SAME_HPP_INCLUDED diff --git a/boost/type_traits/is_scalar.hpp b/boost/type_traits/is_scalar.hpp index 4af3def14c..3031440596 100644 --- a/boost/type_traits/is_scalar.hpp +++ b/boost/type_traits/is_scalar.hpp @@ -13,43 +13,15 @@ #include <boost/type_traits/is_enum.hpp> #include <boost/type_traits/is_pointer.hpp> #include <boost/type_traits/is_member_pointer.hpp> -#include <boost/type_traits/detail/ice_or.hpp> #include <boost/config.hpp> -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> - namespace boost { -namespace detail { - template <typename T> -struct is_scalar_impl -{ - BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_or< - ::boost::is_arithmetic<T>::value, - ::boost::is_enum<T>::value, - ::boost::is_pointer<T>::value, - ::boost::is_member_pointer<T>::value - >::value)); -}; - -// these specializations are only really needed for compilers -// without partial specialization support: -template <> struct is_scalar_impl<void>{ BOOST_STATIC_CONSTANT(bool, value = false ); }; -#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -template <> struct is_scalar_impl<void const>{ BOOST_STATIC_CONSTANT(bool, value = false ); }; -template <> struct is_scalar_impl<void volatile>{ BOOST_STATIC_CONSTANT(bool, value = false ); }; -template <> struct is_scalar_impl<void const volatile>{ BOOST_STATIC_CONSTANT(bool, value = false ); }; -#endif - -} // namespace detail - -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_scalar,T,::boost::detail::is_scalar_impl<T>::value) +struct is_scalar + : public integral_constant<bool, ::boost::is_arithmetic<T>::value || ::boost::is_enum<T>::value || ::boost::is_pointer<T>::value || ::boost::is_member_pointer<T>::value> +{}; } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_SCALAR_HPP_INCLUDED diff --git a/boost/type_traits/is_signed.hpp b/boost/type_traits/is_signed.hpp index 5673284944..70ca2e4796 100644 --- a/boost/type_traits/is_signed.hpp +++ b/boost/type_traits/is_signed.hpp @@ -13,18 +13,17 @@ #include <boost/type_traits/is_integral.hpp> #include <boost/type_traits/remove_cv.hpp> #include <boost/type_traits/is_enum.hpp> -#include <boost/type_traits/detail/ice_or.hpp> - -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#include <climits> namespace boost { #if !defined( __CODEGEARC__ ) -namespace detail{ +#if !(defined(BOOST_MSVC) && BOOST_MSVC <= 1310) && \ + !(defined(__EDG_VERSION__) && __EDG_VERSION__ <= 238) &&\ + !defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION) -#if !(defined(__EDG_VERSION__) && __EDG_VERSION__ <= 238) && !defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION) +namespace detail{ template <class T> struct is_signed_values @@ -67,70 +66,98 @@ struct is_signed_select_helper<false> }; template <class T> -struct is_signed_imp +struct is_signed_impl { - typedef is_signed_select_helper< - ::boost::type_traits::ice_or< - ::boost::is_integral<T>::value, - ::boost::is_enum<T>::value>::value - > selector; + typedef ::boost::detail::is_signed_select_helper< ::boost::is_integral<T>::value || ::boost::is_enum<T>::value> selector; typedef typename selector::template rebind<T> binder; typedef typename binder::type type; BOOST_STATIC_CONSTANT(bool, value = type::value); }; +} + +template <class T> struct is_signed : public integral_constant<bool, boost::detail::is_signed_impl<T>::value> {}; + #else -template <class T> struct is_signed_imp : public false_type{}; -template <> struct is_signed_imp<signed char> : public true_type{}; -template <> struct is_signed_imp<const signed char> : public true_type{}; -template <> struct is_signed_imp<volatile signed char> : public true_type{}; -template <> struct is_signed_imp<const volatile signed char> : public true_type{}; -template <> struct is_signed_imp<short> : public true_type{}; -template <> struct is_signed_imp<const short> : public true_type{}; -template <> struct is_signed_imp<volatile short> : public true_type{}; -template <> struct is_signed_imp<const volatile short> : public true_type{}; -template <> struct is_signed_imp<int> : public true_type{}; -template <> struct is_signed_imp<const int> : public true_type{}; -template <> struct is_signed_imp<volatile int> : public true_type{}; -template <> struct is_signed_imp<const volatile int> : public true_type{}; -template <> struct is_signed_imp<long> : public true_type{}; -template <> struct is_signed_imp<const long> : public true_type{}; -template <> struct is_signed_imp<volatile long> : public true_type{}; -template <> struct is_signed_imp<const volatile long> : public true_type{}; -#ifdef BOOST_HAS_LONG_LONG -template <> struct is_signed_imp<long long> : public true_type{}; -template <> struct is_signed_imp<const long long> : public true_type{}; -template <> struct is_signed_imp<volatile long long> : public true_type{}; -template <> struct is_signed_imp<const volatile long long> : public true_type{}; -#endif -#if defined(CHAR_MIN) && (CHAR_MIN != 0) -template <> struct is_signed_imp<char> : public true_type{}; -template <> struct is_signed_imp<const char> : public true_type{}; -template <> struct is_signed_imp<volatile char> : public true_type{}; -template <> struct is_signed_imp<const volatile char> : public true_type{}; -#endif -#if defined(WCHAR_MIN) && (WCHAR_MIN != 0) -template <> struct is_signed_imp<wchar_t> : public true_type{}; -template <> struct is_signed_imp<const wchar_t> : public true_type{}; -template <> struct is_signed_imp<volatile wchar_t> : public true_type{}; -template <> struct is_signed_imp<const volatile wchar_t> : public true_type{}; -#endif +template <class T> struct is_signed : public false_type{}; #endif -} - -#endif // !defined( __CODEGEARC__ ) +#else //defined( __CODEGEARC__ ) + template <class T> struct is_signed : public integral_constant<bool, __is_signed(T)>{}; +#endif -#if defined( __CODEGEARC__ ) -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_signed,T,__is_signed(T)) +template <> struct is_signed<signed char> : public true_type{}; +template <> struct is_signed<const signed char> : public true_type{}; +template <> struct is_signed<volatile signed char> : public true_type{}; +template <> struct is_signed<const volatile signed char> : public true_type{}; +template <> struct is_signed<short> : public true_type{}; +template <> struct is_signed<const short> : public true_type{}; +template <> struct is_signed<volatile short> : public true_type{}; +template <> struct is_signed<const volatile short> : public true_type{}; +template <> struct is_signed<int> : public true_type{}; +template <> struct is_signed<const int> : public true_type{}; +template <> struct is_signed<volatile int> : public true_type{}; +template <> struct is_signed<const volatile int> : public true_type{}; +template <> struct is_signed<long> : public true_type{}; +template <> struct is_signed<const long> : public true_type{}; +template <> struct is_signed<volatile long> : public true_type{}; +template <> struct is_signed<const volatile long> : public true_type{}; + +template <> struct is_signed<unsigned char> : public false_type{}; +template <> struct is_signed<const unsigned char> : public false_type{}; +template <> struct is_signed<volatile unsigned char> : public false_type{}; +template <> struct is_signed<const volatile unsigned char> : public false_type{}; +template <> struct is_signed<unsigned short> : public false_type{}; +template <> struct is_signed<const unsigned short> : public false_type{}; +template <> struct is_signed<volatile unsigned short> : public false_type{}; +template <> struct is_signed<const volatile unsigned short> : public false_type{}; +template <> struct is_signed<unsigned int> : public false_type{}; +template <> struct is_signed<const unsigned int> : public false_type{}; +template <> struct is_signed<volatile unsigned int> : public false_type{}; +template <> struct is_signed<const volatile unsigned int> : public false_type{}; +template <> struct is_signed<unsigned long> : public false_type{}; +template <> struct is_signed<const unsigned long> : public false_type{}; +template <> struct is_signed<volatile unsigned long> : public false_type{}; +template <> struct is_signed<const volatile unsigned long> : public false_type{}; +#ifdef BOOST_HAS_LONG_LONG +template <> struct is_signed< ::boost::long_long_type> : public true_type{}; +template <> struct is_signed<const ::boost::long_long_type> : public true_type{}; +template <> struct is_signed<volatile ::boost::long_long_type> : public true_type{}; +template <> struct is_signed<const volatile ::boost::long_long_type> : public true_type{}; + +template <> struct is_signed< ::boost::ulong_long_type> : public false_type{}; +template <> struct is_signed<const ::boost::ulong_long_type> : public false_type{}; +template <> struct is_signed<volatile ::boost::ulong_long_type> : public false_type{}; +template <> struct is_signed<const volatile ::boost::ulong_long_type> : public false_type{}; +#endif +#if defined(CHAR_MIN) +#if CHAR_MIN != 0 +template <> struct is_signed<char> : public true_type{}; +template <> struct is_signed<const char> : public true_type{}; +template <> struct is_signed<volatile char> : public true_type{}; +template <> struct is_signed<const volatile char> : public true_type{}; #else -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_signed,T,::boost::detail::is_signed_imp<T>::value) +template <> struct is_signed<char> : public false_type{}; +template <> struct is_signed<const char> : public false_type{}; +template <> struct is_signed<volatile char> : public false_type{}; +template <> struct is_signed<const volatile char> : public false_type{}; +#endif +#endif +#if defined(WCHAR_MIN) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) +#if WCHAR_MIN != 0 +template <> struct is_signed<wchar_t> : public true_type{}; +template <> struct is_signed<const wchar_t> : public true_type{}; +template <> struct is_signed<volatile wchar_t> : public true_type{}; +template <> struct is_signed<const volatile wchar_t> : public true_type{}; +#else +template <> struct is_signed<wchar_t> : public false_type{}; +template <> struct is_signed<const wchar_t> : public false_type{}; +template <> struct is_signed<volatile wchar_t> : public false_type{}; +template <> struct is_signed<const volatile wchar_t> : public false_type{}; +#endif #endif - } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/boost/type_traits/is_stateless.hpp b/boost/type_traits/is_stateless.hpp index d8d40635fe..f9266da5b8 100644 --- a/boost/type_traits/is_stateless.hpp +++ b/boost/type_traits/is_stateless.hpp @@ -14,35 +14,20 @@ #include <boost/type_traits/has_trivial_destructor.hpp> #include <boost/type_traits/is_class.hpp> #include <boost/type_traits/is_empty.hpp> -#include <boost/type_traits/detail/ice_and.hpp> #include <boost/config.hpp> -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> - namespace boost { -namespace detail { - template <typename T> -struct is_stateless_impl -{ - BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_and< - ::boost::has_trivial_constructor<T>::value, - ::boost::has_trivial_copy<T>::value, - ::boost::has_trivial_destructor<T>::value, - ::boost::is_class<T>::value, - ::boost::is_empty<T>::value - >::value)); -}; - -} // namespace detail - -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_stateless,T,::boost::detail::is_stateless_impl<T>::value) +struct is_stateless + : public integral_constant<bool, + (::boost::has_trivial_constructor<T>::value + && ::boost::has_trivial_copy<T>::value + && ::boost::has_trivial_destructor<T>::value + && ::boost::is_class<T>::value + && ::boost::is_empty<T>::value)> +{}; } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_STATELESS_HPP_INCLUDED diff --git a/boost/type_traits/is_union.hpp b/boost/type_traits/is_union.hpp index 610f162ba4..c5e1a96019 100644 --- a/boost/type_traits/is_union.hpp +++ b/boost/type_traits/is_union.hpp @@ -11,47 +11,21 @@ #ifndef BOOST_TT_IS_UNION_HPP_INCLUDED #define BOOST_TT_IS_UNION_HPP_INCLUDED -#include <boost/type_traits/remove_cv.hpp> -#include <boost/type_traits/config.hpp> #include <boost/type_traits/intrinsics.hpp> - -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#include <boost/type_traits/integral_constant.hpp> namespace boost { -namespace detail { -#ifndef __GNUC__ -template <typename T> struct is_union_impl -{ - typedef typename remove_cv<T>::type cvt; #ifdef BOOST_IS_UNION - BOOST_STATIC_CONSTANT(bool, value = BOOST_IS_UNION(cvt)); +template <class T> struct is_union : public integral_constant<bool, BOOST_IS_UNION(T)> {}; #else - BOOST_STATIC_CONSTANT(bool, value = false); +template <class T> struct is_union : public integral_constant<bool, false> {}; #endif -}; -#else -// -// using remove_cv here generates a whole load of needless -// warnings with gcc, since it doesn't do any good with gcc -// in any case (at least at present), just remove it: -// -template <typename T> struct is_union_impl -{ -#ifdef BOOST_IS_UNION - BOOST_STATIC_CONSTANT(bool, value = BOOST_IS_UNION(T)); -#else - BOOST_STATIC_CONSTANT(bool, value = false); -#endif -}; -#endif -} // namespace detail -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_union,T,::boost::detail::is_union_impl<T>::value) +template <class T> struct is_union<T const> : public is_union<T>{}; +template <class T> struct is_union<T volatile const> : public is_union<T>{}; +template <class T> struct is_union<T volatile> : public is_union<T>{}; } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_UNION_HPP_INCLUDED diff --git a/boost/type_traits/is_unsigned.hpp b/boost/type_traits/is_unsigned.hpp index 0602838a33..c4c54af7b3 100644 --- a/boost/type_traits/is_unsigned.hpp +++ b/boost/type_traits/is_unsigned.hpp @@ -13,18 +13,18 @@ #include <boost/type_traits/is_integral.hpp> #include <boost/type_traits/is_enum.hpp> #include <boost/type_traits/remove_cv.hpp> -#include <boost/type_traits/detail/ice_or.hpp> -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#include <climits> namespace boost { #if !defined( __CODEGEARC__ ) -namespace detail{ +#if !(defined(BOOST_MSVC) && BOOST_MSVC <= 1310) &&\ + !(defined(__EDG_VERSION__) && __EDG_VERSION__ <= 238) &&\ + !defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION) -#if !(defined(__EDG_VERSION__) && __EDG_VERSION__ <= 238) && !defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION) +namespace detail{ template <class T> struct is_unsigned_values @@ -46,7 +46,7 @@ struct is_ununsigned_helper }; template <bool integral_type> -struct is_ununsigned_select_helper +struct is_unsigned_select_helper { template <class T> struct rebind @@ -56,7 +56,7 @@ struct is_ununsigned_select_helper }; template <> -struct is_ununsigned_select_helper<false> +struct is_unsigned_select_helper<false> { template <class T> struct rebind @@ -66,70 +66,98 @@ struct is_ununsigned_select_helper<false> }; template <class T> -struct is_unsigned_imp +struct is_unsigned { - typedef is_ununsigned_select_helper< - ::boost::type_traits::ice_or< - ::boost::is_integral<T>::value, - ::boost::is_enum<T>::value>::value - > selector; + typedef ::boost::detail::is_unsigned_select_helper< ::boost::is_integral<T>::value || ::boost::is_enum<T>::value > selector; typedef typename selector::template rebind<T> binder; typedef typename binder::type type; BOOST_STATIC_CONSTANT(bool, value = type::value); }; +} // namespace detail + +template <class T> struct is_unsigned : public integral_constant<bool, boost::detail::is_unsigned<T>::value> {}; + #else -template <class T> struct is_unsigned_imp : public false_type{}; -template <> struct is_unsigned_imp<unsigned char> : public true_type{}; -template <> struct is_unsigned_imp<const unsigned char> : public true_type{}; -template <> struct is_unsigned_imp<volatile unsigned char> : public true_type{}; -template <> struct is_unsigned_imp<const volatile unsigned char> : public true_type{}; -template <> struct is_unsigned_imp<unsigned short> : public true_type{}; -template <> struct is_unsigned_imp<const unsigned short> : public true_type{}; -template <> struct is_unsigned_imp<volatile unsigned short> : public true_type{}; -template <> struct is_unsigned_imp<const volatile unsigned short> : public true_type{}; -template <> struct is_unsigned_imp<unsigned int> : public true_type{}; -template <> struct is_unsigned_imp<const unsigned int> : public true_type{}; -template <> struct is_unsigned_imp<volatile unsigned int> : public true_type{}; -template <> struct is_unsigned_imp<const volatile unsigned int> : public true_type{}; -template <> struct is_unsigned_imp<unsigned long> : public true_type{}; -template <> struct is_unsigned_imp<const unsigned long> : public true_type{}; -template <> struct is_unsigned_imp<volatile unsigned long> : public true_type{}; -template <> struct is_unsigned_imp<const volatile unsigned long> : public true_type{}; -#ifdef BOOST_HAS_LONG_LONG -template <> struct is_unsigned_imp<unsigned long long> : public true_type{}; -template <> struct is_unsigned_imp<const unsigned long long> : public true_type{}; -template <> struct is_unsigned_imp<volatile unsigned long long> : public true_type{}; -template <> struct is_unsigned_imp<const volatile unsigned long long> : public true_type{}; -#endif -#if defined(CHAR_MIN) && (CHAR_MIN == 0) -template <> struct is_unsigned_imp<char> : public true_type{}; -template <> struct is_unsigned_imp<const char> : public true_type{}; -template <> struct is_unsigned_imp<volatile char> : public true_type{}; -template <> struct is_unsigned_imp<const volatile char> : public true_type{}; -#endif -#if defined(WCHAR_MIN) && (WCHAR_MIN == 0) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) -template <> struct is_unsigned_imp<wchar_t> : public true_type{}; -template <> struct is_unsigned_imp<const wchar_t> : public true_type{}; -template <> struct is_unsigned_imp<volatile wchar_t> : public true_type{}; -template <> struct is_unsigned_imp<const volatile wchar_t> : public true_type{}; -#endif +template <class T> struct is_unsigned : public false_type{}; #endif -} - -#endif // !defined( __CODEGEARC__ ) +#else // defined( __CODEGEARC__ ) +template <class T> struct is_unsigned : public integral_constant<bool, __is_unsigned(T)> {}; +#endif -#if defined( __CODEGEARC__ ) -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_unsigned,T,__is_unsigned(T)) +template <> struct is_unsigned<unsigned char> : public true_type{}; +template <> struct is_unsigned<const unsigned char> : public true_type{}; +template <> struct is_unsigned<volatile unsigned char> : public true_type{}; +template <> struct is_unsigned<const volatile unsigned char> : public true_type{}; +template <> struct is_unsigned<unsigned short> : public true_type{}; +template <> struct is_unsigned<const unsigned short> : public true_type{}; +template <> struct is_unsigned<volatile unsigned short> : public true_type{}; +template <> struct is_unsigned<const volatile unsigned short> : public true_type{}; +template <> struct is_unsigned<unsigned int> : public true_type{}; +template <> struct is_unsigned<const unsigned int> : public true_type{}; +template <> struct is_unsigned<volatile unsigned int> : public true_type{}; +template <> struct is_unsigned<const volatile unsigned int> : public true_type{}; +template <> struct is_unsigned<unsigned long> : public true_type{}; +template <> struct is_unsigned<const unsigned long> : public true_type{}; +template <> struct is_unsigned<volatile unsigned long> : public true_type{}; +template <> struct is_unsigned<const volatile unsigned long> : public true_type{}; + +template <> struct is_unsigned<signed char> : public false_type{}; +template <> struct is_unsigned<const signed char> : public false_type{}; +template <> struct is_unsigned<volatile signed char> : public false_type{}; +template <> struct is_unsigned<const volatile signed char> : public false_type{}; +template <> struct is_unsigned< short> : public false_type{}; +template <> struct is_unsigned<const short> : public false_type{}; +template <> struct is_unsigned<volatile short> : public false_type{}; +template <> struct is_unsigned<const volatile short> : public false_type{}; +template <> struct is_unsigned< int> : public false_type{}; +template <> struct is_unsigned<const int> : public false_type{}; +template <> struct is_unsigned<volatile int> : public false_type{}; +template <> struct is_unsigned<const volatile int> : public false_type{}; +template <> struct is_unsigned< long> : public false_type{}; +template <> struct is_unsigned<const long> : public false_type{}; +template <> struct is_unsigned<volatile long> : public false_type{}; +template <> struct is_unsigned<const volatile long> : public false_type{}; +#ifdef BOOST_HAS_LONG_LONG +template <> struct is_unsigned< ::boost::ulong_long_type> : public true_type{}; +template <> struct is_unsigned<const ::boost::ulong_long_type> : public true_type{}; +template <> struct is_unsigned<volatile ::boost::ulong_long_type> : public true_type{}; +template <> struct is_unsigned<const volatile ::boost::ulong_long_type> : public true_type{}; + +template <> struct is_unsigned< ::boost::long_long_type> : public false_type{}; +template <> struct is_unsigned<const ::boost::long_long_type> : public false_type{}; +template <> struct is_unsigned<volatile ::boost::long_long_type> : public false_type{}; +template <> struct is_unsigned<const volatile ::boost::long_long_type> : public false_type{}; +#endif +#if defined(CHAR_MIN) +#if CHAR_MIN == 0 +template <> struct is_unsigned<char> : public true_type{}; +template <> struct is_unsigned<const char> : public true_type{}; +template <> struct is_unsigned<volatile char> : public true_type{}; +template <> struct is_unsigned<const volatile char> : public true_type{}; #else -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_unsigned,T,::boost::detail::is_unsigned_imp<T>::value) +template <> struct is_unsigned<char> : public false_type{}; +template <> struct is_unsigned<const char> : public false_type{}; +template <> struct is_unsigned<volatile char> : public false_type{}; +template <> struct is_unsigned<const volatile char> : public false_type{}; +#endif +#endif +#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) && defined(WCHAR_MIN) +#if WCHAR_MIN == 0 +template <> struct is_unsigned<wchar_t> : public true_type{}; +template <> struct is_unsigned<const wchar_t> : public true_type{}; +template <> struct is_unsigned<volatile wchar_t> : public true_type{}; +template <> struct is_unsigned<const volatile wchar_t> : public true_type{}; +#else +template <> struct is_unsigned<wchar_t> : public false_type{}; +template <> struct is_unsigned<const wchar_t> : public false_type{}; +template <> struct is_unsigned<volatile wchar_t> : public false_type{}; +template <> struct is_unsigned<const volatile wchar_t> : public false_type{}; +#endif #endif - } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/boost/type_traits/is_virtual_base_of.hpp b/boost/type_traits/is_virtual_base_of.hpp index 3daad1b51b..f0052563e3 100644 --- a/boost/type_traits/is_virtual_base_of.hpp +++ b/boost/type_traits/is_virtual_base_of.hpp @@ -10,11 +10,6 @@ #include <boost/type_traits/is_base_of.hpp> #include <boost/type_traits/is_same.hpp> -#include <boost/mpl/and.hpp> -#include <boost/mpl/not.hpp> - -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { namespace detail { @@ -34,7 +29,7 @@ struct is_virtual_base_of_impl }; template<typename Base, typename Derived> -struct is_virtual_base_of_impl<Base, Derived, mpl::true_> +struct is_virtual_base_of_impl<Base, Derived, true_type> { union max_align { @@ -88,7 +83,7 @@ struct is_virtual_base_of_impl<Base, Derived, mpl::true_> template<typename Base, typename Derived> struct is_virtual_base_of_impl2 { - typedef typename mpl::and_<is_base_of<Base, Derived>, mpl::not_<is_same<Base, Derived> > >::type tag_type; + typedef boost::integral_constant<bool, (boost::is_base_of<Base, Derived>::value && ! boost::is_same<Base, Derived>::value)> tag_type; typedef is_virtual_base_of_impl<Base, Derived, tag_type> imp; BOOST_STATIC_CONSTANT(bool, value = imp::value); }; @@ -99,19 +94,12 @@ struct is_virtual_base_of_impl2 } // namespace detail -BOOST_TT_AUX_BOOL_TRAIT_DEF2( - is_virtual_base_of - , Base - , Derived - , (::boost::detail::is_virtual_base_of_impl2<Base,Derived>::value) -) +template <class Base, class Derived> struct is_virtual_base_of : public integral_constant<bool, (::boost::detail::is_virtual_base_of_impl2<Base, Derived>::value)>{}; -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_virtual_base_of,Base&,Derived,false) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_virtual_base_of,Base,Derived&,false) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_virtual_base_of,Base&,Derived&,false) +template <class Base, class Derived> struct is_virtual_base_of<Base&, Derived> : public false_type{}; +template <class Base, class Derived> struct is_virtual_base_of<Base, Derived&> : public false_type{}; +template <class Base, class Derived> struct is_virtual_base_of<Base&, Derived&> : public false_type{}; } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif diff --git a/boost/type_traits/is_void.hpp b/boost/type_traits/is_void.hpp index 6f6fbff6d9..183f8abf56 100644 --- a/boost/type_traits/is_void.hpp +++ b/boost/type_traits/is_void.hpp @@ -9,30 +9,18 @@ #ifndef BOOST_TT_IS_VOID_HPP_INCLUDED #define BOOST_TT_IS_VOID_HPP_INCLUDED -#include <boost/config.hpp> - -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#include <boost/type_traits/integral_constant.hpp> namespace boost { -//* is a type T void - is_void<T> -#if defined( __CODEGEARC__ ) -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_void,T,__is_void(T)) -#else -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_void,T,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_void,void,true) - -#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_void,void const,true) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_void,void volatile,true) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_void,void const volatile,true) -#endif +template <class T> +struct is_void : public false_type {}; -#endif // non-CodeGear implementation +template<> struct is_void<void> : public true_type {}; +template<> struct is_void<const void> : public true_type{}; +template<> struct is_void<const volatile void> : public true_type{}; +template<> struct is_void<volatile void> : public true_type{}; } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_VOID_HPP_INCLUDED diff --git a/boost/type_traits/is_volatile.hpp b/boost/type_traits/is_volatile.hpp index d9839dad3b..cefe987308 100644 --- a/boost/type_traits/is_volatile.hpp +++ b/boost/type_traits/is_volatile.hpp @@ -21,64 +21,25 @@ #ifndef BOOST_TT_IS_VOLATILE_HPP_INCLUDED #define BOOST_TT_IS_VOLATILE_HPP_INCLUDED -#include <boost/config.hpp> -#include <boost/detail/workaround.hpp> - -# include <boost/type_traits/detail/cv_traits_impl.hpp> -# if BOOST_WORKAROUND(BOOST_MSVC, < 1400) -# include <boost/type_traits/remove_bounds.hpp> -# endif - -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#include <boost/type_traits/integral_constant.hpp> namespace boost { -namespace detail{ -template <class T> -struct is_volatile_rval_filter -{ -#if BOOST_WORKAROUND(BOOST_MSVC, < 1400) - BOOST_STATIC_CONSTANT(bool, value = ::boost::detail::cv_traits_imp<typename boost::remove_bounds<T>::type*>::is_volatile); -#else - BOOST_STATIC_CONSTANT(bool, value = ::boost::detail::cv_traits_imp<BOOST_TT_AUX_CV_TRAITS_IMPL_PARAM(T)>::is_volatile); -#endif -}; -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -// -// We can't filter out rvalue_references at the same level as -// references or we get ambiguities from msvc: -// -template <class T> -struct is_volatile_rval_filter<T&&> -{ - BOOST_STATIC_CONSTANT(bool, value = false); -}; -#endif -} - #if defined( __CODEGEARC__ ) -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_volatile,T,__is_volatile(T)) -#else -//* is a type T declared volatile - is_volatile<T> -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_volatile,T,::boost::detail::is_volatile_rval_filter<T>::value) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_volatile,T&,false) + template <class T> + struct is_volatile : public integral_constant<bool, __is_volatile(T)> {}; -#if defined(BOOST_ILLEGAL_CV_REFERENCES) -// these are illegal specialisations; cv-qualifies applied to -// references have no effect according to [8.3.2p1], -// C++ Builder requires them though as it treats cv-qualified -// references as distinct types... -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_volatile,T& const,false) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_volatile,T& volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_volatile,T& const volatile,false) -#endif +#else + + template <class T> + struct is_volatile : public false_type {}; + template <class T> struct is_volatile<T volatile> : public true_type{}; + template <class T, size_t N> struct is_volatile<T volatile[N]> : public true_type{}; + template <class T> struct is_volatile<T volatile[]> : public true_type{}; #endif } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_IS_VOLATILE_HPP_INCLUDED diff --git a/boost/type_traits/make_signed.hpp b/boost/type_traits/make_signed.hpp index 51cdbb0dc8..0d2d5df61a 100644 --- a/boost/type_traits/make_signed.hpp +++ b/boost/type_traits/make_signed.hpp @@ -9,7 +9,7 @@ #ifndef BOOST_TT_MAKE_SIGNED_HPP_INCLUDED #define BOOST_TT_MAKE_SIGNED_HPP_INCLUDED -#include <boost/mpl/if.hpp> +#include <boost/type_traits/conditional.hpp> #include <boost/type_traits/is_integral.hpp> #include <boost/type_traits/is_signed.hpp> #include <boost/type_traits/is_unsigned.hpp> @@ -20,58 +20,45 @@ #include <boost/type_traits/is_volatile.hpp> #include <boost/type_traits/add_const.hpp> #include <boost/type_traits/add_volatile.hpp> -#include <boost/type_traits/detail/ice_or.hpp> -#include <boost/type_traits/detail/ice_and.hpp> -#include <boost/type_traits/detail/ice_not.hpp> #include <boost/static_assert.hpp> -// should be the last #include -#include <boost/type_traits/detail/type_trait_def.hpp> - namespace boost { -namespace detail { - template <class T> -struct make_signed_imp +struct make_signed { - BOOST_STATIC_ASSERT( - (::boost::type_traits::ice_or< ::boost::is_integral<T>::value, ::boost::is_enum<T>::value>::value)); - BOOST_STATIC_ASSERT( - (::boost::type_traits::ice_not< ::boost::is_same< - typename remove_cv<T>::type, bool>::value>::value)); +private: + BOOST_STATIC_ASSERT_MSG(( ::boost::is_integral<T>::value || ::boost::is_enum<T>::value), "The template argument to make_signed must be an integer or enum type."); + BOOST_STATIC_ASSERT_MSG(!(::boost::is_same<typename remove_cv<T>::type, bool>::value), "The template argument to make_signed must not be the type bool."); typedef typename remove_cv<T>::type t_no_cv; - typedef typename mpl::if_c< - (::boost::type_traits::ice_and< - ::boost::is_signed<T>::value, - ::boost::is_integral<T>::value, - ::boost::type_traits::ice_not< ::boost::is_same<t_no_cv, char>::value>::value, - ::boost::type_traits::ice_not< ::boost::is_same<t_no_cv, wchar_t>::value>::value, - ::boost::type_traits::ice_not< ::boost::is_same<t_no_cv, bool>::value>::value >::value), + typedef typename conditional< + (::boost::is_signed<T>::value + && ::boost::is_integral<T>::value + && ! ::boost::is_same<t_no_cv, char>::value + && ! ::boost::is_same<t_no_cv, wchar_t>::value + && ! ::boost::is_same<t_no_cv, bool>::value), T, - typename mpl::if_c< - (::boost::type_traits::ice_and< - ::boost::is_integral<T>::value, - ::boost::type_traits::ice_not< ::boost::is_same<t_no_cv, char>::value>::value, - ::boost::type_traits::ice_not< ::boost::is_same<t_no_cv, wchar_t>::value>::value, - ::boost::type_traits::ice_not< ::boost::is_same<t_no_cv, bool>::value>::value> - ::value), - typename mpl::if_< - is_same<t_no_cv, unsigned char>, + typename conditional< + (::boost::is_integral<T>::value + && ! ::boost::is_same<t_no_cv, char>::value + && ! ::boost::is_same<t_no_cv, wchar_t>::value + && ! ::boost::is_same<t_no_cv, bool>::value), + typename conditional< + is_same<t_no_cv, unsigned char>::value, signed char, - typename mpl::if_< - is_same<t_no_cv, unsigned short>, + typename conditional< + is_same<t_no_cv, unsigned short>::value, signed short, - typename mpl::if_< - is_same<t_no_cv, unsigned int>, + typename conditional< + is_same<t_no_cv, unsigned int>::value, int, - typename mpl::if_< - is_same<t_no_cv, unsigned long>, + typename conditional< + is_same<t_no_cv, unsigned long>::value, long, #if defined(BOOST_HAS_LONG_LONG) #ifdef BOOST_HAS_INT128 - typename mpl::if_c< + typename conditional< sizeof(t_no_cv) == sizeof(boost::long_long_type), boost::long_long_type, boost::int128_type @@ -89,21 +76,21 @@ struct make_signed_imp >::type >::type, // Not a regular integer type: - typename mpl::if_c< + typename conditional< sizeof(t_no_cv) == sizeof(unsigned char), signed char, - typename mpl::if_c< + typename conditional< sizeof(t_no_cv) == sizeof(unsigned short), signed short, - typename mpl::if_c< + typename conditional< sizeof(t_no_cv) == sizeof(unsigned int), int, - typename mpl::if_c< + typename conditional< sizeof(t_no_cv) == sizeof(unsigned long), long, #if defined(BOOST_HAS_LONG_LONG) #ifdef BOOST_HAS_INT128 - typename mpl::if_c< + typename conditional< sizeof(t_no_cv) == sizeof(boost::long_long_type), boost::long_long_type, boost::int128_type @@ -124,28 +111,21 @@ struct make_signed_imp >::type base_integer_type; // Add back any const qualifier: - typedef typename mpl::if_< - is_const<T>, + typedef typename conditional< + is_const<T>::value, typename add_const<base_integer_type>::type, base_integer_type >::type const_base_integer_type; - +public: // Add back any volatile qualifier: - typedef typename mpl::if_< - is_volatile<T>, + typedef typename conditional< + is_volatile<T>::value, typename add_volatile<const_base_integer_type>::type, const_base_integer_type >::type type; }; - -} // namespace detail - -BOOST_TT_AUX_TYPE_TRAIT_DEF1(make_signed,T,typename boost::detail::make_signed_imp<T>::type) - } // namespace boost -#include <boost/type_traits/detail/type_trait_undef.hpp> - #endif // BOOST_TT_ADD_REFERENCE_HPP_INCLUDED diff --git a/boost/type_traits/make_unsigned.hpp b/boost/type_traits/make_unsigned.hpp index 239153a863..4b21ebaeb2 100644 --- a/boost/type_traits/make_unsigned.hpp +++ b/boost/type_traits/make_unsigned.hpp @@ -9,7 +9,7 @@ #ifndef BOOST_TT_MAKE_UNSIGNED_HPP_INCLUDED #define BOOST_TT_MAKE_UNSIGNED_HPP_INCLUDED -#include <boost/mpl/if.hpp> +#include <boost/type_traits/conditional.hpp> #include <boost/type_traits/is_integral.hpp> #include <boost/type_traits/is_signed.hpp> #include <boost/type_traits/is_unsigned.hpp> @@ -20,58 +20,44 @@ #include <boost/type_traits/is_volatile.hpp> #include <boost/type_traits/add_const.hpp> #include <boost/type_traits/add_volatile.hpp> -#include <boost/type_traits/detail/ice_or.hpp> -#include <boost/type_traits/detail/ice_and.hpp> -#include <boost/type_traits/detail/ice_not.hpp> #include <boost/static_assert.hpp> -// should be the last #include -#include <boost/type_traits/detail/type_trait_def.hpp> - namespace boost { -namespace detail { - template <class T> -struct make_unsigned_imp +struct make_unsigned { - BOOST_STATIC_ASSERT( - (::boost::type_traits::ice_or< ::boost::is_integral<T>::value, ::boost::is_enum<T>::value>::value)); - BOOST_STATIC_ASSERT( - (::boost::type_traits::ice_not< ::boost::is_same< - typename remove_cv<T>::type, bool>::value>::value)); +private: + BOOST_STATIC_ASSERT_MSG((::boost::is_integral<T>::value || ::boost::is_enum<T>::value), "The template argument to make_unsigned must be an integer or enum type."); + BOOST_STATIC_ASSERT_MSG((! ::boost::is_same<typename remove_cv<T>::type, bool>::value), "The template argument to make_unsigned must not be the type bool"); typedef typename remove_cv<T>::type t_no_cv; - typedef typename mpl::if_c< - (::boost::type_traits::ice_and< - ::boost::is_unsigned<T>::value, - ::boost::is_integral<T>::value, - ::boost::type_traits::ice_not< ::boost::is_same<t_no_cv, char>::value>::value, - ::boost::type_traits::ice_not< ::boost::is_same<t_no_cv, wchar_t>::value>::value, - ::boost::type_traits::ice_not< ::boost::is_same<t_no_cv, bool>::value>::value >::value), + typedef typename conditional< + (::boost::is_unsigned<T>::value && ::boost::is_integral<T>::value + && ! ::boost::is_same<t_no_cv, char>::value + && ! ::boost::is_same<t_no_cv, wchar_t>::value + && ! ::boost::is_same<t_no_cv, bool>::value), T, - typename mpl::if_c< - (::boost::type_traits::ice_and< - ::boost::is_integral<T>::value, - ::boost::type_traits::ice_not< ::boost::is_same<t_no_cv, char>::value>::value, - ::boost::type_traits::ice_not< ::boost::is_same<t_no_cv, wchar_t>::value>::value, - ::boost::type_traits::ice_not< ::boost::is_same<t_no_cv, bool>::value>::value> - ::value), - typename mpl::if_< - is_same<t_no_cv, signed char>, + typename conditional< + (::boost::is_integral<T>::value + && ! ::boost::is_same<t_no_cv, char>::value + && ! ::boost::is_same<t_no_cv, wchar_t>::value + && ! ::boost::is_same<t_no_cv, bool>::value), + typename conditional< + is_same<t_no_cv, signed char>::value, unsigned char, - typename mpl::if_< - is_same<t_no_cv, short>, + typename conditional< + is_same<t_no_cv, short>::value, unsigned short, - typename mpl::if_< - is_same<t_no_cv, int>, + typename conditional< + is_same<t_no_cv, int>::value, unsigned int, - typename mpl::if_< - is_same<t_no_cv, long>, + typename conditional< + is_same<t_no_cv, long>::value, unsigned long, #if defined(BOOST_HAS_LONG_LONG) #ifdef BOOST_HAS_INT128 - typename mpl::if_c< + typename conditional< sizeof(t_no_cv) == sizeof(boost::ulong_long_type), boost::ulong_long_type, boost::uint128_type @@ -89,21 +75,21 @@ struct make_unsigned_imp >::type >::type, // Not a regular integer type: - typename mpl::if_c< + typename conditional< sizeof(t_no_cv) == sizeof(unsigned char), unsigned char, - typename mpl::if_c< + typename conditional< sizeof(t_no_cv) == sizeof(unsigned short), unsigned short, - typename mpl::if_c< + typename conditional< sizeof(t_no_cv) == sizeof(unsigned int), unsigned int, - typename mpl::if_c< + typename conditional< sizeof(t_no_cv) == sizeof(unsigned long), unsigned long, #if defined(BOOST_HAS_LONG_LONG) #ifdef BOOST_HAS_INT128 - typename mpl::if_c< + typename conditional< sizeof(t_no_cv) == sizeof(boost::ulong_long_type), boost::ulong_long_type, boost::uint128_type @@ -124,28 +110,21 @@ struct make_unsigned_imp >::type base_integer_type; // Add back any const qualifier: - typedef typename mpl::if_< - is_const<T>, + typedef typename conditional< + is_const<T>::value, typename add_const<base_integer_type>::type, base_integer_type >::type const_base_integer_type; - +public: // Add back any volatile qualifier: - typedef typename mpl::if_< - is_volatile<T>, + typedef typename conditional< + is_volatile<T>::value, typename add_volatile<const_base_integer_type>::type, const_base_integer_type >::type type; }; - -} // namespace detail - -BOOST_TT_AUX_TYPE_TRAIT_DEF1(make_unsigned,T,typename boost::detail::make_unsigned_imp<T>::type) - } // namespace boost -#include <boost/type_traits/detail/type_trait_undef.hpp> - #endif // BOOST_TT_ADD_REFERENCE_HPP_INCLUDED diff --git a/boost/type_traits/promote.hpp b/boost/type_traits/promote.hpp index 60f6278bad..587617a287 100644 --- a/boost/type_traits/promote.hpp +++ b/boost/type_traits/promote.hpp @@ -10,31 +10,11 @@ #include <boost/type_traits/integral_promotion.hpp> #include <boost/type_traits/floating_point_promotion.hpp> -// Should be the last #include -#include <boost/type_traits/detail/type_trait_def.hpp> - namespace boost { -namespace detail { - -template<class T> -struct promote_impl - : public integral_promotion< - BOOST_DEDUCED_TYPENAME floating_point_promotion<T>::type - > -{ -}; +template<class T> struct promote : public integral_promotion<typename floating_point_promotion<T>::type>{}; } -BOOST_TT_AUX_TYPE_TRAIT_DEF1( - promote - , T - , BOOST_DEDUCED_TYPENAME boost::detail::promote_impl<T>::type - ) -} - -#include <boost/type_traits/detail/type_trait_undef.hpp> - #endif // #ifndef FILE_boost_type_traits_promote_hpp_INCLUDED diff --git a/boost/type_traits/rank.hpp b/boost/type_traits/rank.hpp index 33f46c8eb8..3dfc693687 100644 --- a/boost/type_traits/rank.hpp +++ b/boost/type_traits/rank.hpp @@ -10,8 +10,7 @@ #ifndef BOOST_TT_RANK_HPP_INCLUDED #define BOOST_TT_RANK_HPP_INCLUDED -// should be the last #include -#include <boost/type_traits/detail/size_t_trait_def.hpp> +#include <boost/type_traits/integral_constant.hpp> namespace boost { @@ -77,13 +76,11 @@ struct rank_imp<T const volatile[], N> #endif // !defined( __CODEGEARC__ ) #if defined( __CODEGEARC__ ) -BOOST_TT_AUX_SIZE_T_TRAIT_DEF1(rank,T,__array_rank(T)) +template <class T> struct rank : public integral_constant<std::size_t, __array_rank(T)>{}; #else -BOOST_TT_AUX_SIZE_T_TRAIT_DEF1(rank,T,(::boost::detail::rank_imp<T,0>::value)) +template <class T> struct rank : public integral_constant<std::size_t, (::boost::detail::rank_imp<T, 0>::value)>{}; #endif } // namespace boost -#include <boost/type_traits/detail/size_t_trait_undef.hpp> - #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/boost/type_traits/remove_all_extents.hpp b/boost/type_traits/remove_all_extents.hpp index 1409da12cb..3ccdc98281 100644 --- a/boost/type_traits/remove_all_extents.hpp +++ b/boost/type_traits/remove_all_extents.hpp @@ -13,28 +13,23 @@ #include <cstddef> #include <boost/detail/workaround.hpp> -// should be the last #include -#include <boost/type_traits/detail/type_trait_def.hpp> - namespace boost { -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_all_extents,T,T) +template <class T> struct remove_all_extents{ typedef T type; }; #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_all_extents,T[N],typename boost::remove_all_extents<T>::type type) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_all_extents,T const[N],typename boost::remove_all_extents<T const>::type type) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_all_extents,T volatile[N],typename boost::remove_all_extents<T volatile>::type type) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_all_extents,T const volatile[N],typename boost::remove_all_extents<T const volatile>::type type) +template <class T, std::size_t N> struct remove_all_extents<T[N]> : public remove_all_extents<T>{}; +template <class T, std::size_t N> struct remove_all_extents<T const[N]> : public remove_all_extents<T const>{}; +template <class T, std::size_t N> struct remove_all_extents<T volatile[N]> : public remove_all_extents<T volatile>{}; +template <class T, std::size_t N> struct remove_all_extents<T const volatile[N]> : public remove_all_extents<T const volatile>{}; #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_all_extents,T[],typename boost::remove_all_extents<T>::type) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_all_extents,T const[],typename boost::remove_all_extents<T const>::type) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_all_extents,T volatile[],typename boost::remove_all_extents<T volatile>::type) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_all_extents,T const volatile[],typename boost::remove_all_extents<T const volatile>::type) +template <class T> struct remove_all_extents<T[]> : public remove_all_extents<T>{}; +template <class T> struct remove_all_extents<T const[]> : public remove_all_extents<T const>{}; +template <class T> struct remove_all_extents<T volatile[]> : public remove_all_extents<T volatile>{}; +template <class T> struct remove_all_extents<T const volatile[]> : public remove_all_extents<T const volatile>{}; #endif #endif } // namespace boost -#include <boost/type_traits/detail/type_trait_undef.hpp> - #endif // BOOST_TT_REMOVE_BOUNDS_HPP_INCLUDED diff --git a/boost/type_traits/remove_bounds.hpp b/boost/type_traits/remove_bounds.hpp index 2d26348c69..56988d24e0 100644 --- a/boost/type_traits/remove_bounds.hpp +++ b/boost/type_traits/remove_bounds.hpp @@ -9,32 +9,13 @@ #ifndef BOOST_TT_REMOVE_BOUNDS_HPP_INCLUDED #define BOOST_TT_REMOVE_BOUNDS_HPP_INCLUDED -#include <boost/config.hpp> -#include <cstddef> -#include <boost/detail/workaround.hpp> +#include <boost/type_traits/remove_extent.hpp> -// should be the last #include -#include <boost/type_traits/detail/type_trait_def.hpp> +namespace boost +{ -namespace boost { - -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_bounds,T,T) - -#if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_bounds,T[N],T type) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_bounds,T const[N],T const type) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_bounds,T volatile[N],T volatile type) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_bounds,T const volatile[N],T const volatile type) -#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_bounds,T[],T) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_bounds,T const[],T const) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_bounds,T volatile[],T volatile) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_bounds,T const volatile[],T const volatile) -#endif -#endif +template <class T> struct remove_bounds : public remove_extent<T> {}; } // namespace boost -#include <boost/type_traits/detail/type_trait_undef.hpp> - #endif // BOOST_TT_REMOVE_BOUNDS_HPP_INCLUDED diff --git a/boost/type_traits/remove_const.hpp b/boost/type_traits/remove_const.hpp index 1020781383..b47f851460 100644 --- a/boost/type_traits/remove_const.hpp +++ b/boost/type_traits/remove_const.hpp @@ -11,69 +11,23 @@ #ifndef BOOST_TT_REMOVE_CONST_HPP_INCLUDED #define BOOST_TT_REMOVE_CONST_HPP_INCLUDED -#include <boost/type_traits/is_volatile.hpp> -#include <boost/type_traits/detail/cv_traits_impl.hpp> #include <boost/config.hpp> -#include <boost/detail/workaround.hpp> - #include <cstddef> - -// should be the last #include -#include <boost/type_traits/detail/type_trait_def.hpp> +#include <boost/detail/workaround.hpp> namespace boost { + // convert a type T to a non-cv-qualified type - remove_const<T> + template <class T> struct remove_const{ typedef T type; }; + template <class T> struct remove_const<T const>{ typedef T type; }; -namespace detail { - -template <typename T, bool is_vol> -struct remove_const_helper -{ - typedef T type; -}; - -template <typename T> -struct remove_const_helper<T, true> -{ - typedef T volatile type; -}; - - -template <typename T> -struct remove_const_impl -{ - typedef typename remove_const_helper< - typename cv_traits_imp<BOOST_TT_AUX_CV_TRAITS_IMPL_PARAM(T)>::unqualified_type - , ::boost::is_volatile<T>::value - >::type type; -}; - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -// -// We can't filter out rvalue_references at the same level as -// references or we get ambiguities from msvc: -// -template <typename T> -struct remove_const_impl<T&&> -{ - typedef T&& type; -}; -#endif - -} // namespace detail - -// * convert a type T to non-const type - remove_const<T> - -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_const,T,typename boost::detail::remove_const_impl<T>::type) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_const,T&,T&) #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_const,T const[N],T type[N]) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_const,T const volatile[N],T volatile type[N]) + template <class T, std::size_t N> struct remove_const<T const[N]>{ typedef T type[N]; }; +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) + template <class T> struct remove_const<T const[]>{ typedef T type[]; }; +#endif #endif - } // namespace boost -#include <boost/type_traits/detail/type_trait_undef.hpp> - #endif // BOOST_TT_REMOVE_CONST_HPP_INCLUDED diff --git a/boost/type_traits/remove_cv.hpp b/boost/type_traits/remove_cv.hpp index 9ba34a1eff..b50607f2ce 100644 --- a/boost/type_traits/remove_cv.hpp +++ b/boost/type_traits/remove_cv.hpp @@ -11,53 +11,30 @@ #ifndef BOOST_TT_REMOVE_CV_HPP_INCLUDED #define BOOST_TT_REMOVE_CV_HPP_INCLUDED -#include <boost/type_traits/detail/cv_traits_impl.hpp> #include <boost/config.hpp> #include <boost/detail/workaround.hpp> - #include <cstddef> -// should be the last #include -#include <boost/type_traits/detail/type_trait_def.hpp> - namespace boost { + // convert a type T to a non-cv-qualified type - remove_cv<T> +template <class T> struct remove_cv{ typedef T type; }; +template <class T> struct remove_cv<T const>{ typedef T type; }; +template <class T> struct remove_cv<T volatile>{ typedef T type; }; +template <class T> struct remove_cv<T const volatile>{ typedef T type; }; -namespace detail{ - -template <class T> -struct rvalue_ref_filter_rem_cv -{ - typedef typename boost::detail::cv_traits_imp<BOOST_TT_AUX_CV_TRAITS_IMPL_PARAM(T)>::unqualified_type type; -}; - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -// -// We can't filter out rvalue_references at the same level as -// references or we get ambiguities from msvc: -// -template <class T> -struct rvalue_ref_filter_rem_cv<T&&> -{ - typedef T&& type; -}; -#endif - -} - - -// convert a type T to a non-cv-qualified type - remove_cv<T> -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_cv,T,typename boost::detail::rvalue_ref_filter_rem_cv<T>::type) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_cv,T&,T&) #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_cv,T const[N],T type[N]) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_cv,T volatile[N],T type[N]) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_cv,T const volatile[N],T type[N]) +template <class T, std::size_t N> struct remove_cv<T const[N]>{ typedef T type[N]; }; +template <class T, std::size_t N> struct remove_cv<T const volatile[N]>{ typedef T type[N]; }; +template <class T, std::size_t N> struct remove_cv<T volatile[N]>{ typedef T type[N]; }; +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) +template <class T> struct remove_cv<T const[]>{ typedef T type[]; }; +template <class T> struct remove_cv<T const volatile[]>{ typedef T type[]; }; +template <class T> struct remove_cv<T volatile[]>{ typedef T type[]; }; +#endif #endif } // namespace boost -#include <boost/type_traits/detail/type_trait_undef.hpp> - #endif // BOOST_TT_REMOVE_CV_HPP_INCLUDED diff --git a/boost/type_traits/remove_extent.hpp b/boost/type_traits/remove_extent.hpp index 9c4cdff70b..0b50a07034 100644 --- a/boost/type_traits/remove_extent.hpp +++ b/boost/type_traits/remove_extent.hpp @@ -13,28 +13,23 @@ #include <boost/detail/workaround.hpp> #include <cstddef> -// should be the last #include -#include <boost/type_traits/detail/type_trait_def.hpp> - namespace boost { -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_extent,T,T) +template <class T> struct remove_extent{ typedef T type; }; #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_extent,T[N],T type) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_extent,T const[N],T const type) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_extent,T volatile[N],T volatile type) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_extent,T const volatile[N],T const volatile type) +template <typename T, std::size_t N> struct remove_extent<T[N]> { typedef T type; }; +template <typename T, std::size_t N> struct remove_extent<T const[N]> { typedef T const type; }; +template <typename T, std::size_t N> struct remove_extent<T volatile [N]> { typedef T volatile type; }; +template <typename T, std::size_t N> struct remove_extent<T const volatile [N]> { typedef T const volatile type; }; #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_extent,T[],T) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_extent,T const[],T const) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_extent,T volatile[],T volatile) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_extent,T const volatile[],T const volatile) +template <typename T> struct remove_extent<T[]> { typedef T type; }; +template <typename T> struct remove_extent<T const[]> { typedef T const type; }; +template <typename T> struct remove_extent<T volatile[]> { typedef T volatile type; }; +template <typename T> struct remove_extent<T const volatile[]> { typedef T const volatile type; }; #endif #endif } // namespace boost -#include <boost/type_traits/detail/type_trait_undef.hpp> - #endif // BOOST_TT_REMOVE_BOUNDS_HPP_INCLUDED diff --git a/boost/type_traits/remove_pointer.hpp b/boost/type_traits/remove_pointer.hpp index fef706860c..fb79e59d22 100644 --- a/boost/type_traits/remove_pointer.hpp +++ b/boost/type_traits/remove_pointer.hpp @@ -10,16 +10,12 @@ #define BOOST_TT_REMOVE_POINTER_HPP_INCLUDED #include <boost/config.hpp> -#include <boost/detail/workaround.hpp> #if defined(BOOST_MSVC) #include <boost/type_traits/remove_cv.hpp> #include <boost/type_traits/is_pointer.hpp> #endif -// should be the last #include -#include <boost/type_traits/detail/type_trait_def.hpp> - namespace boost { #ifdef BOOST_MSVC @@ -64,20 +60,18 @@ namespace detail{ }; } -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_pointer,T,typename boost::detail::remove_pointer_imp2<T>::type) +template <class T> struct remove_pointer{ typedef typename boost::detail::remove_pointer_imp2<T>::type type; }; #else -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_pointer,T,T) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_pointer,T*,T) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_pointer,T* const,T) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_pointer,T* volatile,T) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_pointer,T* const volatile,T) +template <class T> struct remove_pointer{ typedef T type; }; +template <class T> struct remove_pointer<T*>{ typedef T type; }; +template <class T> struct remove_pointer<T*const>{ typedef T type; }; +template <class T> struct remove_pointer<T*volatile>{ typedef T type; }; +template <class T> struct remove_pointer<T*const volatile>{ typedef T type; }; #endif } // namespace boost -#include <boost/type_traits/detail/type_trait_undef.hpp> - #endif // BOOST_TT_REMOVE_POINTER_HPP_INCLUDED diff --git a/boost/type_traits/remove_reference.hpp b/boost/type_traits/remove_reference.hpp index c59e7e35f4..f75e67783b 100644 --- a/boost/type_traits/remove_reference.hpp +++ b/boost/type_traits/remove_reference.hpp @@ -12,9 +12,6 @@ #include <boost/config.hpp> #include <boost/detail/workaround.hpp> -// should be the last #include -#include <boost/type_traits/detail/type_trait_def.hpp> - namespace boost { @@ -38,22 +35,20 @@ struct remove_rvalue_ref<T&&> } // namespace detail -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_reference,T,typename boost::detail::remove_rvalue_ref<T>::type) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_reference,T&,T) +template <class T> struct remove_reference{ typedef typename boost::detail::remove_rvalue_ref<T>::type type; }; +template <class T> struct remove_reference<T&>{ typedef T type; }; #if defined(BOOST_ILLEGAL_CV_REFERENCES) // these are illegal specialisations; cv-qualifies applied to // references have no effect according to [8.3.2p1], // C++ Builder requires them though as it treats cv-qualified // references as distinct types... -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_reference,T& const,T) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_reference,T& volatile,T) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_reference,T& const volatile,T) +template <class T> struct remove_reference<T&const>{ typedef T type; }; +template <class T> struct remove_reference<T&volatile>{ typedef T type; }; +template <class T> struct remove_reference<T&const volatile>{ typedef T type; }; #endif } // namespace boost -#include <boost/type_traits/detail/type_trait_undef.hpp> - #endif // BOOST_TT_REMOVE_REFERENCE_HPP_INCLUDED diff --git a/boost/type_traits/remove_volatile.hpp b/boost/type_traits/remove_volatile.hpp index c20277696d..475e39d22c 100644 --- a/boost/type_traits/remove_volatile.hpp +++ b/boost/type_traits/remove_volatile.hpp @@ -11,67 +11,24 @@ #ifndef BOOST_TT_REMOVE_VOLATILE_HPP_INCLUDED #define BOOST_TT_REMOVE_VOLATILE_HPP_INCLUDED -#include <boost/type_traits/is_const.hpp> -#include <boost/type_traits/detail/cv_traits_impl.hpp> #include <boost/config.hpp> #include <boost/detail/workaround.hpp> - #include <cstddef> -// should be the last #include -#include <boost/type_traits/detail/type_trait_def.hpp> - namespace boost { + // convert a type T to a non-cv-qualified type - remove_volatile<T> + template <class T> struct remove_volatile{ typedef T type; }; + template <class T> struct remove_volatile<T volatile>{ typedef T type; }; -namespace detail { - -template <typename T, bool is_const> -struct remove_volatile_helper -{ - typedef T type; -}; - -template <typename T> -struct remove_volatile_helper<T,true> -{ - typedef T const type; -}; - -template <typename T> -struct remove_volatile_impl -{ - typedef typename remove_volatile_helper< - typename cv_traits_imp<BOOST_TT_AUX_CV_TRAITS_IMPL_PARAM(T)>::unqualified_type - , ::boost::is_const<T>::value - >::type type; -}; - -// -// We can't filter out rvalue_references at the same level as -// references or we get ambiguities from msvc: -// -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -template <typename T> -struct remove_volatile_impl<T&&> -{ - typedef T&& type; -}; -#endif -} // namespace detail - -// * convert a type T to a non-volatile type - remove_volatile<T> - -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_volatile,T,typename boost::detail::remove_volatile_impl<T>::type) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_volatile,T&,T&) #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_volatile,T volatile[N],T type[N]) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_volatile,T const volatile[N],T const type[N]) + template <class T, std::size_t N> struct remove_volatile<T volatile[N]>{ typedef T type[N]; }; +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) + template <class T> struct remove_volatile<T volatile[]>{ typedef T type[]; }; +#endif #endif } // namespace boost -#include <boost/type_traits/detail/type_trait_undef.hpp> - #endif // BOOST_TT_REMOVE_VOLATILE_HPP_INCLUDED diff --git a/boost/type_traits/transform_traits_spec.hpp b/boost/type_traits/transform_traits_spec.hpp deleted file mode 100644 index b12b5f8e56..0000000000 --- a/boost/type_traits/transform_traits_spec.hpp +++ /dev/null @@ -1,14 +0,0 @@ - -// Copyright 2001 Aleksey Gurtovoy. -// Use, modification and distribution are subject to 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). -// -// See http://www.boost.org/libs/type_traits for most recent version including documentation. - -#ifndef BOOST_TT_TRANSFORM_TRAITS_HPP_INCLUDED -#define BOOST_TT_TRANSFORM_TRAITS_HPP_INCLUDED - -#include <boost/type_traits/config.hpp> - -#endif diff --git a/boost/type_traits/type_identity.hpp b/boost/type_traits/type_identity.hpp new file mode 100644 index 0000000000..6d2dd5b4dc --- /dev/null +++ b/boost/type_traits/type_identity.hpp @@ -0,0 +1,22 @@ +#ifndef BOOST_TYPE_TRAITS_TYPE_IDENTITY_HPP_INCLUDED +#define BOOST_TYPE_TRAITS_TYPE_IDENTITY_HPP_INCLUDED + +// +// Copyright 2015 Peter Dimov +// +// 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 +// + +namespace boost +{ + +template<class T> struct type_identity +{ + typedef T type; +}; + +} // namespace boost + +#endif // #ifndef BOOST_TYPE_TRAITS_TYPE_IDENTITY_HPP_INCLUDED diff --git a/boost/type_traits/type_with_alignment.hpp b/boost/type_traits/type_with_alignment.hpp index 7eb66a702f..ffa054a2f1 100644 --- a/boost/type_traits/type_with_alignment.hpp +++ b/boost/type_traits/type_with_alignment.hpp @@ -8,175 +8,83 @@ #ifndef BOOST_TT_TYPE_WITH_ALIGNMENT_INCLUDED #define BOOST_TT_TYPE_WITH_ALIGNMENT_INCLUDED -#include <boost/mpl/if.hpp> -#include <boost/preprocessor/list/for_each_i.hpp> -#include <boost/preprocessor/tuple/to_list.hpp> -#include <boost/preprocessor/cat.hpp> -#include <boost/preprocessor/list/transform.hpp> -#include <boost/preprocessor/list/append.hpp> #include <boost/type_traits/alignment_of.hpp> #include <boost/type_traits/is_pod.hpp> #include <boost/static_assert.hpp> #include <boost/config.hpp> - -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> - #include <cstddef> +#include <boost/detail/workaround.hpp> #ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable: 4121) // alignment is sensitive to packing #endif +#ifdef _MSC_VER +#include <boost/type_traits/conditional.hpp> +#endif + namespace boost { + namespace detail{ #ifndef __BORLANDC__ -namespace detail { - -class alignment_dummy; -typedef void (*function_ptr)(); -typedef int (alignment_dummy::*member_ptr); -typedef int (alignment_dummy::*member_function_ptr)(); - -#ifdef BOOST_HAS_LONG_LONG -#define BOOST_TT_ALIGNMENT_BASE_TYPES BOOST_PP_TUPLE_TO_LIST( \ - 12, ( \ - char, short, int, long, ::boost::long_long_type, float, double, long double \ - , void*, function_ptr, member_ptr, member_function_ptr)) -#else -#define BOOST_TT_ALIGNMENT_BASE_TYPES BOOST_PP_TUPLE_TO_LIST( \ - 11, ( \ - char, short, int, long, float, double, long double \ - , void*, function_ptr, member_ptr, member_function_ptr)) + union max_align + { + char c; + short s; + int i; + long l; +#ifndef BOOST_NO_LONG_LONG + boost::long_long_type ll; #endif +#ifdef BOOST_HAS_INT128 + boost::int128_type i128; +#endif + float f; + double d; + long double ld; +#ifdef BOOST_HAS_FLOAT128 + __float128 f128; +#endif + }; -#define BOOST_TT_HAS_ONE_T(D,Data,T) boost::detail::has_one_T< T > - -#define BOOST_TT_ALIGNMENT_STRUCT_TYPES \ - BOOST_PP_LIST_TRANSFORM(BOOST_TT_HAS_ONE_T, \ - X, \ - BOOST_TT_ALIGNMENT_BASE_TYPES) - -#define BOOST_TT_ALIGNMENT_TYPES \ - BOOST_PP_LIST_APPEND(BOOST_TT_ALIGNMENT_BASE_TYPES, \ - BOOST_TT_ALIGNMENT_STRUCT_TYPES) - -// -// lower_alignment_helper -- -// -// This template gets instantiated a lot, so use partial -// specialization when available to reduce the compiler burden. -// -template <bool found, std::size_t target, class TestType> -struct lower_alignment_helper -{ - typedef char type; - enum { value = true }; -}; - -template <std::size_t target, class TestType> -struct lower_alignment_helper<false,target,TestType> -{ - enum { value = (alignment_of<TestType>::value == target) }; - typedef typename mpl::if_c<value, TestType, char>::type type; -}; - -#define BOOST_TT_CHOOSE_MIN_ALIGNMENT(R,P,I,T) \ - typename lower_alignment_helper< \ - BOOST_PP_CAT(found,I),target,T \ - >::type BOOST_PP_CAT(t,I); \ - enum { \ - BOOST_PP_CAT(found,BOOST_PP_INC(I)) \ - = lower_alignment_helper<BOOST_PP_CAT(found,I),target,T >::value \ - }; - -#define BOOST_TT_CHOOSE_T(R,P,I,T) T BOOST_PP_CAT(t,I); - -template <typename T> -struct has_one_T -{ - T data; -}; - -template <std::size_t target> -union lower_alignment -{ - enum { found0 = false }; - - BOOST_PP_LIST_FOR_EACH_I( - BOOST_TT_CHOOSE_MIN_ALIGNMENT - , ignored - , BOOST_TT_ALIGNMENT_TYPES - ) -}; - -union max_align -{ - BOOST_PP_LIST_FOR_EACH_I( - BOOST_TT_CHOOSE_T - , ignored - , BOOST_TT_ALIGNMENT_TYPES - ) -}; - -#undef BOOST_TT_ALIGNMENT_BASE_TYPES -#undef BOOST_TT_HAS_ONE_T -#undef BOOST_TT_ALIGNMENT_STRUCT_TYPES -#undef BOOST_TT_ALIGNMENT_TYPES -#undef BOOST_TT_CHOOSE_MIN_ALIGNMENT -#undef BOOST_TT_CHOOSE_T - -template<std::size_t TAlign, std::size_t Align> -struct is_aligned -{ - BOOST_STATIC_CONSTANT(bool, - value = (TAlign >= Align) & (TAlign % Align == 0) - ); -}; - +template <std::size_t Target, bool check> struct long_double_alignment{ typedef long double type; }; +template <std::size_t Target> struct long_double_alignment<Target, false>{ typedef boost::detail::max_align type; }; -} // namespace detail +template <std::size_t Target, bool check> struct double_alignment{ typedef double type; }; +template <std::size_t Target> struct double_alignment<Target, false>{ typedef typename long_double_alignment<Target, boost::alignment_of<long double>::value >= Target>::type type; }; -template<std::size_t Align> -struct is_pod< ::boost::detail::lower_alignment<Align> > -{ - BOOST_STATIC_CONSTANT(std::size_t, value = true); -}; - -// This alignment method originally due to Brian Parker, implemented by David -// Abrahams, and then ported here by Doug Gregor. -namespace detail{ +#ifndef BOOST_NO_LONG_LONG +template <std::size_t Target, bool check> struct long_long_alignment{ typedef boost::long_long_type type; }; +template <std::size_t Target> struct long_long_alignment<Target, false>{ typedef typename double_alignment<Target, boost::alignment_of<double>::value >= Target>::type type; }; +#endif -template <std::size_t Align> -class type_with_alignment_imp -{ - typedef ::boost::detail::lower_alignment<Align> t1; - typedef typename mpl::if_c< - ::boost::detail::is_aligned< ::boost::alignment_of<t1>::value,Align >::value - , t1 - , ::boost::detail::max_align - >::type align_t; +template <std::size_t Target, bool check> struct long_alignment{ typedef long type; }; +#ifndef BOOST_NO_LONG_LONG +template <std::size_t Target> struct long_alignment<Target, false>{ typedef typename long_long_alignment<Target, boost::alignment_of<boost::long_long_type>::value >= Target>::type type; }; +#else +template <std::size_t Target> struct long_alignment<Target, false>{ typedef typename double_alignment<Target, boost::alignment_of<double>::value >= Target>::type type; }; +#endif - BOOST_STATIC_CONSTANT(std::size_t, found = alignment_of<align_t>::value); +template <std::size_t Target, bool check> struct int_alignment{ typedef int type; }; +template <std::size_t Target> struct int_alignment<Target, false>{ typedef typename long_alignment<Target, boost::alignment_of<long>::value >= Target>::type type; }; - BOOST_STATIC_ASSERT(found >= Align); - BOOST_STATIC_ASSERT(found % Align == 0); +template <std::size_t Target, bool check> struct short_alignment{ typedef short type; }; +template <std::size_t Target> struct short_alignment<Target, false>{ typedef typename int_alignment<Target, boost::alignment_of<int>::value >= Target>::type type; }; - public: - typedef align_t type; -}; +template <std::size_t Target, bool check> struct char_alignment{ typedef char type; }; +template <std::size_t Target> struct char_alignment<Target, false>{ typedef typename short_alignment<Target, boost::alignment_of<short>::value >= Target>::type type; }; } template <std::size_t Align> -class type_with_alignment - : public ::boost::detail::type_with_alignment_imp<Align> +struct type_with_alignment { + typedef typename boost::detail::char_alignment<Align, boost::alignment_of<char>::value >= Align>::type type; }; -#if defined(__GNUC__) || (defined (__SUNPRO_CC) && (__SUNPRO_CC >= 0x5130)) +#if (defined(__GNUC__) || (defined (__SUNPRO_CC) && (__SUNPRO_CC >= 0x5130)) || defined(__clang__)) && !defined(BOOST_TT_DISABLE_INTRINSICS) namespace tt_align_ns { struct __attribute__((__aligned__(2))) a2 {}; struct __attribute__((__aligned__(4))) a4 {}; @@ -187,26 +95,25 @@ struct __attribute__((__aligned__(64))) a64 {}; struct __attribute__((__aligned__(128))) a128 {}; } -template<> class type_with_alignment<1> { public: typedef char type; }; -template<> class type_with_alignment<2> { public: typedef tt_align_ns::a2 type; }; -template<> class type_with_alignment<4> { public: typedef tt_align_ns::a4 type; }; -template<> class type_with_alignment<8> { public: typedef tt_align_ns::a8 type; }; -template<> class type_with_alignment<16> { public: typedef tt_align_ns::a16 type; }; -template<> class type_with_alignment<32> { public: typedef tt_align_ns::a32 type; }; -template<> class type_with_alignment<64> { public: typedef tt_align_ns::a64 type; }; -template<> class type_with_alignment<128> { public: typedef tt_align_ns::a128 type; }; +template<> struct type_with_alignment<1> { public: typedef char type; }; +template<> struct type_with_alignment<2> { public: typedef tt_align_ns::a2 type; }; +template<> struct type_with_alignment<4> { public: typedef tt_align_ns::a4 type; }; +template<> struct type_with_alignment<8> { public: typedef tt_align_ns::a8 type; }; +template<> struct type_with_alignment<16> { public: typedef tt_align_ns::a16 type; }; +template<> struct type_with_alignment<32> { public: typedef tt_align_ns::a32 type; }; +template<> struct type_with_alignment<64> { public: typedef tt_align_ns::a64 type; }; +template<> struct type_with_alignment<128> { public: typedef tt_align_ns::a128 type; }; + +template<> struct is_pod< ::boost::tt_align_ns::a2> : public true_type{}; +template<> struct is_pod< ::boost::tt_align_ns::a4> : public true_type{}; +template<> struct is_pod< ::boost::tt_align_ns::a8> : public true_type{}; +template<> struct is_pod< ::boost::tt_align_ns::a16> : public true_type{}; +template<> struct is_pod< ::boost::tt_align_ns::a32> : public true_type{}; +template<> struct is_pod< ::boost::tt_align_ns::a64> : public true_type{}; +template<> struct is_pod< ::boost::tt_align_ns::a128> : public true_type{}; -namespace detail { -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a2,true) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a4,true) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a8,true) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a16,true) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a32,true) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a64,true) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a128,true) -} #endif -#if defined(BOOST_MSVC) || (defined(BOOST_INTEL) && defined(_MSC_VER)) +#if (defined(BOOST_MSVC) || (defined(BOOST_INTEL) && defined(_MSC_VER))) && !defined(BOOST_TT_DISABLE_INTRINSICS) // // MSVC supports types which have alignments greater than the normal // maximum: these are used for example in the types __m64 and __m128 @@ -247,57 +154,56 @@ struct __declspec(align(128)) a128 { }; } -template<> class type_with_alignment<8> +template<> struct type_with_alignment<8> { - typedef mpl::if_c< + typedef boost::conditional< ::boost::alignment_of<boost::detail::max_align>::value < 8, tt_align_ns::a8, - boost::detail::type_with_alignment_imp<8> >::type t1; + boost::detail::char_alignment<8, false> >::type t1; public: typedef t1::type type; }; -template<> class type_with_alignment<16> +template<> struct type_with_alignment<16> { - typedef mpl::if_c< + typedef boost::conditional< ::boost::alignment_of<boost::detail::max_align>::value < 16, tt_align_ns::a16, - boost::detail::type_with_alignment_imp<16> >::type t1; + boost::detail::char_alignment<16, false> >::type t1; public: typedef t1::type type; }; -template<> class type_with_alignment<32> +template<> struct type_with_alignment<32> { - typedef mpl::if_c< + typedef boost::conditional< ::boost::alignment_of<boost::detail::max_align>::value < 32, tt_align_ns::a32, - boost::detail::type_with_alignment_imp<32> >::type t1; + boost::detail::char_alignment<32, false> >::type t1; public: typedef t1::type type; }; -template<> class type_with_alignment<64> { - typedef mpl::if_c< +template<> struct type_with_alignment<64> { + typedef boost::conditional< ::boost::alignment_of<boost::detail::max_align>::value < 64, tt_align_ns::a64, - boost::detail::type_with_alignment_imp<64> >::type t1; + boost::detail::char_alignment<64, false> >::type t1; public: typedef t1::type type; }; -template<> class type_with_alignment<128> { - typedef mpl::if_c< +template<> struct type_with_alignment<128> { + typedef boost::conditional< ::boost::alignment_of<boost::detail::max_align>::value < 128, tt_align_ns::a128, - boost::detail::type_with_alignment_imp<128> >::type t1; + boost::detail::char_alignment<128, false> >::type t1; public: typedef t1::type type; }; -namespace detail { -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a8,true) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a16,true) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a32,true) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a64,true) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a128,true) -} +template<> struct is_pod< ::boost::tt_align_ns::a8> : public true_type{}; +template<> struct is_pod< ::boost::tt_align_ns::a16> : public true_type{}; +template<> struct is_pod< ::boost::tt_align_ns::a32> : public true_type{}; +template<> struct is_pod< ::boost::tt_align_ns::a64> : public true_type{}; +template<> struct is_pod< ::boost::tt_align_ns::a128> : public true_type{}; + #endif #else @@ -321,13 +227,13 @@ namespace detail { typedef ::boost::tt_align_ns::a16 max_align; +} //#if ! BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610)) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a2,true) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a4,true) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a8,true) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a16,true) +template <> struct is_pod< ::boost::tt_align_ns::a2> : public true_type{}; +template <> struct is_pod< ::boost::tt_align_ns::a4> : public true_type{}; +template <> struct is_pod< ::boost::tt_align_ns::a8> : public true_type{}; +template <> struct is_pod< ::boost::tt_align_ns::a16> : public true_type{}; //#endif -} template <std::size_t N> struct type_with_alignment { @@ -350,8 +256,6 @@ template <> struct type_with_alignment<16>{ typedef tt_align_ns::a16 type; }; # pragma warning(pop) #endif -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_TYPE_WITH_ALIGNMENT_INCLUDED |