From b8a9d9030d402496a310acdc4b5ec15dc65dc3a0 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 20 Jul 2002 08:20:00 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2976 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../boost/type_traits/alignment_traits.hpp | 208 ++++ .../boost/type_traits/arithmetic_traits.hpp | 266 +++++ include/boost/type_traits/array_traits.hpp | 85 ++ .../boost/type_traits/composite_traits.hpp | 990 ++++++++++++++++++ .../boost/type_traits/conversion_traits.hpp | 328 ++++++ include/boost/type_traits/cv_traits.hpp | 399 +++++++ include/boost/type_traits/function_traits.hpp | 153 +++ include/boost/type_traits/fwd.hpp | 201 ++++ include/boost/type_traits/ice.hpp | 87 ++ include/boost/type_traits/is_class.hpp | 49 + include/boost/type_traits/object_traits.hpp | 562 ++++++++++ .../boost/type_traits/reference_traits.hpp | 90 ++ include/boost/type_traits/same_traits.hpp | 108 ++ .../boost/type_traits/transform_traits.hpp | 199 ++++ .../type_traits/transform_traits_spec.hpp | 78 ++ .../boost/type_traits/type_traits_test.hpp | 434 ++++++++ include/boost/type_traits/utility.hpp | 24 + 17 files changed, 4261 insertions(+) create mode 100644 include/boost/type_traits/alignment_traits.hpp create mode 100644 include/boost/type_traits/arithmetic_traits.hpp create mode 100644 include/boost/type_traits/array_traits.hpp create mode 100644 include/boost/type_traits/composite_traits.hpp create mode 100644 include/boost/type_traits/conversion_traits.hpp create mode 100644 include/boost/type_traits/cv_traits.hpp create mode 100644 include/boost/type_traits/function_traits.hpp create mode 100644 include/boost/type_traits/fwd.hpp create mode 100644 include/boost/type_traits/ice.hpp create mode 100644 include/boost/type_traits/is_class.hpp create mode 100644 include/boost/type_traits/object_traits.hpp create mode 100644 include/boost/type_traits/reference_traits.hpp create mode 100644 include/boost/type_traits/same_traits.hpp create mode 100644 include/boost/type_traits/transform_traits.hpp create mode 100644 include/boost/type_traits/transform_traits_spec.hpp create mode 100644 include/boost/type_traits/type_traits_test.hpp create mode 100644 include/boost/type_traits/utility.hpp diff --git a/include/boost/type_traits/alignment_traits.hpp b/include/boost/type_traits/alignment_traits.hpp new file mode 100644 index 00000000000..b509f673619 --- /dev/null +++ b/include/boost/type_traits/alignment_traits.hpp @@ -0,0 +1,208 @@ + +// (C) Copyright John Maddock 2000. +// Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// +// defines alignment_of: + +#ifndef ALIGNMENT_TYPE_TRAITS_HPP +#define ALIGNMENT_TYPE_TRAITS_HPP + +#include +#include +#ifndef BOOST_ICE_TYPE_TRAITS_HPP +#include +#endif +#include +#include +#include +#include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable: 4121) // alignment is sensitive to packing +#endif + +namespace boost{ +template struct alignment_of; + +// +// get the alignment of some arbitrary type: +namespace detail{ + +template +struct alignment_of_hack +{ + char c; + T t; + alignment_of_hack(); +}; + + +template +struct alignment_logic +{ + BOOST_STATIC_CONSTANT(std::size_t, value = A < S ? A : S); +}; + +} // namespace detail + +template +struct alignment_of +{ + BOOST_STATIC_CONSTANT(std::size_t, value = + (::boost::detail::alignment_logic< + sizeof(detail::alignment_of_hack) - sizeof(T), + sizeof(T) + >::value)); +}; + +// +// references have to be treated specially, assume +// that a reference is just a special pointer: +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template +struct alignment_of +{ +public: + BOOST_STATIC_CONSTANT(std::size_t, value = ::boost::alignment_of::value); +}; +#endif +// +// void has to be treated specially: +template <> +struct alignment_of +{ BOOST_STATIC_CONSTANT(std::size_t, value = 0); }; +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +template <> +struct alignment_of +{ BOOST_STATIC_CONSTANT(std::size_t, value = 0); }; +template <> +struct alignment_of +{ BOOST_STATIC_CONSTANT(std::size_t, value = 0); }; +template <> +struct alignment_of +{ BOOST_STATIC_CONSTANT(std::size_t, value = 0); }; +#endif + +namespace detail { +class alignment_dummy; +typedef void (*function_ptr)(); +typedef int (alignment_dummy::*member_ptr); +typedef int (alignment_dummy::*member_function_ptr)(); + +/* + * The ct_if implementation is temporary code. It will be replaced with MPL + * in the future... + */ +struct select_then +{ + template + struct result + { + typedef Then type; + }; +}; + +struct select_else +{ + template + struct result + { + typedef Else type; + }; +}; + +template +struct ct_if_selector +{ + typedef select_then type; +}; + +template<> +struct ct_if_selector +{ + typedef select_else type; +}; + +template +struct ct_if +{ + typedef typename ct_if_selector::type select; + typedef typename select::template result::type type; +}; + +#define BOOST_TT_ALIGNMENT_TYPES BOOST_PP_TUPLE_TO_LIST( \ + 11, ( \ + char, short, int, long, float, double, long double \ + , void*, function_ptr, member_ptr, member_function_ptr)) + +#define BOOST_TT_CHOOSE_LOWER_ALIGNMENT(R,P,I,T) \ + typename ct_if< \ + alignment_of::value <= target, T, char>::type BOOST_PP_CAT(t,I); + +#define BOOST_TT_CHOOSE_T(R,P,I,T) T BOOST_PP_CAT(t,I); + +template +union lower_alignment +{ + BOOST_PP_LIST_FOR_EACH_I( + BOOST_TT_CHOOSE_LOWER_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_TYPES +#undef BOOST_TT_CHOOSE_LOWER_ALIGNMENT +#undef BOOST_TT_CHOOSE_T + +template +struct is_aligned +{ + BOOST_STATIC_CONSTANT(bool, + value = (TAlign >= Align) & (TAlign % Align == 0)); +}; + +} + +// This alignment method originally due to Brian Parker, implemented by David +// Abrahams, and then ported here by Doug Gregor. +template +class type_with_alignment +{ + typedef detail::lower_alignment t1; + + typedef type_with_alignment this_type; + + typedef typename detail::ct_if< + (detail::is_aligned<(alignment_of::value), Align>::value) + , t1 + , detail::max_align + >::type align_t; + + BOOST_STATIC_CONSTANT(std::size_t, found = alignment_of::value); + + BOOST_STATIC_ASSERT(found >= Align); + BOOST_STATIC_ASSERT(found % Align == 0); + +public: + typedef align_t type; +}; + +} // namespace boost + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +#endif // ALIGNMENT_TYPE_TRAITS_HPP diff --git a/include/boost/type_traits/arithmetic_traits.hpp b/include/boost/type_traits/arithmetic_traits.hpp new file mode 100644 index 00000000000..1d111c4b984 --- /dev/null +++ b/include/boost/type_traits/arithmetic_traits.hpp @@ -0,0 +1,266 @@ +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. +// +// See http://www.boost.org for most recent version including documentation. +// +// defines traits classes for arithmetic types: +// is_void, is_integral, is_float, is_arithmetic, is_fundamental. +// + +// Revision History: +// Feb 19 2001 Added #include (David Abrahams) + +#ifndef BOOST_ARITHMETIC_TYPE_TRAITS_HPP +#define BOOST_ARITHMETIC_TYPE_TRAITS_HPP + +#ifndef BOOST_ICE_TYPE_TRAITS_HPP +#include +#endif +#ifndef BOOST_FWD_TYPE_TRAITS_HPP +#include +#endif + +#include // for ULLONG_MAX/ULONG_LONG_MAX + +namespace boost{ + +//* is a type T void - is_void +template struct is_void{ BOOST_STATIC_CONSTANT(bool, value = false); }; +template <> struct is_void{ BOOST_STATIC_CONSTANT(bool, value = true); }; + +//* is a type T an [cv-qualified-] integral type described in the standard (3.9.1p3) +// as an extention we include long long, as this is likely to be added to the +// standard at a later date +template struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = false); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +#endif +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; + +# if defined(BOOST_HAS_LONG_LONG) +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +#elif defined(BOOST_HAS_MS_INT64) +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral<__int64> +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +#endif + +//* is a type T a floating-point type described in the standard (3.9.1p8) +template struct is_float +{ BOOST_STATIC_CONSTANT(bool, value = false); }; +template <> struct is_float +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_float +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_float +{ BOOST_STATIC_CONSTANT(bool, value = true); }; + +// +// declare cv-qualified specialisations of these templates only +// if BOOST_NO_CV_SPECIALIZATIONS is not defined: +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +template <> struct is_void +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_void +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_void +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +#endif +#ifndef BOOST_NO_CV_SPECIALIZATIONS +// const-variations: +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +#endif +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; + +# if defined(BOOST_HAS_LONG_LONG) +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +#elif defined(BOOST_HAS_MS_INT64) +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +#endif //__int64 + +template <> struct is_float +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_float +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_float +{ BOOST_STATIC_CONSTANT(bool, value = true); }; + +// volatile-variations: +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +#endif +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; + +# if defined(BOOST_HAS_LONG_LONG) +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +#elif defined(BOOST_HAS_MS_INT64) +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +#endif //__int64 + +template <> struct is_float +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_float +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_float +{ BOOST_STATIC_CONSTANT(bool, value = true); }; + +// const-volatile-variations: +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +#endif +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; + +# if defined(BOOST_HAS_LONG_LONG) +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +#elif defined(BOOST_HAS_MS_INT64) +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_integral +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +#endif //__int64 + +template <> struct is_float +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_float +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_float +{ BOOST_STATIC_CONSTANT(bool, value = true); }; + +#endif // BOOST_NO_CV_SPECIALIZATIONS + +//* is a type T an arithmetic type described in the standard (3.9.1p8) +template +struct is_arithmetic +{ + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_or< + ::boost::is_integral::value, + ::boost::is_float::value + >::value)); +}; + +//* is a type T a fundamental type described in the standard (3.9.1) +template +struct is_fundamental +{ + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_or< + ::boost::is_arithmetic::value, + ::boost::is_void::value + >::value)); +}; + +} // namespace boost + +#endif + + + + + + + diff --git a/include/boost/type_traits/array_traits.hpp b/include/boost/type_traits/array_traits.hpp new file mode 100644 index 00000000000..04f8488522e --- /dev/null +++ b/include/boost/type_traits/array_traits.hpp @@ -0,0 +1,85 @@ +// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard +// Hinnant & John Maddock 2000. Permission to copy, use, modify, +// sell and distribute this software is granted provided this +// copyright notice appears in all copies. This software is provided +// "as is" without express or implied warranty, and with no claim as +// to its suitability for any purpose. +// +// See http://www.boost.org for most recent version including documentation. +// +#ifndef BOOST_TT_ARRAY_TRAITS_HPP +# define BOOST_TT_ARRAY_TRAITS_HPP +# include + +namespace boost { + +/********************************************** + * + * is_array + * + **********************************************/ +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template struct is_array +{ BOOST_STATIC_CONSTANT(bool, value = false); }; +template struct is_array +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template struct is_array +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template struct is_array +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template struct is_array +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +namespace detail +{ + using ::boost::type_traits::yes_type; + using ::boost::type_traits::no_type; + using ::boost::type_traits::wrap; + + template T(* is_array_helper1(wrap) )(wrap); + char is_array_helper1(...); + + template no_type is_array_helper2(T(*)(wrap)); + yes_type is_array_helper2(...); +} + +template +struct is_array +{ +public: + BOOST_STATIC_CONSTANT( + bool, value = sizeof( + ::boost::detail::is_array_helper2( + ::boost::detail::is_array_helper1( + ::boost::type_traits::wrap()))) == 1 + ); +}; + +template <> +struct is_array +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +# ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +template <> +struct is_array +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +template <> +struct is_array +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +template <> +struct is_array +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +# endif +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +} // namespace boost + +#endif // BOOST_TT_ARRAY_TRAITS_HPP diff --git a/include/boost/type_traits/composite_traits.hpp b/include/boost/type_traits/composite_traits.hpp new file mode 100644 index 00000000000..4a4980ec2b2 --- /dev/null +++ b/include/boost/type_traits/composite_traits.hpp @@ -0,0 +1,990 @@ +// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard +// Hinnant & John Maddock 2000. Permission to copy, use, modify, +// sell and distribute this software is granted provided this +// copyright notice appears in all copies. This software is provided +// "as is" without express or implied warranty, and with no claim as +// to its suitability for any purpose. +// +// See http://www.boost.org for most recent version including documentation. +// +// defines traits classes for composite types: +// is_array, is_pointer, is_reference, is_member_pointer, is_enum, is_union. +// +// Fixed is_pointer, is_reference, is_const, is_volatile, is_same, +// is_member_pointer based on the Simulated Partial Specialization work +// of Mat Marcus and Jesse Jones. See http://opensource.adobe.com or +// http://groups.yahoo.com/group/boost/message/5441 +// Some workarounds in here use ideas suggested from "Generic: +// Mappings between Types and Values" +// by Andrei Alexandrescu (see http://www.cuj.com/experts/1810/alexandr.html). +// Fixes for is_array are based on a newgroup posting by Jonathan Lundquist. + +// +// Revision History: +// 21st March 2001: +// Fixed is_enum so that it works with incomplete types. + +#ifndef BOOST_COMPOSITE_TYPE_TRAITS_HPP +#define BOOST_COMPOSITE_TYPE_TRAITS_HPP + +#ifndef BOOST_ICE_TYPE_TRAITS_HPP +# include +#endif +#ifndef BOOST_FWD_TYPE_TRAITS_HPP +# include +#endif +#ifndef BOOST_CONVERSION_TYPE_TRAITS_HPP +# include +#endif +#ifndef BOOST_CV_TYPE_TRAITS_HPP +# include +#endif +#ifndef BOOST_ARITHMETIC_TYPE_TRAITS_HPP +# include +#endif +#ifndef BOOST_TRANSFORM_TRAITS_HPP +# include +#endif +#ifndef BOOST_TT_REFERENCE_TRAITS_HPP +# include +#endif +#ifndef BOOST_TT_ARRAY_TRAITS_HPP +# include +#endif +#ifndef BOOST_TYPE_TRAITS_IS_CLASS_HPP +# include +#endif + +namespace boost{ + +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +namespace detail{ + + struct pointer_helper + { + pointer_helper(const volatile void*); + }; + yes_type BOOST_TT_DECL is_pointer_helper(pointer_helper); + no_type BOOST_TT_DECL is_pointer_helper(...); + +::boost::type_traits::no_type BOOST_TT_DECL is_function_tester(...); +template +::boost::type_traits::yes_type is_function_tester(R (*)(void)); +template +::boost::type_traits::yes_type is_function_tester(R (*)(A0)); +template +::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1)); +template +::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1, A2)); +template +::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1, A2, A3)); +template +::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1, A2, A3, A4)); +template +::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1, A2, A3, A4, A5)); +template +::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1, A2, A3, A4, A5, A6)); +template +::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1, A2, A3, A4, A5, A6, A7)); +template +::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1, A2, A3, A4, A5, A6, A7, A8)); +template +::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)); +template +::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)); +template +::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11)); +template +::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12)); +template +::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13)); +template +::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14)); +template +::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15)); +template +::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16)); +template +::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17)); +template +::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18)); +template +::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19)); +template +::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20)); +template +::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21)); +template +::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22)); +template +::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23)); +template +::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24)); +template +::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25)); +template +::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26)); +template +::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26, A27)); +template +::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26, A27, A28)); +template +::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26, A27, A28, A29)); +} // namespace detail +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +namespace detail +{ + // Utility metafunction which returns true if its argument is not an + // array and not a reference. + template + struct neither_array_nor_reference : ::boost::type_traits::ice_not< + ::boost::type_traits::ice_or< + ::boost::is_reference::value + , ::boost::is_array::value + >::value> + {}; +} + +/********************************************** + * + * is_pointer + * + **********************************************/ +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +namespace detail{ +template struct is_pointer_helper +{ BOOST_STATIC_CONSTANT(bool, value = false); }; +template struct is_pointer_helper +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template struct is_pointer_helper +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template struct is_pointer_helper +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template struct is_pointer_helper +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +} // namespace detail +template struct is_pointer +{ BOOST_STATIC_CONSTANT(bool, value = (::boost::type_traits::ice_and< ::boost::detail::is_pointer_helper::value, ::boost::type_traits::ice_not< ::boost::is_member_pointer::value >::value >::value)); }; +#else + +namespace detail +{ + // is_pointer implementation + template + struct is_pointer_select : ::boost::type_traits::false_unary_metafunction + { + }; + + template <> + struct is_pointer_select + { + template + struct apply + { + static T& make_t(); + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_or< + (1 == sizeof(is_pointer_helper(make_t()))), + (1 == sizeof(is_function_tester(make_t()))) + >::value)); + }; + }; +} + +template +struct is_pointer : ::boost::detail::is_pointer_select< + ::boost::detail::neither_array_nor_reference::value +>::template apply +{}; + +template <> +struct is_pointer +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +template <> +struct is_pointer +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +template <> +struct is_pointer +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +template <> +struct is_pointer +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +#endif +#endif + +/********************************************** + * + * is_union + * + **********************************************/ +template struct is_union +{ +private: + typedef typename remove_cv::type cvt; +public: + BOOST_STATIC_CONSTANT(bool, value = BOOST_IS_UNION(cvt)); +}; + +/********************************************** + * + * is_enum + * + **********************************************/ +namespace detail +{ + struct int_convertible + { + int_convertible(int); + }; + + // Don't evaluate convertibility to int_convertible unless the type + // is non-arithmetic. This suppresses warnings with GCC. + template + struct is_enum_helper + { + template + struct type + { + BOOST_STATIC_CONSTANT(bool, value = false); + }; + }; + + template <> + struct is_enum_helper + { + template + struct type + : ::boost::is_convertible + { + }; + }; +} // namespace detail +#if !(defined(__BORLANDC__) && (__BORLANDC__ <= 0x551)) +template struct is_enum +{ +private: + typedef ::boost::add_reference ar_t; + typedef typename ar_t::type r_type; + +# if (defined(__MWERKS__) && __MWERKS__ >= 0x3000) || BOOST_MSVC > 1301 || defined(BOOST_NO_COMPILER_CONFIG) + BOOST_STATIC_CONSTANT(bool, selector = + (::boost::type_traits::ice_or< + ::boost::is_arithmetic::value + , ::boost::is_reference::value + // We MUST do this on conforming compilers in order to + // correctly deduce that noncopyable types are not enums (dwa + // 2002/04/15)... + , ::boost::is_class::value + >::value)); +# else + BOOST_STATIC_CONSTANT(bool, selector = + (::boost::type_traits::ice_or< + ::boost::is_arithmetic::value + , ::boost::is_reference::value + // However, not doing this on non-conforming compilers prevents + // a dependency recursion. + >::value)); +# endif +#ifdef __BORLANDC__ + typedef ::boost::detail::is_enum_helper< ::boost::is_enum::selector> se_t; +#else + typedef ::boost::detail::is_enum_helper se_t; +#endif + typedef typename se_t::template type helper; +public: + BOOST_STATIC_CONSTANT(bool, value = helper::value); +}; + +// Specializations suppress some nasty warnings with GCC +template<> +struct is_enum +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +template<> +struct is_enum +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +template<> +struct is_enum +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +#else // __BORLANDC__ +// +// buggy is_convertible prevents working +// implementation of is_enum: +template struct is_enum +{ +public: + BOOST_STATIC_CONSTANT(bool, value = BOOST_IS_ENUM(T)); +}; +#endif + +/********************************************** + * + * is_member_pointer + * + **********************************************/ +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(__BORLANDC__) +template struct is_member_pointer +{ BOOST_STATIC_CONSTANT(bool, value = ::boost::is_member_function_pointer::value); }; +template struct is_member_pointer +{ BOOST_STATIC_CONSTANT(bool, value = true); }; + +/********************************************** + * + * is_member_function_pointer + * + **********************************************/ +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = false); }; + +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; + +// Metrowerks thinks this creates ambiguities +# if !defined(__MWERKS__) || __MWERKS__ >= 0x3000 + +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; + +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; + +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_member_function_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); }; + +# endif // __MWERKS__ < 0x3000 +#else + +namespace detail{ +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(void)); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0)); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1)); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2)); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3)); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4)); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5)); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6)); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7)); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8)); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11)); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12)); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13)); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14)); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15)); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16)); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17)); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18)); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19)); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20)); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21)); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22)); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23)); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24)); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25)); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26)); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26, A27)); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26, A27, A28)); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26, A27, A28, A29)); + +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(void) const); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0) const); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1) const); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2) const); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3) const); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4) const); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5) const); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6) const); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7) const); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8) const); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9) const); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10) const); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11) const); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12) const); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13) const); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14) const); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15) const); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16) const); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17) const); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18) const); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19) const); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20) const); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21) const); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22) const); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23) const); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24) const); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25) const); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26) const); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26, A27) const); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26, A27, A28) const); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26, A27, A28, A29) const); + +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(void) volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0) volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1) volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2) volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3) volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4) volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5) volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6) volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7) volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8) volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9) volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10) volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11) volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12) volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13) volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14) volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15) volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16) volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17) volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18) volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19) volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20) volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21) volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22) volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23) volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24) volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25) volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26) volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26, A27) volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26, A27, A28) volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26, A27, A28, A29) volatile); + +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(void) const volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0) const volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1) const volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2) const volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3) const volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4) const volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5) const volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6) const volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7) const volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8) const volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9) const volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10) const volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11) const volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12) const volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13) const volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14) const volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15) const volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16) const volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17) const volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18) const volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19) const volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20) const volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21) const volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22) const volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23) const volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24) const volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25) const volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26) const volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26, A27) const volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26, A27, A28) const volatile); +template +::boost::type_traits::yes_type is_member_function_pointer_helper(R (T::*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26, A27, A28, A29) const volatile); +::boost::type_traits::no_type BOOST_TT_DECL is_member_function_pointer_helper(...); + +template +::boost::type_traits::yes_type BOOST_TT_DECL is_member_pointer_helper(R T::*); +::boost::type_traits::no_type BOOST_TT_DECL is_member_pointer_helper(...); + +} + +namespace detail +{ + template + struct is_member_function_pointer_select + : ::boost::type_traits::false_unary_metafunction + { + }; + + template <> + struct is_member_function_pointer_select + { + template + struct apply + { + static T& make_t(); + + BOOST_STATIC_CONSTANT( + bool, value = (1 == sizeof(detail::is_member_function_pointer_helper(make_t()))) ); + }; + }; +} + +template +struct is_member_function_pointer : ::boost::detail::is_member_function_pointer_select< + ::boost::detail::neither_array_nor_reference::value +>::template apply +{}; + +template <> +struct is_member_function_pointer +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +template <> +struct is_member_function_pointer +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +template <> +struct is_member_function_pointer +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +template <> +struct is_member_function_pointer +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +#endif +#ifdef __BORLANDC__ +template struct is_member_pointer +{ BOOST_STATIC_CONSTANT(bool, value = false); }; +template struct is_member_pointer +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +#else + +namespace detail +{ + template + struct is_member_pointer_select + : ::boost::type_traits::false_unary_metafunction + { + }; + + template <> + struct is_member_pointer_select + { + template + struct apply + { + static T& make_t(); + + BOOST_STATIC_CONSTANT( + bool, value = + (::boost::type_traits::ice_or< + (1 == sizeof(detail::is_member_function_pointer_helper(make_t()))), + (1 == sizeof(detail::is_member_pointer_helper(make_t()))) + >::value) ); + }; + }; +} + +template +struct is_member_pointer : ::boost::detail::is_member_pointer_select< + ::boost::detail::neither_array_nor_reference::value +>::template apply +{}; + +template <> +struct is_member_pointer +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +template <> +struct is_member_pointer +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +template <> +struct is_member_pointer +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +template <> +struct is_member_pointer +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +#endif +#endif // __BORLANDC__ + +#endif + + +} // namespace boost + +#endif // BOOST_COMPOSITE_TYPE_TRAITS_HPP + + + + + diff --git a/include/boost/type_traits/conversion_traits.hpp b/include/boost/type_traits/conversion_traits.hpp new file mode 100644 index 00000000000..d8c01987560 --- /dev/null +++ b/include/boost/type_traits/conversion_traits.hpp @@ -0,0 +1,328 @@ + +// Copyright (C) 2000 John Maddock (john_maddock@compuserve.com) +// Copyright (C) 2000 Jeremy Siek (jsiek@lsc.nd.edu) +// Copyright (C) 1999, 2000 Jaakko J„rvi (jaakko.jarvi@cs.utu.fi) +// +// Permission to copy and use this software is granted, +// provided this copyright notice appears in all copies. +// Permission to modify the code and to distribute modified code is granted, +// provided this copyright notice appears in all copies, and a notice +// that the code was modified is included with the copyright notice. +// +// This software is provided "as is" without express or implied warranty, +// and with no claim as to its suitability for any purpose. +// + +#ifndef BOOST_CONVERSION_TYPE_TRAITS_HPP +#define BOOST_CONVERSION_TYPE_TRAITS_HPP + +#ifndef BOOST_ICE_TYPE_TRAITS_HPP +#include +#endif +#ifndef BOOST_FWD_TYPE_TRAITS_HPP +#include +#endif +#ifndef BOOST_ARITHMETIC_TYPE_TRAITS_HPP +#include +#endif +// +// is one type convertable to another? +// +// there are multiple versions of the is_convertible +// template, almost every compiler seems to require its +// own version. +// +// Thanks to Andrei Alexandrescu for the original version of the +// conversion detection technique! +// + +namespace boost{ + +#ifdef BOOST_MSVC + +// +// MS specific version: +// +namespace detail{ + + // This workaround is necessary to handle when From is void + // which is normally taken care of by the partial specialization + // of the is_convertible class. + using ::boost::type_traits::yes_type; + using ::boost::type_traits::no_type; + + struct from_not_void_conversion { + template + struct n_bind { + static no_type BOOST_TT_DECL _m_check(...); + static yes_type BOOST_TT_DECL _m_check(To); + public: + void foo(); // avoid warning about all members being private + static From _m_from; + enum { exists = sizeof( _m_check(_m_from) ) == sizeof(yes_type) }; + }; + }; + struct from_is_void_conversion { + template + struct n_bind { + enum { exists = ::boost::is_void::value }; + }; + }; + + template + struct conversion_helper { + typedef from_not_void_conversion type; + }; + template <> + struct conversion_helper { + typedef from_is_void_conversion type; + }; +} // namespace detail + +template +struct is_convertible +{ + typedef typename detail::conversion_helper::type Selector; + typedef typename Selector::template n_bind Conversion; +public: + enum { value = Conversion::exists }; +}; + +#elif defined(__BORLANDC__) +// +// special version for Borland compilers +// this version breaks when used for some +// UDT conversions: +// +template +struct is_convertible +{ +private: +#pragma option push -w-8074 + // This workaround for Borland breaks the EDG C++ frontend, + // so we only use it for Borland. + template + struct checker + { + static type_traits::no_type BOOST_TT_DECL _m_check(...); + static type_traits::yes_type BOOST_TT_DECL _m_check(T); + }; + static From _m_from; +public: + static const bool value = sizeof( checker::_m_check(_m_from) ) == sizeof(type_traits::yes_type); + + void foo(); // avoid warning about all members being private +#pragma option pop +}; + +#elif defined(__GNUC__) +// +// special version for gcc compiler +// +namespace detail{ + struct any_conversion + { + template + any_conversion(const T&); + template + any_conversion(T&); + }; + template + struct checker + { + static boost::type_traits::no_type _m_check(any_conversion ...); + static boost::type_traits::yes_type _m_check(T, int); + }; +} // namespace detail +template +struct is_convertible +{ +private: + static From _m_from; +public: + static const bool value = sizeof( detail::checker::_m_check(_m_from, 0) ) == sizeof(type_traits::yes_type); + + void foo(); // avoid warning about all members being private +}; + +// Declare specializations of is_convertible for all of the floating +// types to all of the integral types. This suppresses some nasty +// warnings + +# define BOOST_IS_CONVERTIBLE(T1,T2) template<>struct is_convertible{static const bool value=true;}; +# define BOOST_IS_CONVERTIBLE2(T1,T2) \ + BOOST_IS_CONVERTIBLE(T1,signed T2) \ + BOOST_IS_CONVERTIBLE(T1,unsigned T2) + +# define BOOST_FLOAT_IS_CONVERTIBLE(F) \ + BOOST_IS_CONVERTIBLE(F,char) \ + BOOST_IS_CONVERTIBLE2(F,char) \ + BOOST_IS_CONVERTIBLE2(F,short) \ + BOOST_IS_CONVERTIBLE2(F,int) \ + BOOST_IS_CONVERTIBLE2(F,long) \ + BOOST_IS_CONVERTIBLE2(F,long long) + +BOOST_FLOAT_IS_CONVERTIBLE(float) +BOOST_FLOAT_IS_CONVERTIBLE(double) +BOOST_FLOAT_IS_CONVERTIBLE(long double) +BOOST_FLOAT_IS_CONVERTIBLE(float const) +BOOST_FLOAT_IS_CONVERTIBLE(double const) +BOOST_FLOAT_IS_CONVERTIBLE(long double const) +BOOST_FLOAT_IS_CONVERTIBLE(float volatile) +BOOST_FLOAT_IS_CONVERTIBLE(double volatile) +BOOST_FLOAT_IS_CONVERTIBLE(long double volatile) +BOOST_FLOAT_IS_CONVERTIBLE(float const volatile) +BOOST_FLOAT_IS_CONVERTIBLE(double const volatile) +BOOST_FLOAT_IS_CONVERTIBLE(long double const volatile) +# undef BOOST_FLOAT_IS_CONVERTIBLE +# undef BOOST_IS_CONVERTIBLE2 +# undef BOOST_IS_CONVERTIBLE +#else + +template +struct is_convertible +{ +private: + static type_traits::no_type BOOST_TT_DECL _m_check(...); + static type_traits::yes_type BOOST_TT_DECL _m_check(To); + static From _m_from; +public: + BOOST_STATIC_CONSTANT(bool, value = sizeof( _m_check(_m_from) ) == sizeof(type_traits::yes_type)); + void foo(); // avoid warning about all members being private +}; + +#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION +// A definition is required even for integral static constants +template +const bool is_convertible::value; +#endif + + +#endif // is_convertible + +// +// Now add the full and partial specialisations +// for void types, these are common to all the +// implementation above: +// +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +template +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +template +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +template +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +#endif // BOOST_NO_CV_VOID_SPECIALIZATIONS + +template +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +template +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +template +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +template +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +#endif +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +template <> +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +template <> +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <> +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <> +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <> +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <> +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <> +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <> +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <> +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <> +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <> +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <> +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <> +struct is_convertible +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; +#endif + +} // namespace boost + +#endif // include guard + + diff --git a/include/boost/type_traits/cv_traits.hpp b/include/boost/type_traits/cv_traits.hpp new file mode 100644 index 00000000000..b10eac689b7 --- /dev/null +++ b/include/boost/type_traits/cv_traits.hpp @@ -0,0 +1,399 @@ +// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard +// Hinnant & John Maddock 2000. Permission to copy, use, modify, +// sell and distribute this software is granted provided this +// copyright notice appears in all copies. This software is provided +// "as is" without express or implied warranty, and with no claim as +// to its suitability for any purpose. +// +// See http://www.boost.org for most recent version including documentation. +// +// defines traits classes for cv-qualified types: +// is_const, is_volatile, remove_const, remove_volatile, remove_cv. +// +// Revision History: +// 24th March 2001: +// Fixed is_const/is_volatile so that they work with reference types + +#ifndef BOOST_CV_TYPE_TRAITS_HPP +#define BOOST_CV_TYPE_TRAITS_HPP + +#ifndef BOOST_ICE_TYPE_TRAITS_HPP +#include +#endif +#ifndef BOOST_FWD_TYPE_TRAITS_HPP +#include +#endif +#ifndef BOOST_TT_REFERENCE_TRAITS_HPP +# include +#endif +#ifndef BOOST_TT_ARRAY_TRAITS_HPP +# include +#endif +#ifndef BOOST_TT_UTILITY_HPP +# include +#endif + +namespace boost{ + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +namespace detail{ +// +// implementation helper: +// +template +struct cv_traits_imp{}; + +template +struct cv_traits_imp +{ + BOOST_STATIC_CONSTANT(bool, is_const = false); + BOOST_STATIC_CONSTANT(bool, is_volatile = false); + typedef T unqualified_type; +}; + +template +struct cv_traits_imp +{ + BOOST_STATIC_CONSTANT(bool, is_const = true); + BOOST_STATIC_CONSTANT(bool, is_volatile = false); + typedef T unqualified_type; +}; + +template +struct cv_traits_imp +{ + BOOST_STATIC_CONSTANT(bool, is_const = false); + BOOST_STATIC_CONSTANT(bool, is_volatile = true); + typedef T unqualified_type; +}; + +template +struct cv_traits_imp +{ + BOOST_STATIC_CONSTANT(bool, is_const = true); + BOOST_STATIC_CONSTANT(bool, is_volatile = true); + typedef T unqualified_type; +}; + +template +struct remove_const_helper +{ + typedef T type; +}; +template +struct remove_const_helper +{ + typedef volatile T type; +}; + +template +struct remove_volatile_helper +{ + typedef T type; +}; +template +struct remove_volatile_helper +{ + typedef const T type; +}; + +} // namespace detail + +// * convert a type T to a non-volatile type - remove_volatile +template +struct remove_volatile +{ + typedef typename detail::cv_traits_imp::unqualified_type uq_type; + typedef typename detail::remove_volatile_helper::value>::type type; +}; +template struct remove_volatile{ typedef T& type; }; +template struct remove_volatile{ typedef T type[N]; }; +template struct remove_volatile{ typedef const T type[N]; }; + +// * convert a type T to non-const type - remove_const +template +struct remove_const +{ + typedef typename detail::cv_traits_imp::unqualified_type uq_type; + typedef typename detail::remove_const_helper::value>::type type; +}; +template struct remove_const{ typedef T& type; }; +template struct remove_const{ typedef T type[N]; }; +template struct remove_const{ typedef volatile T type[N]; }; + +// convert a type T to a non-cv-qualified type - remove_cv +template +struct remove_cv +{ + typedef typename detail::cv_traits_imp::unqualified_type type; +}; +template struct remove_cv{ typedef T& type; }; +template struct remove_cv{ typedef T type[N]; }; +template struct remove_cv{ typedef T type[N]; }; +template struct remove_cv{ typedef T type[N]; }; + +//* is a type T declared const - is_const +template +struct is_const +{ + BOOST_STATIC_CONSTANT(bool, value = detail::cv_traits_imp::is_const); +}; +template struct is_const +{ BOOST_STATIC_CONSTANT(bool, value = false); }; +#if defined(__BORLANDC__) +// 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... +template struct is_const +{ BOOST_STATIC_CONSTANT(bool, value = false); }; +template struct is_const +{ BOOST_STATIC_CONSTANT(bool, value = false); }; +template struct is_const +{ BOOST_STATIC_CONSTANT(bool, value = false); }; +#endif + +//* is a type T declared volatile - is_volatile +template +struct is_volatile +{ + BOOST_STATIC_CONSTANT(bool, value = detail::cv_traits_imp::is_volatile); +}; +template struct is_volatile +{ BOOST_STATIC_CONSTANT(bool, value = false); }; +#if defined(__BORLANDC__) +// 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... +template struct is_volatile +{ BOOST_STATIC_CONSTANT(bool, value = false); }; +template struct is_volatile +{ BOOST_STATIC_CONSTANT(bool, value = false); }; +template struct is_volatile +{ BOOST_STATIC_CONSTANT(bool, value = false); }; +#endif + +#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +// The following three don't work: +template struct remove_volatile{ typedef T type; }; +template struct remove_const{ typedef T type; }; +template struct remove_cv{ typedef T type; }; + +namespace detail{ + using ::boost::type_traits::yes_type; + using ::boost::type_traits::no_type; + yes_type is_const_helper(const volatile void*); + no_type is_const_helper(volatile void *); + yes_type is_volatile_helper(const volatile void*); + no_type is_volatile_helper(const void *); +} + +namespace detail +{ + template + struct is_const_impl + : ::boost::type_traits::false_unary_metafunction + {}; + + template <> + struct is_const_impl + { + template + struct apply + { + private: + static T* t; + public: + BOOST_STATIC_CONSTANT(bool, value = (sizeof(detail::yes_type) == sizeof(detail::is_const_helper(t)))); + }; + }; + + template <> + struct is_const_impl + { + template + struct apply + { + private: + static T t; + public: + BOOST_STATIC_CONSTANT(bool, value = (sizeof(detail::yes_type) == sizeof(detail::is_const_helper(&t)))); + }; + }; +} + +template +struct is_const + : ::boost::detail::is_const_impl< + is_reference::value + , is_array::value + >::template apply +{ +}; + +template <> +struct is_const +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +template <> +struct is_const +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <> +struct is_const +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +template <> +struct is_const +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; +#endif + +namespace detail +{ + template + struct is_volatile_impl + : ::boost::type_traits::false_unary_metafunction + {}; + + template <> + struct is_volatile_impl + { + template + struct apply + { + private: + static T* t; + public: + BOOST_STATIC_CONSTANT(bool, value = (sizeof(detail::yes_type) == sizeof(detail::is_volatile_helper(t)))); + }; + }; + + template <> + struct is_volatile_impl + { + template + struct apply + { + private: + static T t; + public: + BOOST_STATIC_CONSTANT(bool, value = (sizeof(detail::yes_type) == sizeof(detail::is_volatile_helper(&t)))); + }; + }; +} + +template +struct is_volatile + : ::boost::detail::is_volatile_impl< + is_reference::value + , is_array::value + >::template apply +{ +}; + + +template <> +struct is_volatile +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +template <> +struct is_volatile +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +template <> +struct is_volatile +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <> +struct is_volatile +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; +#endif + +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +// * convert a type T to const type - add_const +// this is not required since the result is always +// the same as "T const", but it does suppress warnings +// from some compilers: +template +struct add_const +{ +#if defined(BOOST_MSVC) + // This bogus warning will appear when add_const is applied to a + // const volatile reference because we can't detect const volatile + // references with MSVC6. +# pragma warning(push) +# pragma warning(disable:4181) // warning C4181: qualifier applied to reference type ignored +#endif + typedef T const type; +#if defined(BOOST_MSVC) +# pragma warning(pop) +#endif +}; +// * convert a type T to volatile type - add_volatile +// this is not required since the result is always +// the same as "T volatile", but it does suppress warnings +// from some compilers: +template +struct add_volatile +{ +#if defined(BOOST_MSVC) + // This bogus warning will appear when add_volatile is applied to a + // const volatile reference because we can't detect const volatile + // references with MSVC6. +# pragma warning(push) +# pragma warning(disable:4181) // warning C4181: qualifier applied to reference type ignored +#endif + typedef T volatile type; +#if defined(BOOST_MSVC) +# pragma warning(pop) +#endif +}; +// * convert a type T to a const volatile type - add_cv +// this is not required since the result is always +// the same as "T const volatile", but it does suppress warnings +// from some compilers: +template +struct add_cv +{ +#if defined(BOOST_MSVC) + // This bogus warning will appear when add_volatile is applied to a + // const volatile reference because we can't detect const volatile + // references with MSVC6. +# pragma warning(push) +# pragma warning(disable:4181) // warning C4181: qualifier applied to reference type ignored +#endif + typedef T const volatile type; +#if defined(BOOST_MSVC) +# pragma warning(pop) +#endif +}; +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template +struct add_const{ typedef T& type; }; +template +struct add_volatile{ typedef T& type; }; +template +struct add_cv{ typedef T& type; }; +#endif + +} // namespace boost + + +#endif // BOOST_CV_TYPE_TRAITS_HPP + + + diff --git a/include/boost/type_traits/function_traits.hpp b/include/boost/type_traits/function_traits.hpp new file mode 100644 index 00000000000..df098456ee2 --- /dev/null +++ b/include/boost/type_traits/function_traits.hpp @@ -0,0 +1,153 @@ + +// Copyright (C) 2000 John Maddock (john_maddock@compuserve.com) +// +// Permission to copy and use this software is granted, +// provided this copyright notice appears in all copies. +// Permission to modify the code and to distribute modified code is granted, +// provided this copyright notice appears in all copies, and a notice +// that the code was modified is included with the copyright notice. +// +// This software is provided "as is" without express or implied warranty, +// and with no claim as to its suitability for any purpose. + +#ifndef BOOST_FUNCTION_TYPE_TRAITS_HPP +#define BOOST_FUNCTION_TYPE_TRAITS_HPP + +#ifndef BOOST_ICE_TYPE_TRAITS_HPP +#include +#endif +#ifndef BOOST_FWD_TYPE_TRAITS_HPP +#include +#endif +#ifndef BOOST_COMPOSITE_TYPE_TRAITS_HPP +#include +#endif +// +// is a type a function? +// Please note that this implementation is unnecessarily complex: +// we could just use !is_convertible::value, +// except that some compilers erroneously allow conversions from +// function pointers to void*. +// +namespace boost{ +namespace detail{ + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = false); }; +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template +struct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); }; + +template +struct is_function_helper : is_function_helper_base{}; + +#else + +template +struct is_function_helper +{ + static T* t; + BOOST_STATIC_CONSTANT(bool, value = sizeof(is_function_tester(t)) == sizeof(::boost::type_traits::yes_type)); + //BOOST_STATIC_CONSTANT(bool, value = (!::boost::is_convertible::value)); +}; + +#endif + +template +struct is_function_ref_helper +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +template +struct is_function_chooser +{ + typedef is_function_helper type; +}; +template +struct is_function_chooser +{ + typedef is_function_ref_helper type; +}; +#endif +} // namespace detail + +template +struct is_function +{ +private: +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + typedef typename detail::is_function_chooser::value>::type m_type; +#else + // without partial specialistaion we can't use is_reference on + // function types, that leaves this template broken in the case that + // T is a reference: + typedef detail::is_function_helper m_type; +#endif +public: + BOOST_STATIC_CONSTANT(bool, value = m_type::value); +}; + +} // boost + +#endif // BOOST_FUNCTION_TYPE_TRAITS_HPP diff --git a/include/boost/type_traits/fwd.hpp b/include/boost/type_traits/fwd.hpp new file mode 100644 index 00000000000..c58dd9c484d --- /dev/null +++ b/include/boost/type_traits/fwd.hpp @@ -0,0 +1,201 @@ +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. +// +// See http://www.boost.org for most recent version including documentation. +// +// forward declarations of type_traits classes +// +#ifndef BOOST_FWD_TYPE_TRAITS_HPP +#define BOOST_FWD_TYPE_TRAITS_HPP + +#include +#include + +#ifndef BOOST_CONFIG_HPP +#include +#endif + +// +// Helper macros for builtin compiler support. +// If your compiler has builtin support for any of the following +// traits concepts, then redefine the appropriate macros to pick +// up on the compiler support: +// +// (these should largely ignore cv-qualifiers) +// BOOST_IS_CLASS(T) should evaluate to true if T is a class or struct type +// BOOST_IS_ENUM(T) should evaluate to true if T is an enumerator type +// BOOST_IS_UNION(T) should evaluate to true if T is a union type +// BOOST_IS_POD(T) should evaluate to true if T is a POD type +// BOOST_IS_EMPTY(T) should evaluate to true if T is an empty struct or union +// BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) should evaluate to true if "T x;" has no effect +// BOOST_HAS_TRIVIAL_COPY(T) should evaluate to true if T(t) <==> memcpy +// BOOST_HAS_TRIVIAL_ASSIGN(T) should evaluate to true if t = u <==> memcpy +// BOOST_HAS_TRIVIAL_DESTRUCTOR(T) should evaluate to true if ~T() has no effect + +#ifdef BOOST_HAS_SGI_TYPE_TRAITS +# define BOOST_IS_POD(T) ::boost::is_same< typename ::__type_traits::is_POD_type, ::__true_type>::value +# define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) ::boost::is_same< typename ::__type_traits::has_trivial_default_constructor, ::__true_type>::value +# define BOOST_HAS_TRIVIAL_COPY(T) ::boost::is_same< typename ::__type_traits::has_trivial_copy_constructor, ::__true_type>::value +# define BOOST_HAS_TRIVIAL_ASSIGN(T) ::boost::is_same< typename ::__type_traits::has_trivial_assignment_operator, ::__true_type>::value +# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) ::boost::is_same< typename ::__type_traits::has_trivial_destructor, ::__true_type>::value +#endif + +#ifndef BOOST_IS_CLASS +# define BOOST_IS_CLASS(T) false +#endif + +#ifndef BOOST_IS_ENUM +# define BOOST_IS_ENUM(T) false +#endif + +#ifndef BOOST_IS_UNION +# define BOOST_IS_UNION(T) false +#endif + +#ifndef BOOST_IS_POD +# define BOOST_IS_POD(T) false +#endif + +#ifndef BOOST_IS_EMPTY +# define BOOST_IS_EMPTY(T) false +#endif + +#ifndef BOOST_HAS_TRIVIAL_CONSTRUCTOR +# define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) false +#endif + +#ifndef BOOST_HAS_TRIVIAL_COPY +# define BOOST_HAS_TRIVIAL_COPY(T) false +#endif + +#ifndef BOOST_HAS_TRIVIAL_ASSIGN +# define BOOST_HAS_TRIVIAL_ASSIGN(T) false +#endif + +#ifndef BOOST_HAS_TRIVIAL_DESTRUCTOR +# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) false +#endif + +// +// whenever we have a conversion function with elipses +// it needs to be declared __cdecl to suppress compiler +// warnings from MS and Borland compilers: +#if defined(BOOST_MSVC) || defined(__BORLANDC__) +#define BOOST_TT_DECL __cdecl +#else +#define BOOST_TT_DECL +#endif + + +namespace boost{ +// +// forward declare all type traits templates here +// +// conversion_traits.hpp: +template +struct is_convertible; +// alignment_traits.hpp: +template +struct alignment_of; +// arithmetic_traits.hpp: +template +struct is_void; +template +struct is_integral; +template +struct is_float; +template +struct is_arithmetic; +template +struct is_fundamental; + +// cv_traits.hpp: +template +struct is_const; +template +struct is_volatile; +template +struct remove_const; +template +struct remove_volatile; +template +struct remove_cv; +template +struct add_const; +template +struct add_volatile; +template +struct add_cv; + +// composite_traits.hpp: +template +struct is_array; +template +struct is_pointer; +template +struct is_reference; +template +struct is_member_pointer; +template +struct is_member_function_pointer; +template +struct is_enum; +template +struct is_union; + +// object_traits.hpp: +template +struct is_object; +template +struct is_scalar; +template +struct is_class; +template +struct is_compound; +template +struct is_POD; +template +struct has_trivial_constructor; +template +struct has_trivial_copy; +template +struct has_trivial_assign; +template +struct has_trivial_destructor; +template +struct has_nothrow_constructor; +template +struct has_nothrow_copy; +template +struct has_nothrow_assign; +template +struct is_empty; +template +struct is_base_and_derived; + +// transform_traits.hpp: +template +struct remove_reference; +template +struct add_reference; +template +struct remove_bounds; +template +struct remove_pointer; +template +struct add_pointer; + +// same_traits.hpp: +template +struct is_same; + +} // namespace boost + +#endif // BOOST_FWD_TYPE_TRAITS_HPP + + + + diff --git a/include/boost/type_traits/ice.hpp b/include/boost/type_traits/ice.hpp new file mode 100644 index 00000000000..36e0e2ecc59 --- /dev/null +++ b/include/boost/type_traits/ice.hpp @@ -0,0 +1,87 @@ + +// (C) Copyright John Maddock and Steve Cleary 2000. +// Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version including documentation. +// +// macros and helpers for working with integral-constant-expressions. + +#ifndef BOOST_ICE_TYPE_TRAITS_HPP +#define BOOST_ICE_TYPE_TRAITS_HPP + +#ifndef BOOST_CONFIG_HPP +#include +#endif + + +namespace boost{ +namespace type_traits{ + +typedef char yes_type; +typedef double no_type; + +template +struct ice_not +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> +struct ice_not +{ BOOST_STATIC_CONSTANT(bool, value = false); }; + +template +struct ice_or; +template +struct ice_or +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <> +struct ice_or +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +template +struct ice_and; +template +struct ice_and +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +template <> +struct ice_and +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; + +template +struct ice_eq +{ + BOOST_STATIC_CONSTANT(bool, value = (b1 == b2)); +}; + +template +struct ice_ne +{ + BOOST_STATIC_CONSTANT(bool, value = (b1 != b2)); +}; + +#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION +template +const bool ice_eq::value; +template +const bool ice_ne::value; +#endif + +} // namespace type_traits + +} // namespace boost + +#endif // BOOST_ICE_TYPE_TRAITS_HPP + + + + + diff --git a/include/boost/type_traits/is_class.hpp b/include/boost/type_traits/is_class.hpp new file mode 100644 index 00000000000..4dceaf214cb --- /dev/null +++ b/include/boost/type_traits/is_class.hpp @@ -0,0 +1,49 @@ +// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard +// Hinnant & John Maddock 2000-2002. Permission to copy, use, +// modify, sell and distribute this software is granted provided this +// copyright notice appears in all copies. This software is provided +// "as is" without express or implied warranty, and with no claim as +// to its suitability for any purpose. +// +// See http://www.boost.org for most recent version including documentation. +// +#ifndef BOOST_TYPE_TRAITS_IS_CLASS_HPP +# define BOOST_TYPE_TRAITS_IS_CLASS_HPP + +# if (defined(__MWERKS__) && __MWERKS__ >= 0x3000) || defined(BOOST_MSVC) && _MSC_FULL_VER > 13012108 || defined(BOOST_NO_COMPILER_CONFIG) +# ifndef BOOST_ICE_TYPE_TRAITS_HPP +# include +# endif + +# define BOOST_TYPE_TRAITS_IS_CLASS_DEFINED +namespace boost { + +template +struct is_class +{ + // This is actually the conforming implementation which works with + // abstract classes. However, enough compilers have trouble with + // it that most will use the one in + // boost/type_traits/object_traits.hpp. This implementation + // actually works with VC7.0, but other interactions seem to fail + // when we use it. + +// is_class<> metafunction due to Paul Mensonides +// (leavings@attbi.com). For more details: +// http://groups.google.com/groups?hl=en&selm=000001c1cc83%24e154d5e0%247772e50c%40c161550a&rnum=1 + private: + template static ::boost::type_traits::yes_type is_class_helper(void(U::*)(void)); + template static ::boost::type_traits::no_type is_class_helper(...); + public: + BOOST_STATIC_CONSTANT( + bool, value = sizeof( + is_class_helper(0) + ) == sizeof(::boost::type_traits::yes_type)); +}; +} + +# else // nonconforming compilers will use a different impelementation, in object_traits.hpp + +# endif // nonconforming implementations + +#endif // BOOST_TYPE_TRAITS_IS_CLASS_HPP diff --git a/include/boost/type_traits/object_traits.hpp b/include/boost/type_traits/object_traits.hpp new file mode 100644 index 00000000000..4386e9cfbd0 --- /dev/null +++ b/include/boost/type_traits/object_traits.hpp @@ -0,0 +1,562 @@ +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. +// +// See http://www.boost.org for most recent version including documentation. +// +// defines object traits classes: +// is_object, is_scalar, is_class, is_compound, is_POD, +// has_trivial_constructor, has_trivial_copy, has_trivial_assign, +// has_trivial_destructor, is_empty. +// + +#ifndef BOOST_OBJECT_TYPE_TRAITS_HPP +#define BOOST_OBJECT_TYPE_TRAITS_HPP + +#ifndef BOOST_ICE_TYPE_TRAITS_HPP +#include +#endif +#ifndef BOOST_FWD_TYPE_TRAITS_HPP +#include +#endif +#ifndef BOOST_COMPOSITE_TYPE_TRAITS_HPP +#include +#endif +#ifndef BOOST_ARITHMETIC_TYPE_TRAITS_HPP +#include +#endif +#ifndef BOOST_FUNCTION_TYPE_TRAITS_HPP +#include +#endif +#ifndef BOOST_TYPE_TRAITS_IS_CLASS_HPP +# include +#endif + +#ifdef BOOST_HAS_SGI_TYPE_TRAITS +# include +# include +#endif + +namespace boost{ + +/********************************************** + * + * is_object + * + **********************************************/ +template +struct is_object +{ +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_and< + ::boost::type_traits::ice_not< ::boost::is_reference::value>::value, + ::boost::type_traits::ice_not< ::boost::is_void::value>::value, + ::boost::type_traits::ice_not< ::boost::is_function::value>::value + >::value)); +#else + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_and< + ::boost::type_traits::ice_not< ::boost::is_reference::value>::value, + ::boost::type_traits::ice_not< ::boost::is_void::value>::value + >::value)); +#endif +}; + +/********************************************** + * + * is_scalar + * + **********************************************/ +template +struct is_scalar +{ + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_or< + ::boost::is_arithmetic::value, + ::boost::is_enum::value, + ::boost::is_pointer::value, + ::boost::is_member_pointer::value + >::value)); +}; + +# ifndef BOOST_TYPE_TRAITS_IS_CLASS_DEFINED +// conforming compilers use the implementation in +/********************************************** + * + * is_class + * + **********************************************/ +template +struct is_class +{ +# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_and< + ::boost::type_traits::ice_not< ::boost::is_union::value >::value, + ::boost::type_traits::ice_not< ::boost::is_scalar::value >::value, + ::boost::type_traits::ice_not< ::boost::is_array::value >::value, + ::boost::type_traits::ice_not< ::boost::is_reference::value>::value, + ::boost::type_traits::ice_not< ::boost::is_void::value >::value, + ::boost::type_traits::ice_not< ::boost::is_function::value >::value + >::value)); +# else + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_and< + ::boost::type_traits::ice_not< ::boost::is_union::value >::value, + ::boost::type_traits::ice_not< ::boost::is_scalar::value >::value, + ::boost::type_traits::ice_not< ::boost::is_array::value >::value, + ::boost::type_traits::ice_not< ::boost::is_reference::value>::value, + ::boost::type_traits::ice_not< ::boost::is_void::value >::value + >::value)); +# endif +}; +# endif // nonconforming implementations +/********************************************** + * + * is_compound + * + **********************************************/ +template struct is_compound +{ + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_or< + ::boost::is_array::value, + ::boost::is_pointer::value, + ::boost::is_reference::value, + ::boost::is_class::value, + ::boost::is_union::value, + ::boost::is_enum::value, + ::boost::is_member_pointer::value + >::value)); +}; + +/********************************************** + * + * is_POD + * + **********************************************/ + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template struct is_POD +{ + BOOST_STATIC_CONSTANT( + bool, value = + (::boost::type_traits::ice_or< + ::boost::is_scalar::value, + ::boost::is_void::value, + BOOST_IS_POD(T) + >::value)); +}; + +template +struct is_POD +{ + BOOST_STATIC_CONSTANT(bool, value = ::boost::is_POD::value); +}; +#else +namespace detail +{ + template struct is_POD_helper; +} + +template struct is_POD +{ + BOOST_STATIC_CONSTANT( + bool, value = ( + ::boost::detail::is_POD_helper< + ::boost::is_array::value + >::template apply::value + ) + ); +}; + +namespace detail +{ + template + struct is_POD_helper + { + template struct apply + { + BOOST_STATIC_CONSTANT( + bool, value = + (::boost::type_traits::ice_or< + ::boost::is_scalar::value, + ::boost::is_void::value, + BOOST_IS_POD(T) + >::value)); + }; + }; + + template + struct bool_to_type + { + typedef ::boost::type_traits::no_type type; + }; + + template <> + struct bool_to_type + { + typedef ::boost::type_traits::yes_type type; + }; + + template + struct is_POD_array_helper + { + typedef +#if !defined(__BORLANDC__) || __BORLANDC__ > 0x551 + typename +#endif + ::boost::detail::bool_to_type<(::boost::is_POD::value)>::type type; + + type instance() const; + }; + + template + is_POD_array_helper is_POD_array(T*); + + template <> + struct is_POD_helper + { + template struct apply + { + static T& help(); + + BOOST_STATIC_CONSTANT( + bool, value = + sizeof(is_POD_array(help()).instance()) == sizeof(::boost::type_traits::yes_type)); + }; + }; +} +#endif + +/********************************************** + * + * has_trivial_constructor + * + **********************************************/ +template +struct has_trivial_constructor +{ + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_or< + ::boost::is_POD::value, + BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) + >::value)); +}; + +/********************************************** + * + * has_trivial_copy + * + **********************************************/ +template +struct has_trivial_copy +{ + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_and< + ::boost::type_traits::ice_or< + ::boost::is_POD::value, + BOOST_HAS_TRIVIAL_COPY(T) + >::value, + ::boost::type_traits::ice_not< ::boost::is_volatile::value >::value + >::value)); +}; + +/********************************************** + * + * has_trivial_assign + * + **********************************************/ +template +struct has_trivial_assign +{ + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_and< + ::boost::type_traits::ice_or< + ::boost::is_POD::value, + BOOST_HAS_TRIVIAL_ASSIGN(T) + >::value, + ::boost::type_traits::ice_not< ::boost::is_const::value >::value, + ::boost::type_traits::ice_not< ::boost::is_volatile::value >::value + >::value)); +}; + +/********************************************** + * + * has_trivial_destructor + * + **********************************************/ +template +struct has_trivial_destructor +{ + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_or< + ::boost::is_POD::value, + BOOST_HAS_TRIVIAL_DESTRUCTOR(T) + >::value)); +}; + +/********************************************** + * + * has_nothrow_constructor + * + **********************************************/ +template +struct has_nothrow_constructor +{ + BOOST_STATIC_CONSTANT(bool, value = + (::boost::has_trivial_constructor::value)); +}; + +/********************************************** + * + * has_nothrow_copy + * + **********************************************/ +template +struct has_nothrow_copy +{ + BOOST_STATIC_CONSTANT(bool, value = + (::boost::has_trivial_copy::value)); +}; + +/********************************************** + * + * has_nothrow_assign + * + **********************************************/ +template +struct has_nothrow_assign +{ + BOOST_STATIC_CONSTANT(bool, value = + (::boost::has_trivial_assign::value)); +}; + +/********************************************** + * + * is_empty + * + **********************************************/ +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +namespace detail +{ + template + struct empty_helper_t1 : public T + { +//#ifdef __MWERKS__ + empty_helper_t1(); // hh compiler bug workaround +//#endif + int i[256]; + }; + struct empty_helper_t2 { int i[256]; }; +} + +# ifndef __BORLANDC__ +namespace detail +{ + template + struct empty_helper{ BOOST_STATIC_CONSTANT(bool, value = false); }; + + template + struct empty_helper + { + BOOST_STATIC_CONSTANT( + bool, value = (sizeof(empty_helper_t1) == sizeof(empty_helper_t2))); + }; +} + +template +struct is_empty +{ + private: + typedef typename remove_cv::type cvt; + + public: + BOOST_STATIC_CONSTANT( + bool, value = ( + ::boost::type_traits::ice_or< + ::boost::detail::empty_helper::value>::value + , BOOST_IS_EMPTY(cvt) + >::value + )); +}; + +# else // __BORLANDC__ + +namespace detail +{ + template + struct empty_helper{ BOOST_STATIC_CONSTANT(bool, value = false); }; + + template + struct empty_helper + { + BOOST_STATIC_CONSTANT(bool, value = + (sizeof(empty_helper_t1) == sizeof(empty_helper_t2))); + }; +} + +template +struct is_empty +{ +private: + typedef typename remove_cv::type cvt; + typedef typename add_reference::type r_type; +public: + BOOST_STATIC_CONSTANT( + bool, value = ( + ::boost::type_traits::ice_or< + ::boost::detail::empty_helper< + T + , ::boost::is_class::value + , ::boost::is_convertible< r_type,int>::value + >::value + , BOOST_IS_EMPTY(cvt) + >::value)); +}; +# endif // __BORLANDC__ + +#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +#ifdef BOOST_MSVC6_MEMBER_TEMPLATES + +namespace detail{ + +template +struct empty_helper_t1 : public T +{ + empty_helper_t1(); + int i[256]; +}; +struct empty_helper_t2 { int i[256]; }; + +template +struct empty_helper_base +{ + enum{ value = (sizeof(empty_helper_t1) == sizeof(empty_helper_t2)) }; +}; + +template +struct empty_helper_nonbase +{ + enum{ value = false }; +}; + +template +struct empty_helper_chooser +{ + template + struct rebind + { + typedef empty_helper_nonbase type; + }; +}; + +template <> +struct empty_helper_chooser +{ + template + struct rebind + { + typedef empty_helper_base type; + }; +}; + +} // namespace detail + +template +struct is_empty +{ +private: + typedef ::boost::detail::empty_helper_chooser< + ::boost::type_traits::ice_and< + ::boost::type_traits::ice_not< + ::boost::is_reference::value>::value, + ::boost::type_traits::ice_not< + ::boost::is_convertible::value>::value, + ::boost::type_traits::ice_not< + ::boost::is_pointer::value>::value, + ::boost::type_traits::ice_not< + ::boost::is_member_pointer::value>::value, + ::boost::type_traits::ice_not< + ::boost::is_array::value>::value, + ::boost::type_traits::ice_not< + ::boost::is_void::value>::value, + ::boost::type_traits::ice_not< + ::boost::is_convertible::value>::value + >::value> chooser; + typedef typename chooser::template rebind bound_type; + typedef typename bound_type::type eh_type; +public: + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_or::value)); +}; + +#else +template struct is_empty +{ enum{ value = BOOST_IS_EMPTY(T) }; }; +#endif // BOOST_MSVC6_MEMBER_TEMPLATES + +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +/********************************************** + * + * is_stateless + * + **********************************************/ +template +struct is_stateless +{ + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_and< + ::boost::has_trivial_constructor::value, + ::boost::has_trivial_copy::value, + ::boost::has_trivial_destructor::value, + ::boost::is_class::value, + ::boost::is_empty::value + >::value)); +}; + +template +struct is_base_and_derived +{ + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_and< + ::boost::is_convertible::value, + ::boost::is_class::value, + ::boost::is_class::value + >::value) + ); +}; + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template +struct is_base_and_derived +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +template +struct is_base_and_derived +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +template +struct is_base_and_derived +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +#endif + +} // namespace boost + +#endif // BOOST_OBJECT_TYPE_TRAITS_HPP + + + + + + + diff --git a/include/boost/type_traits/reference_traits.hpp b/include/boost/type_traits/reference_traits.hpp new file mode 100644 index 00000000000..b9df72a93f3 --- /dev/null +++ b/include/boost/type_traits/reference_traits.hpp @@ -0,0 +1,90 @@ +// (C) Copyright David Abrahams Steve Cleary, Beman Dawes, Howard +// Hinnant & John Maddock 2000-2002. Permission to copy, use, +// modify, sell and distribute this software is granted provided this +// copyright notice appears in all copies. This software is provided +// "as is" without express or implied warranty, and with no claim as +// to its suitability for any purpose. +// +// See http://www.boost.org for most recent version including documentation. +// +#ifndef BOOST_TT_REFERENCE_TRAITS_HPP +# define BOOST_TT_REFERENCE_TRAITS_HPP + +# ifndef BOOST_TT_UTILITY_HPP +# include +# endif // BOOST_TT_UTILITY_HPP + +namespace boost { + +/********************************************** + * + * is_reference + * + **********************************************/ +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template struct is_reference +{ BOOST_STATIC_CONSTANT(bool, value = false); }; +template struct is_reference +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +#if defined(__BORLANDC__) +// 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... +template struct is_reference +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template struct is_reference +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template struct is_reference +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +#endif +#else +# ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable: 4181) +#endif // BOOST_MSVC + +namespace detail +{ + using ::boost::type_traits::yes_type; + using ::boost::type_traits::no_type; + using ::boost::type_traits::wrap; + + template T&(* is_reference_helper1(wrap) )(wrap); + char is_reference_helper1(...); + + template no_type is_reference_helper2(T&(*)(wrap)); + yes_type is_reference_helper2(...); +} + +template +struct is_reference +{ + BOOST_STATIC_CONSTANT( + bool, value = sizeof( + ::boost::detail::is_reference_helper2( + ::boost::detail::is_reference_helper1(::boost::type_traits::wrap()))) == 1 + ); +}; + +template <> struct is_reference +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +template <> struct is_reference +{ BOOST_STATIC_CONSTANT(bool, value = false); }; +template <> struct is_reference +{ BOOST_STATIC_CONSTANT(bool, value = false); }; +template <> struct is_reference +{ BOOST_STATIC_CONSTANT(bool, value = false); }; +#endif + +# ifdef BOOST_MSVC +# pragma warning(pop) +# endif // BOOST_MSVC +#endif + +} // namespace boost::type_traits + +#endif // BOOST_TT_REFERENCE_TRAITS_HPP diff --git a/include/boost/type_traits/same_traits.hpp b/include/boost/type_traits/same_traits.hpp new file mode 100644 index 00000000000..fc3c555b39e --- /dev/null +++ b/include/boost/type_traits/same_traits.hpp @@ -0,0 +1,108 @@ +// (C) Copyright Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant & John Maddock 2000. +// Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. +// +// See http://www.boost.org for most recent version including documentation. +// +// defines is_same: + +// Revision History +// 19 Feb 2001 Fixed for MSVC (David Abrahams) + +#ifndef BOOST_SAME_TRAITS_HPP +#define BOOST_SAME_TRAITS_HPP + +#ifndef BOOST_ICE_TYPE_TRAITS_HPP +#include +#endif +#ifndef BOOST_FWD_TYPE_TRAITS_HPP +#include +#endif +#if !defined(BOOST_COMPOSITE_TYPE_TRAITS_HPP) && defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC) +#include +#endif + +namespace boost{ + +/********************************************** + * + * is_same + * + **********************************************/ +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +template +struct is_same +{ BOOST_STATIC_CONSTANT(bool, value = false); }; + +template +struct is_same +{ BOOST_STATIC_CONSTANT(bool, value = true); }; + +#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION +// A definition is required even for integral static constants +template +const bool is_same::value; + +template +const bool is_same::value; +#endif + +#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +#ifdef BOOST_MSVC +// +// the following VC6 specific implementation is *NOT* legal +// C++, but has the advantage that it works for incomplete +// types. +// +namespace detail{ + +template +struct is_same_part_1 { + template struct part_2 { enum { value = false }; }; + template<> struct part_2 { enum { value = true }; }; +}; + +} // namespace detail + +template +struct is_same { + enum { value = detail::is_same_part_1::template part_2::value }; +}; + +#else // BOOST_MSVC + +namespace detail{ + template + ::boost::type_traits::yes_type BOOST_TT_DECL is_same_helper(T*, T*); + ::boost::type_traits::no_type BOOST_TT_DECL is_same_helper(...); +} + +template +struct is_same +{ +private: + static T t; + static U u; +public: + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_and< + (sizeof(type_traits::yes_type) == sizeof(detail::is_same_helper(&t,&u))), + (::boost::is_reference::value == ::boost::is_reference::value), + (sizeof(T) == sizeof(U)) + >::value)); +}; + +#endif // BOOST_MSVC + +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +} // namespace boost + +#endif // BOOST_SAME_TRAITS_HPP + + + diff --git a/include/boost/type_traits/transform_traits.hpp b/include/boost/type_traits/transform_traits.hpp new file mode 100644 index 00000000000..6cc0536e4e7 --- /dev/null +++ b/include/boost/type_traits/transform_traits.hpp @@ -0,0 +1,199 @@ +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. +// +// See http://www.boost.org for most recent version including documentation. +// +// defines traits classes for transforming one type to another: +// remove_reference, add_reference, remove_bounds, remove_pointer. +// +// Revision History: +// 21st March 2001 +// Added void specialisations to add_reference. + +#ifndef BOOST_TRANSFORM_TRAITS_HPP +#define BOOST_TRANSFORM_TRAITS_HPP + +#ifndef BOOST_ICE_TYPE_TRAITS_HPP +#include +#endif +#ifndef BOOST_FWD_TYPE_TRAITS_HPP +#include +#endif +#if !defined(BOOST_COMPOSITE_TYPE_TRAITS_HPP) && defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +#include +#endif + +namespace boost{ + +/********************************************** + * + * remove_reference + * + **********************************************/ +template +struct remove_reference +{ typedef T type; }; +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template +struct remove_reference +{ typedef T type; }; +#endif +#if defined(__BORLANDC__) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +// 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... +template +struct remove_reference +{ typedef T type; }; +template +struct remove_reference +{ typedef T type; }; +template +struct remove_reference +{ typedef T type; }; +#endif + +/********************************************** + * + * add_reference + * + **********************************************/ +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template +struct add_reference +{ typedef T& type; }; +template +struct add_reference +{ typedef T& type; }; +#elif defined(BOOST_MSVC6_MEMBER_TEMPLATES) +namespace detail{ + +template +struct reference_adder +{ + template + struct rebind + { + typedef T& type; + }; +}; + +template <> +struct reference_adder +{ + template + struct rebind + { + typedef T type; + }; +}; + +} // namespace detail + +template +struct add_reference +{ +private: + typedef typename detail::reference_adder< ::boost::is_reference::value>::template rebind binder; +public: + typedef typename binder::type type; +}; + +#else +template +struct add_reference +{ typedef T& type; }; +#endif + +// +// these full specialisations are always required: +template <> struct add_reference{ typedef void type; }; +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +template <> struct add_reference{ typedef const volatile void type; }; +template <> struct add_reference{ typedef const void type; }; +template <> struct add_reference{ typedef volatile void type; }; +#endif + + +/********************************************** + * + * remove_bounds + * + **********************************************/ +template +struct remove_bounds +{ typedef T type; }; +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template +struct remove_bounds +{ typedef T type; }; +template +struct remove_bounds +{ typedef const T type; }; +template +struct remove_bounds +{ typedef volatile T type; }; +template +struct remove_bounds +{ typedef const volatile T type; }; +#endif + +/********************************************** + * + * remove_pointer + * + **********************************************/ +template +struct remove_pointer +{ typedef T type; }; +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template +struct remove_pointer +{ typedef T type; }; +template +struct remove_pointer +{ typedef T type; }; +template +struct remove_pointer +{ typedef T type; }; +template +struct remove_pointer +{ typedef T type; }; +#endif + +/********************************************** + * + * add_pointer + * + **********************************************/ +template +struct add_pointer +{ +private: + typedef typename remove_reference::type no_ref_type; +public: + typedef no_ref_type* type; +}; + +} // namespace boost + +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +// +// if there is no partial specialisation support +// include a bunch of full specialisations as a workaround: +// +#include +#else +#define BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(x) +#endif + +#endif // BOOST_TRANSFORM_TRAITS_HPP + + + + + diff --git a/include/boost/type_traits/transform_traits_spec.hpp b/include/boost/type_traits/transform_traits_spec.hpp new file mode 100644 index 00000000000..e9fd0cbf8a1 --- /dev/null +++ b/include/boost/type_traits/transform_traits_spec.hpp @@ -0,0 +1,78 @@ + +// Copyright (c) 2001 Aleksey Gurtovoy. +// Permission to copy, use, modify, sell and distribute this software is +// granted provided this copyright notice appears in all copies. +// This software is provided "as is" without express or implied warranty, +// and with no claim as to its suitability for any purpose. + +#ifndef BOOST_TT_TRANSFORM_TRAITS_SPEC_HPP +#define BOOST_TT_TRANSFORM_TRAITS_SPEC_HPP + +#ifndef TRANSFORM_TRAITS_HPP +#include +#endif + +#define BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_CONST_VOLATILE_RANK1(T) \ +template<> struct remove_const { typedef T type; }; \ +template<> struct remove_const { typedef T volatile type; }; \ +template<> struct remove_volatile { typedef T type; }; \ +template<> struct remove_volatile { typedef T const type; }; \ +template<> struct remove_cv { typedef T type; }; \ +template<> struct remove_cv { typedef T type; }; \ +template<> struct remove_cv { typedef T type; }; \ +/**/ + +#define BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_PTR_REF_RANK_1(T) \ +template<> struct remove_pointer { typedef T type; }; \ +template<> struct remove_reference { typedef T type; }; \ +/**/ + +#define BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_PTR_REF_RANK_2(T) \ +BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_PTR_REF_RANK_1(T) \ +BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_PTR_REF_RANK_1(T const) \ +BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_PTR_REF_RANK_1(T volatile) \ +BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_PTR_REF_RANK_1(T const volatile) \ +/**/ + +#define BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_ALL_RANK_1(T) \ +BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_PTR_REF_RANK_2(T) \ +BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_CONST_VOLATILE_RANK1(T) \ +/**/ + +#define BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_ALL_RANK_2(T) \ +BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_ALL_RANK_1(T*) \ +BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_ALL_RANK_1(T const*) \ +BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_ALL_RANK_1(T volatile*) \ +BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_ALL_RANK_1(T const volatile*) \ +/**/ + +#define BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(T) \ +namespace boost { \ +BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_ALL_RANK_1(T) \ +BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_ALL_RANK_2(T) \ +BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_ALL_RANK_2(T*) \ +BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_ALL_RANK_2(T const*) \ +BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_ALL_RANK_2(T volatile*) \ +BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_ALL_RANK_2(T const volatile*) \ +} \ +/**/ + +BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(bool) +BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(char) +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(wchar_t) +#endif +BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(signed char) +BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(unsigned char) +BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(signed short) +BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(unsigned short) +BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(signed int) +BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(unsigned int) +BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(signed long) +BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(unsigned long) +BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(float) +BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(double) +BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(long double) + +#endif // BOOST_TT_TRANSFORM_TRAITS_SPEC_HPP + diff --git a/include/boost/type_traits/type_traits_test.hpp b/include/boost/type_traits/type_traits_test.hpp new file mode 100644 index 00000000000..b87d2782572 --- /dev/null +++ b/include/boost/type_traits/type_traits_test.hpp @@ -0,0 +1,434 @@ +// (C) Copyright John Maddock 2000. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// common test code for type-traits tests +// WARNING: contains code as well as declarations! + + +#ifndef BOOST_TYPE_TRAITS_TEST_HPP +#define BOOST_TYPE_TRAITS_TEST_HPP +#include +#include +#include +#include +#include +// +// define tests here +unsigned failures = 0; +unsigned test_count = 0; +// +// This must get defined within the test file. +// All compilers have bugs, set this to the number of +// regressions *expected* from a given compiler, +// if there are no workarounds for the bugs, *and* +// the regressions have been investigated. +// +extern unsigned int expected_failures; +// +// proc check_result() +// Checks that there were no regressions: +// +int check_result(int argc, char** argv) +{ + std::cout << test_count << " tests completed, " + << failures << " failures found, " + << expected_failures << " failures expected from this compiler." << std::endl; + if((argc == 2) + && (argv[1][0] == '-') + && (argv[1][1] == 'a') + && (argv[1][2] == 0)) + { + std::cout << "Press any key to continue..."; + std::cin.get(); + } + return (failures == expected_failures) + ? 0 + : (failures != 0) ? static_cast(failures) : -1; +} + + +// +// this one is to verify that a constant is indeed a +// constant-integral-expression: +// +// HP aCC cannot deal with missing names for template value parameters +template +struct checker +{ + static void check(bool, bool, const char*, bool){ ++test_count; } +}; + +template <> +struct checker +{ + static void check(bool o, bool n, const char* name, bool soft) + { + ++test_count; + ++failures; + // if this is a soft test, then failure is expected, + // or may depend upon factors outside our control + // (like compiler options)... + if(soft)++expected_failures; + std::cout << "checking value of " << name << "...failed" << std::endl; + std::cout << "\tfound: " << n << " expected " << o << std::endl; + } +}; + +template +struct typify{}; + +template +struct type_checker +{ + static void check(const char* TT, const char*, const char* expression) + { + ++test_count; + if(typeid(typify) != typeid(typify)) + { + ++failures; + std::cout << "checking type of " << expression << "...failed" << std::endl; + std::cout << " evaluating: type_checker<" << TT << "," << expression << ">" << std::endl; + std::cout << " expected: type_checker<" << TT << "," << TT << ">" << std::endl; + std::cout << " but got: " << typeid(type_checker).name() << std::endl; + } + } +}; + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template +struct type_checker +{ + static void check(const char*, const char*, const char*) + { + ++test_count; + } +}; +#endif + + +#define value_test(v, x) checker<(v == x)>::check(v, x, #x, false); +#define soft_value_test(v, x) checker<(v == x)>::check(v, x, #x, true); + +#define value_fail(v, x) \ + ++test_count; \ + ++failures; \ + ++expected_failures;\ + std::cout << "checking value of " << #x << "...failed" << std::endl; \ + std::cout << " " #x " does not compile on this compiler" << std::endl; + + +#define type_test(v, x) type_checker::check(#v, #x, #x); +#define type_test3(v, x, z) type_checker::check(#v, #x "," #z, #x "," #z); +#ifndef SHORT_TRANSFORM_TEST +#define transform_check(name, from_suffix, to_suffix)\ + type_test(bool to_suffix, name::type);\ + type_test(char to_suffix, name::type);\ + type_test(wchar_t to_suffix, name::type);\ + type_test(signed char to_suffix, name::type);\ + type_test(unsigned char to_suffix, name::type);\ + type_test(short to_suffix, name::type);\ + type_test(unsigned short to_suffix, name::type);\ + type_test(int to_suffix, name::type);\ + type_test(unsigned int to_suffix, name::type);\ + type_test(long to_suffix, name::type);\ + type_test(unsigned long to_suffix, name::type);\ + type_test(float to_suffix, name::type);\ + type_test(long double to_suffix, name::type);\ + type_test(double to_suffix, name::type);\ + type_test(UDT to_suffix, name::type);\ + type_test(enum1 to_suffix, name::type); +#else +#define transform_check(name, from_suffix, to_suffix)\ + type_test(int to_suffix, name::type);\ + type_test(UDT to_suffix, name::type);\ + type_test(enum1 to_suffix, name::type); +#endif + +#define boost_dummy_macro_param + +template +struct test_align +{ + struct padded + { + char c; + T t; + }; + static void do_it() + { + padded p; + unsigned a = reinterpret_cast(&(p.t)) - reinterpret_cast(&p); + ++test_count; + // only fail if we do not have a multiple of the actual value: + if((a > ::boost::alignment_of::value) || (a % ::boost::alignment_of::value)) + { + ++failures; + std::cout << "checking value of " << typeid(boost::alignment_of).name() << "...failed" << std::endl; + std::cout << "\tfound: " << boost::alignment_of::value << " expected " << a << std::endl; + } + // suppress warnings about unused variables: + (void)p; + (void)a; + } +}; +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template +struct test_align +{ + static void do_it() + { + // + // we can't do the usual test because we can't take the address + // of a reference, so check that the result is the same as for a + // pointer type instead: + unsigned a = boost::alignment_of::value; + ++test_count; + if(a != boost::alignment_of::value) + { + ++failures; + std::cout << "checking value of " << typeid(boost::alignment_of).name() << "...failed" << std::endl; + std::cout << "\tfound: " << boost::alignment_of::value << " expected " << a << std::endl; + } + } +}; +#endif + +#define align_test(T) test_align::do_it() + +template +struct test_type_with_align +{ + typedef typename boost::type_with_alignment< + (boost::alignment_of::value)>::type + align_t; + + static void do_it() + { + int align = boost::alignment_of::value; + int new_align = boost::alignment_of::value; + ++test_count; + if (new_align % align != 0) { + ++failures; + std::cerr << "checking for an object with same alignment as " + << typeid(T).name() << "...failed" << std::endl; + std::cerr << "\tfound: " << typeid(align_t).name() << std::endl; + } + } +}; + +#define type_with_align_test(T) test_type_with_align::do_it() + +// +// the following code allows us to test that a particular +// template functions correctly when instanciated inside another template +// (some bugs only show up in that situation). For each template +// we declare one NESTED_DECL(classname) that sets up the template class +// and multiple NESTED_TEST(classname, template-arg) declarations, to carry +// the actual tests: +template +struct nested_test +{ + typedef nested_test type; + bool run_time_value; + const char* what; + nested_test(bool b2, const char* w) : run_time_value(b2), what(w) { check(); } + void check() + { + ++test_count; + if(b != run_time_value) + { + ++failures; + std::cerr << "Mismatch between runtime and compile time values in " << what << std::endl; + } + } +}; + +#ifndef __SUNPRO_CC +#define NESTED_DECL(what)\ +template \ +struct BOOST_TT_JOIN(nested_tester_,what){\ + nested_test< (::boost::type_traits::ice_ne<0, ::boost::what::value>::value)> tester;\ + BOOST_TT_JOIN(nested_tester_,what)(const char* s) : tester(::boost::what::value, s){}\ +}; +#define NESTED_TEST(what, with)\ +{BOOST_TT_JOIN(nested_tester_,what) check(#what "<" #with ">"); (void)check;} +#else +#define NESTED_DECL(what) +#define NESTED_TEST(what, with) +#endif + +#define BOOST_TT_JOIN( X, Y ) BOOST_DO_TT_JOIN( X, Y ) +#define BOOST_DO_TT_JOIN( X, Y ) X##Y + + + +// +// define some types to test with: +// +enum enum_UDT{ one, two, three }; +struct UDT +{ + UDT(){}; + ~UDT(){}; + UDT(const UDT&); + UDT& operator=(const UDT&); + int i; + + void f1(); + int f2(); + int f3(int); + int f4(int, float); +}; + +typedef void(*f1)(); +typedef int(*f2)(int); +typedef int(*f3)(int, bool); +typedef void (UDT::*mf1)(); +typedef int (UDT::*mf2)(); +typedef int (UDT::*mf3)(int); +typedef int (UDT::*mf4)(int, float); +typedef int (UDT::*mp); +typedef int (UDT::*cmf)(int) const; + +// cv-qualifiers applied to reference types should have no effect +// declare these here for later use with is_reference and remove_reference: +# ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable: 4181) +# elif defined(__ICL) +# pragma warning(push) +# pragma warning(disable: 21) +# endif +// +// This is intentional: +// r_type and cr_type should be the same type +// but some compilers wrongly apply cv-qualifiers +// to reference types (this may generate a warning +// on some compilers): +// +typedef int& r_type; +typedef const r_type cr_type; +# ifdef BOOST_MSVC +# pragma warning(pop) +# elif defined(__ICL) +# pragma warning(pop) +# pragma warning(disable: 985) // identifier truncated in debug information +# endif + +struct POD_UDT { int x; }; +struct empty_UDT +{ + ~empty_UDT(){}; + empty_UDT& operator=(const empty_UDT&){ return *this; } + bool operator==(const empty_UDT&)const + { return true; } +}; +struct empty_POD_UDT +{ + empty_POD_UDT& operator=(const empty_POD_UDT&){ return *this; } + bool operator==(const empty_POD_UDT&)const + { return true; } +}; +union union_UDT +{ + int x; + double y; + ~union_UDT(); +}; +union POD_union_UDT +{ + int x; + double y; +}; +union empty_union_UDT +{ + ~empty_union_UDT(); +}; +union empty_POD_union_UDT{}; + +class Base { }; + +class Derived : public Base { }; + +class NonDerived { }; + +enum enum1 +{ + one_,two_ +}; + +enum enum2 +{ + three_,four_ +}; + +struct VB +{ + virtual ~VB(){}; +}; + +struct VD : VB +{ + ~VD(){}; +}; +// +// struct non_pointer: +// used to verify that is_pointer does not return +// true for class types that implement operator void*() +// +struct non_pointer +{ + operator void*(){return this;} +}; +struct non_int_pointer +{ + int i; + operator int*(){return &i;} +}; +struct int_constructible +{ + int_constructible(int); +}; +struct int_convertible +{ + operator int(); +}; +// +// struct non_empty: +// used to verify that is_empty does not emit +// spurious warnings or errors. +// +struct non_empty : private boost::noncopyable +{ + int i; +}; +// +// abstract base classes: +struct test_abc1 +{ + virtual void foo() = 0; + virtual void foo2() = 0; +}; + +struct test_abc2 +{ + virtual void foo() = 0; + virtual void foo2() = 0; +}; + +struct incomplete_type; + + +#endif // BOOST_TYPE_TRAITS_TEST_HPP + + + + + + + + + + diff --git a/include/boost/type_traits/utility.hpp b/include/boost/type_traits/utility.hpp new file mode 100644 index 00000000000..a51c2d9155b --- /dev/null +++ b/include/boost/type_traits/utility.hpp @@ -0,0 +1,24 @@ +// Copyright David Abrahams 2002. Permission to copy, use, +// modify, sell and distribute this software is granted provided this +// copyright notice appears in all copies. This software is provided +// "as is" without express or implied warranty, and with no claim as +// to its suitability for any purpose. +#ifndef BOOST_TT_UTILITY_HPP +# define BOOST_TT_UTILITY_HPP + +namespace boost { namespace type_traits +{ + // Utility metafunction class which always returns false + struct false_unary_metafunction + { + template + struct apply + { + BOOST_STATIC_CONSTANT(bool, value = false); + }; + }; + + template struct wrap {}; +}} // namespace boost::type_traits + +#endif // BOOST_TT_UTILITY_HPP