From 119a76547b9015857aee8ff5357f4bee25d9f75d Mon Sep 17 00:00:00 2001 From: John Maddock Date: Sun, 30 Jan 2005 15:47:46 +0000 Subject: [PATCH] Bring type traits into line with TR1 [SVN r26937] --- include/boost/type_traits.hpp | 11 ++ include/boost/type_traits/aligned_storage.hpp | 32 +++++ .../type_traits/detail/bool_trait_def.hpp | 50 +------ .../type_traits/detail/size_t_trait_def.hpp | 13 +- include/boost/type_traits/extent.hpp | 134 ++++++++++++++++++ .../type_traits/has_virtual_destructor.hpp | 24 ++++ .../boost/type_traits/integral_constant.hpp | 82 +++++++++++ include/boost/type_traits/is_base_of.hpp | 36 +++++ .../boost/type_traits/is_floating_point.hpp | 27 ++++ .../type_traits/is_member_object_pointer.hpp | 46 ++++++ include/boost/type_traits/is_signed.hpp | 75 ++++++++++ include/boost/type_traits/is_unsigned.hpp | 71 ++++++++++ include/boost/type_traits/rank.hpp | 81 +++++++++++ .../boost/type_traits/remove_all_extents.hpp | 39 +++++ include/boost/type_traits/remove_extent.hpp | 39 +++++ index.html | 89 ++++++++++-- test/extent_test.cpp | 43 ++++++ test/has_virtual_destructor_test.cpp | 67 +++++++++ test/is_base_of_test.cpp | 49 +++++++ test/is_floating_point_test.cpp | 64 +++++++++ test/is_member_obj_test.cpp | 43 ++++++ test/is_signed_test.cpp | 39 +++++ test/is_unsigned_test.cpp | 39 +++++ test/rank_test.cpp | 33 +++++ test/remove_all_extents_test.cpp | 59 ++++++++ test/remove_extent_test.cpp | 59 ++++++++ test/tricky_is_enum_test.cpp | 1 + 27 files changed, 1284 insertions(+), 61 deletions(-) create mode 100755 include/boost/type_traits/aligned_storage.hpp create mode 100755 include/boost/type_traits/extent.hpp create mode 100755 include/boost/type_traits/has_virtual_destructor.hpp create mode 100755 include/boost/type_traits/integral_constant.hpp create mode 100755 include/boost/type_traits/is_base_of.hpp create mode 100755 include/boost/type_traits/is_floating_point.hpp create mode 100755 include/boost/type_traits/is_member_object_pointer.hpp create mode 100755 include/boost/type_traits/is_signed.hpp create mode 100755 include/boost/type_traits/is_unsigned.hpp create mode 100755 include/boost/type_traits/rank.hpp create mode 100755 include/boost/type_traits/remove_all_extents.hpp create mode 100755 include/boost/type_traits/remove_extent.hpp create mode 100755 test/extent_test.cpp create mode 100755 test/has_virtual_destructor_test.cpp create mode 100755 test/is_base_of_test.cpp create mode 100755 test/is_floating_point_test.cpp create mode 100755 test/is_member_obj_test.cpp create mode 100755 test/is_signed_test.cpp create mode 100755 test/is_unsigned_test.cpp create mode 100755 test/rank_test.cpp create mode 100755 test/remove_all_extents_test.cpp create mode 100755 test/remove_extent_test.cpp diff --git a/include/boost/type_traits.hpp b/include/boost/type_traits.hpp index 004d7b9..eec8f7f 100644 --- a/include/boost/type_traits.hpp +++ b/include/boost/type_traits.hpp @@ -24,10 +24,14 @@ #include "boost/type_traits/has_trivial_constructor.hpp" #include "boost/type_traits/has_trivial_copy.hpp" #include "boost/type_traits/has_trivial_destructor.hpp" +#include "boost/type_traits/has_virtual_destructor.hpp" +#include "boost/type_traits/is_signed.hpp" +#include "boost/type_traits/is_unsigned.hpp" #include "boost/type_traits/is_abstract.hpp" #include "boost/type_traits/is_arithmetic.hpp" #include "boost/type_traits/is_array.hpp" #include "boost/type_traits/is_base_and_derived.hpp" +#include "boost/type_traits/is_base_of.hpp" #include "boost/type_traits/is_class.hpp" #include "boost/type_traits/is_compound.hpp" #include "boost/type_traits/is_const.hpp" @@ -35,10 +39,12 @@ #include "boost/type_traits/is_empty.hpp" #include "boost/type_traits/is_enum.hpp" #include "boost/type_traits/is_float.hpp" +#include "boost/type_traits/is_floating_point.hpp" #include "boost/type_traits/is_function.hpp" #include "boost/type_traits/is_fundamental.hpp" #include "boost/type_traits/is_integral.hpp" #include "boost/type_traits/is_member_function_pointer.hpp" +#include "boost/type_traits/is_member_object_pointer.hpp" #include "boost/type_traits/is_member_pointer.hpp" #include "boost/type_traits/is_object.hpp" #include "boost/type_traits/is_pod.hpp" @@ -51,13 +57,18 @@ #include "boost/type_traits/is_union.hpp" #include "boost/type_traits/is_void.hpp" #include "boost/type_traits/is_volatile.hpp" +#include "boost/type_traits/rank.hpp" +#include "boost/type_traits/extent.hpp" #include "boost/type_traits/remove_bounds.hpp" +#include "boost/type_traits/remove_extent.hpp" +#include "boost/type_traits/remove_all_extents.hpp" #include "boost/type_traits/remove_const.hpp" #include "boost/type_traits/remove_cv.hpp" #include "boost/type_traits/remove_pointer.hpp" #include "boost/type_traits/remove_reference.hpp" #include "boost/type_traits/remove_volatile.hpp" #include "boost/type_traits/type_with_alignment.hpp" +#include "boost/type_traits/aligned_storage.hpp" #include "boost/type_traits/function_traits.hpp" #include "boost/type_traits/ice.hpp" diff --git a/include/boost/type_traits/aligned_storage.hpp b/include/boost/type_traits/aligned_storage.hpp new file mode 100755 index 0000000..9de4a70 --- /dev/null +++ b/include/boost/type_traits/aligned_storage.hpp @@ -0,0 +1,32 @@ + +// (C) John Maddock 2005. +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_ALIGNED_STORAGE_HPP_INCLUDED +#define BOOST_TT_ALIGNED_STORAGE_HPP_INCLUDED + +#include "boost/type_traits/type_with_alignment.hpp" + +namespace boost { + +template +struct aligned_storage +{ + typedef typename type_with_alignment::type aligned_type; + struct type{ + union + { + char m_buf[Len]; + aligned_type m_align; + }; + }; +}; + +} // namespace boost + + +#endif // BOOST_TT_ALIGNED_STORAGE_HPP_INCLUDED diff --git a/include/boost/type_traits/detail/bool_trait_def.hpp b/include/boost/type_traits/detail/bool_trait_def.hpp index fb2bb36..eccf69e 100644 --- a/include/boost/type_traits/detail/bool_trait_def.hpp +++ b/include/boost/type_traits/detail/bool_trait_def.hpp @@ -12,13 +12,14 @@ // $Revision$ #include +#include #include #include #include #if defined(__SUNPRO_CC) # define BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ - typedef BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::bool_< C > type; \ + typedef ::boost::integral_constant type; \ enum { value = type::value }; \ /**/ # define BOOST_TT_AUX_BOOL_C_BASE(C) @@ -26,7 +27,7 @@ #elif defined(BOOST_MSVC) && BOOST_MSVC <= 1200 # define BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ - typedef BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::bool_< C > base_; \ + typedef ::boost::integral_constant base_; \ using base_::value; \ /**/ @@ -37,7 +38,7 @@ #endif #ifndef BOOST_TT_AUX_BOOL_C_BASE -# define BOOST_TT_AUX_BOOL_C_BASE(C) : BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::bool_< C > +# define BOOST_TT_AUX_BOOL_C_BASE(C) : ::boost::integral_constant #endif @@ -148,46 +149,3 @@ template< param > struct trait##_impl< sp1,sp2 > \ BOOST_TT_AUX_BOOL_TRAIT_SPEC1(trait,sp,value) \ /**/ #endif - -#if 0 // there are true_type and false_type already in boost:: - // This also induces dependencies which may be undesirable - // Let's wait until sometime not just before a release and clean - // the whole ct_if mess up. -# ifndef BOOST_TT_INTEGRAL_CONSTANT -# define BOOST_TT_INTEGRAL_CONSTANT -# include - -// -// this is not a TR1 conforming integral_constant, -// but it is a first start: -// - -namespace boost{ - -template -struct integral_constant -: public BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::integral_c {}; - - -template<> struct integral_constant< bool, true > \ - BOOST_TT_AUX_BOOL_C_BASE(true) \ -{ \ - BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(true) \ - BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(1,integral_constant,(bool)) \ -}; -template<> struct integral_constant< bool, false > \ - BOOST_TT_AUX_BOOL_C_BASE(false) \ -{ \ - BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(false) \ - BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(1,integral_constant,(bool)) \ -}; - -namespace pending { -typedef BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::true_ true_type; -typedef BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::false_ false_type; -} - -} - -# endif -#endif diff --git a/include/boost/type_traits/detail/size_t_trait_def.hpp b/include/boost/type_traits/detail/size_t_trait_def.hpp index a680f99..d09d9cd 100644 --- a/include/boost/type_traits/detail/size_t_trait_def.hpp +++ b/include/boost/type_traits/detail/size_t_trait_def.hpp @@ -12,16 +12,19 @@ // $Revision$ #include -#include +#include #include +#include #include #if !defined(BOOST_MSVC) || BOOST_MSVC > 1200 +# define BOOST_TT_AUX_SIZE_T_BASE(C) ::boost::integral_constant # define BOOST_TT_AUX_SIZE_T_TRAIT_VALUE_DECL(C) /**/ #else +# define BOOST_TT_AUX_SIZE_T_BASE(C) ::boost::mpl::size_t # define BOOST_TT_AUX_SIZE_T_TRAIT_VALUE_DECL(C) \ - typedef mpl::size_t< C > base_; \ + typedef ::boost::mpl::size_t base_; \ using base_::value; \ /**/ #endif @@ -29,7 +32,7 @@ #define BOOST_TT_AUX_SIZE_T_TRAIT_DEF1(trait,T,C) \ template< typename T > struct trait \ - : mpl::size_t< C > \ + : BOOST_TT_AUX_SIZE_T_BASE(C) \ { \ BOOST_TT_AUX_SIZE_T_TRAIT_VALUE_DECL(C) \ BOOST_MPL_AUX_LAMBDA_SUPPORT(1,trait,(T)) \ @@ -40,7 +43,7 @@ BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1,trait) \ #define BOOST_TT_AUX_SIZE_T_TRAIT_SPEC1(trait,spec,C) \ template<> struct trait \ - : mpl::size_t< C > \ + : BOOST_TT_AUX_SIZE_T_BASE(C) \ { \ BOOST_TT_AUX_SIZE_T_TRAIT_VALUE_DECL(C) \ BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(1,trait,(spec)) \ @@ -49,7 +52,7 @@ template<> struct trait \ #define BOOST_TT_AUX_SIZE_T_TRAIT_PARTIAL_SPEC1_1(param,trait,spec,C) \ template< param > struct trait \ - : mpl::size_t< C > \ + : BOOST_TT_AUX_SIZE_T_BASE(C) \ { \ }; \ /**/ diff --git a/include/boost/type_traits/extent.hpp b/include/boost/type_traits/extent.hpp new file mode 100755 index 0000000..86cdb4e --- /dev/null +++ b/include/boost/type_traits/extent.hpp @@ -0,0 +1,134 @@ + +// (C) Copyright John Maddock 2005. +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + + +#ifndef BOOST_TT_EXTENT_HPP_INCLUDED +#define BOOST_TT_EXTENT_HPP_INCLUDED + +// should be the last #include +#include "boost/type_traits/detail/size_t_trait_def.hpp" + +namespace boost { + +namespace detail{ + +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = 0); +}; +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp::value)); +}; + +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp::value)); +}; + +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp::value)); +}; + +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp::value)); +}; + +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = R); +}; + +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = R); +}; + +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = R); +}; + +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = R); +}; + +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp::value)); +}; +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp::value)); +}; +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp::value)); +}; +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp::value)); +}; +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = 0); +}; +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = 0); +}; +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = 0); +}; +template +struct extent_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = 0); +}; +#endif +#endif +} + +template +struct extent + : public ::boost::integral_constant::value> +{ +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) + typedef ::boost::integral_constant::value> base_; + using base_::value; +#endif + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,extent,(T)) +}; + +} // namespace boost + +#include "boost/type_traits/detail/bool_trait_undef.hpp" + +#endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/include/boost/type_traits/has_virtual_destructor.hpp b/include/boost/type_traits/has_virtual_destructor.hpp new file mode 100755 index 0000000..9524f4e --- /dev/null +++ b/include/boost/type_traits/has_virtual_destructor.hpp @@ -0,0 +1,24 @@ + +// (C) Copyright John Maddock 2005. +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + + +#ifndef BOOST_TT_HAS_VIRTUAL_DESTRUCTOR_HPP_INCLUDED +#define BOOST_TT_HAS_VIRTUAL_DESTRUCTOR_HPP_INCLUDED + +// should be the last #include +#include "boost/type_traits/detail/bool_trait_def.hpp" + +namespace boost { + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_virtual_destructor,T,false) + +} // namespace boost + +#include "boost/type_traits/detail/bool_trait_undef.hpp" + +#endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/include/boost/type_traits/integral_constant.hpp b/include/boost/type_traits/integral_constant.hpp new file mode 100755 index 0000000..26f952a --- /dev/null +++ b/include/boost/type_traits/integral_constant.hpp @@ -0,0 +1,82 @@ +// (C) Copyright John Maddock 2005. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_TYPE_TRAITS_INTEGRAL_CONSTANT_HPP +#define BOOST_TYPE_TRAITS_INTEGRAL_CONSTANT_HPP + +#include +#include +#include + +namespace boost{ + +#if defined(BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS) || defined(__BORLANDC__) +template +#else +template +#endif +struct integral_constant : public mpl::integral_c +{ + //BOOST_STATIC_CONSTANT(T, value = val); + //typedef T value_type; + typedef integral_constant type; + +#if 0 + // + // everything that follows now, is MPL-compatibility code: + // + typedef ::boost::mpl::integral_c_tag tag; + + // have to #ifdef here: some compilers don't like the 'val + 1' form (MSVC), + // while some other don't like 'value + 1' (Borland), and some don't like + // either +#if BOOST_WORKAROUND(__EDG_VERSION__, <= 243) +private: + BOOST_STATIC_CONSTANT(T, next_value = BOOST_MPL_AUX_STATIC_CAST(T, (val + 1))); + BOOST_STATIC_CONSTANT(T, prior_value = BOOST_MPL_AUX_STATIC_CAST(T, (val - 1))); +public: + typedef integral_constant next; + typedef integral_constant prior; +#elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) \ + || BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(502)) \ + || BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(53800)) + typedef integral_constant next; + typedef integral_constant prior; +#else + typedef integral_constant next; + typedef integral_constant prior; +#endif + + // enables uniform function call syntax for families of overloaded + // functions that return objects of both arithmetic ('int', 'long', + // 'double', etc.) and wrapped integral types (for an example, see + // "mpl/example/power.cpp") + operator T() const { return static_cast(this->value); } +#endif +}; + +template<> struct integral_constant : public mpl::true_ +{ +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) + typedef mpl::true_ base_; + using base_::value; +#endif + typedef integral_constant type; +}; +template<> struct integral_constant : public mpl::false_ +{ +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) + typedef mpl::false_ base_; + using base_::value; +#endif + typedef integral_constant type; +}; + +typedef integral_constant true_type; +typedef integral_constant false_type; + +} + +#endif diff --git a/include/boost/type_traits/is_base_of.hpp b/include/boost/type_traits/is_base_of.hpp new file mode 100755 index 0000000..a02a15f --- /dev/null +++ b/include/boost/type_traits/is_base_of.hpp @@ -0,0 +1,36 @@ + +// (C) Copyright Rani Sharoni 2003-2005. +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_IS_BASE_OF_HPP_INCLUDED +#define BOOST_TT_IS_BASE_OF_HPP_INCLUDED + +#include "boost/type_traits/is_base_and_derived.hpp" + +// should be the last #include +#include "boost/type_traits/detail/bool_trait_def.hpp" + +namespace boost { + +BOOST_TT_AUX_BOOL_TRAIT_DEF2( + is_base_of + , Base + , Derived + , (::boost::detail::is_base_and_derived_impl::value) + ) + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base&,Derived,false) +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base,Derived&,false) +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base&,Derived&,false) +#endif + +} // namespace boost + +#include "boost/type_traits/detail/bool_trait_undef.hpp" + +#endif // BOOST_TT_IS_BASE_AND_DERIVED_HPP_INCLUDED diff --git a/include/boost/type_traits/is_floating_point.hpp b/include/boost/type_traits/is_floating_point.hpp new file mode 100755 index 0000000..eec7c85 --- /dev/null +++ b/include/boost/type_traits/is_floating_point.hpp @@ -0,0 +1,27 @@ + +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000-2005. +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TYPE_TRAITS_IS_FLOATING_HPP_INCLUDED +#define BOOST_TYPE_TRAITS_IS_FLOATING_HPP_INCLUDED + +// should be the last #include +#include "boost/type_traits/detail/bool_trait_def.hpp" + +namespace boost { + +//* is a type T a floating-point type described in the standard (3.9.1p8) +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_floating_point,T,false) +BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_floating_point,float,true) +BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_floating_point,double,true) +BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_floating_point,long double,true) + +} // namespace boost + +#include "boost/type_traits/detail/bool_trait_undef.hpp" + +#endif // BOOST_TYPE_TRAITS_IS_FLOAT_HPP_INCLUDED diff --git a/include/boost/type_traits/is_member_object_pointer.hpp b/include/boost/type_traits/is_member_object_pointer.hpp new file mode 100755 index 0000000..b1e8bf2 --- /dev/null +++ b/include/boost/type_traits/is_member_object_pointer.hpp @@ -0,0 +1,46 @@ + +// (C) Copyright John Maddock 2005. +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + + +#ifndef BOOST_TT_IS_MEMBER_OBJECT_POINTER_HPP_INCLUDED +#define BOOST_TT_IS_MEMBER_OBJECT_POINTER_HPP_INCLUDED + +#include "boost/type_traits/config.hpp" +#include "boost/type_traits/is_member_pointer.hpp" +#include "boost/type_traits/is_member_function_pointer.hpp" +#include "boost/type_traits/detail/ice_and.hpp" +#include "boost/type_traits/detail/ice_not.hpp" + +// should be the last #include +#include "boost/type_traits/detail/bool_trait_def.hpp" + +namespace boost { + +namespace detail{ + +template +struct is_member_object_pointer_impl +{ + BOOST_STATIC_CONSTANT( + bool, value = (::boost::type_traits::ice_and< + ::boost::is_member_pointer::value, + ::boost::type_traits::ice_not< + ::boost::is_member_function_pointer::value + >::value + >::value )); +}; + +} // namespace detail + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_object_pointer,T,::boost::detail::is_member_object_pointer_impl::value) + +} // namespace boost + +#include "boost/type_traits/detail/bool_trait_undef.hpp" + +#endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/include/boost/type_traits/is_signed.hpp b/include/boost/type_traits/is_signed.hpp new file mode 100755 index 0000000..56522c4 --- /dev/null +++ b/include/boost/type_traits/is_signed.hpp @@ -0,0 +1,75 @@ + +// (C) Copyright John Maddock 2005. +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + + +#ifndef BOOST_TT_IS_SIGNED_HPP_INCLUDED +#define BOOST_TT_IS_SIGNED_HPP_INCLUDED + +#include "boost/type_traits/is_integral.hpp" +#include "boost/type_traits/is_enum.hpp" +#include "boost/type_traits/detail/ice_or.hpp" + +// should be the last #include +#include "boost/type_traits/detail/bool_trait_def.hpp" + +namespace boost { + +namespace detail{ + +template +struct is_signed_helper +{ + BOOST_STATIC_CONSTANT(bool, value = (static_cast(-1) < 0)); +}; + +template +struct is_signed_select_helper +{ + template + struct rebind + { + typedef is_signed_helper type; + }; +}; + +template <> +struct is_signed_select_helper +{ + template + struct rebind + { + typedef false_type type; + }; +}; + +template +struct is_signed_imp +{ + typedef is_signed_select_helper< + ::boost::type_traits::ice_or< + ::boost::is_integral::value, + ::boost::is_enum::value>::value + > selector; + typedef typename selector::template rebind binder; + typedef typename binder::type type; +#if defined(BOOST_MSVC) && (BOOST_MSVC <= 1200) + BOOST_STATIC_CONSTANT(bool, value = is_signed_imp::type::value); +#else + BOOST_STATIC_CONSTANT(bool, value = type::value); +#endif +}; + +} + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_signed,T,::boost::detail::is_signed_imp::value) + +} // namespace boost + +#include "boost/type_traits/detail/bool_trait_undef.hpp" + +#endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/include/boost/type_traits/is_unsigned.hpp b/include/boost/type_traits/is_unsigned.hpp new file mode 100755 index 0000000..fd71611 --- /dev/null +++ b/include/boost/type_traits/is_unsigned.hpp @@ -0,0 +1,71 @@ + +// (C) Copyright John Maddock 2005. +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + + +#ifndef BOOST_TT_IS_UNSIGNED_HPP_INCLUDED +#define BOOST_TT_IS_UNSIGNED_HPP_INCLUDED + +#include "boost/type_traits/is_integral.hpp" +#include "boost/type_traits/is_enum.hpp" +#include "boost/type_traits/detail/ice_or.hpp" + +// should be the last #include +#include "boost/type_traits/detail/bool_trait_def.hpp" + +namespace boost { + +namespace detail{ + +template +struct is_unsigned_helper +{ + BOOST_STATIC_CONSTANT(bool, value = (static_cast(-1) > 0)); +}; + +template +struct is_unsigned_select_helper +{ + template + struct rebind + { + typedef is_unsigned_helper type; + }; +}; + +template <> +struct is_unsigned_select_helper +{ + template + struct rebind + { + typedef false_type type; + }; +}; + +template +struct is_unsigned_imp +{ + typedef is_unsigned_select_helper< + ::boost::type_traits::ice_or< + ::boost::is_integral::value, + ::boost::is_enum::value>::value + > selector; + typedef typename selector::template rebind binder; + typedef typename binder::type type; + BOOST_STATIC_CONSTANT(bool, value = type::value); +}; + +} + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_unsigned,T,::boost::detail::is_unsigned_imp::value) + +} // namespace boost + +#include "boost/type_traits/detail/bool_trait_undef.hpp" + +#endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/include/boost/type_traits/rank.hpp b/include/boost/type_traits/rank.hpp new file mode 100755 index 0000000..c58ef8d --- /dev/null +++ b/include/boost/type_traits/rank.hpp @@ -0,0 +1,81 @@ + +// (C) Copyright John Maddock 2005. +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + + +#ifndef BOOST_TT_RANK_HPP_INCLUDED +#define BOOST_TT_RANK_HPP_INCLUDED + +// should be the last #include +#include "boost/type_traits/detail/size_t_trait_def.hpp" + +namespace boost { + +namespace detail{ + +template +struct rank_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = N); +}; +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) +template +struct rank_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp::value)); +}; + +template +struct rank_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp::value)); +}; + +template +struct rank_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp::value)); +}; + +template +struct rank_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp::value)); +}; + +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) +template +struct rank_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp::value)); +}; +template +struct rank_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp::value)); +}; +template +struct rank_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp::value)); +}; +template +struct rank_imp +{ + BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp::value)); +}; +#endif +#endif +} + +BOOST_TT_AUX_SIZE_T_TRAIT_DEF1(rank,T,(::boost::detail::rank_imp::value)) + +} // namespace boost + +#include "boost/type_traits/detail/bool_trait_undef.hpp" + +#endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/include/boost/type_traits/remove_all_extents.hpp b/include/boost/type_traits/remove_all_extents.hpp new file mode 100755 index 0000000..b64112b --- /dev/null +++ b/include/boost/type_traits/remove_all_extents.hpp @@ -0,0 +1,39 @@ + +// (C) Copyright John Maddock 2005. +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_REMOVE_ALL_EXTENTS_HPP_INCLUDED +#define BOOST_TT_REMOVE_ALL_EXTENTS_HPP_INCLUDED + +#include "boost/config.hpp" +#include + +// should be the last #include +#include "boost/type_traits/detail/type_trait_def.hpp" + +namespace boost { + +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_all_extents,T,T) + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_all_extents,T[N],typename boost::remove_all_extents::type type) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_all_extents,T const[N],typename boost::remove_all_extents::type type) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_all_extents,T volatile[N],typename boost::remove_all_extents::type type) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_all_extents,T const volatile[N],typename boost::remove_all_extents::type type) +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_all_extents,T[],typename boost::remove_all_extents::type) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_all_extents,T const[],typename boost::remove_all_extents::type) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_all_extents,T volatile[],typename boost::remove_all_extents::type) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_all_extents,T const volatile[],typename boost::remove_all_extents::type) +#endif +#endif + +} // namespace boost + +#include "boost/type_traits/detail/type_trait_undef.hpp" + +#endif // BOOST_TT_REMOVE_BOUNDS_HPP_INCLUDED diff --git a/include/boost/type_traits/remove_extent.hpp b/include/boost/type_traits/remove_extent.hpp new file mode 100755 index 0000000..693f1af --- /dev/null +++ b/include/boost/type_traits/remove_extent.hpp @@ -0,0 +1,39 @@ + +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000-2005. +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_REMOVE_EXTENT_HPP_INCLUDED +#define BOOST_TT_REMOVE_EXTENT_HPP_INCLUDED + +#include "boost/config.hpp" +#include + +// should be the last #include +#include "boost/type_traits/detail/type_trait_def.hpp" + +namespace boost { + +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_extent,T,T) + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_extent,T[N],T type) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_extent,T const[N],T const type) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_extent,T volatile[N],T volatile type) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_extent,T const volatile[N],T const volatile type) +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_extent,T[],T) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_extent,T const[],T const) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_extent,T volatile[],T volatile) +BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_extent,T const volatile[],T const volatile) +#endif +#endif + +} // namespace boost + +#include "boost/type_traits/detail/type_trait_undef.hpp" + +#endif // BOOST_TT_REMOVE_BOUNDS_HPP_INCLUDED diff --git a/index.html b/index.html index 2709ca7..5ba5c27 100644 --- a/index.html +++ b/index.html @@ -40,10 +40,10 @@

The following type traits templates identify which type category the type belongs to. For any given type, exactly one of the following expressions will evaluate to true. Note that this means that is_integral<T>::value - and is_float<T>::value will only every be true for built-in - types; if you want to check for a user-defined type that may behave "as if" it - is an integral or floating point type, then use the std::numeric_limits - template instead.

+ and is_floating_point<T>::value will only every be true for + built-in types; if you want to check for a user-defined type that may behave + "as if" it is an integral or floating point type, then use the + std::numeric_limits template instead.

@@ -80,7 +80,7 @@ - + + + + + + + + +
 
 ::boost::is_float<T>::value::boost::is_floating_point<T>::value Evaluates to true only if T is a cv-qualified floating point type.

3.9.1p8

@@ -279,6 +279,19 @@
   
::boost::is_member_object_pointer<T>::valueEvaluates to true only if T is a pointer to a member + object(and not a pointer to a member function). This template splits + is_member_pointer into two sub-categories. +

3.9.2

+

8.3.3

+

 

Type Properties

@@ -309,6 +322,28 @@     + + + ::boost::rank<T>::value + The number of array dimentions in type T.  + Zero if T is not an array type. + + Requires partial specialisation of class + templates. + + + + + ::boost::extent<T, std::size_t N = + 0>::value + The number of elements in the N'th array bound + of T.  If T has fewer than N bounds, or if the N'th array bound is + incomplete, then zero. + + Requires partial specialisation of class + templates. + +   ::boost::is_empty<T>::value @@ -382,6 +417,18 @@ actually seem to work with the majority of compilers though.   + + + ::boost::has_virtual_destructor<T>::value + Should evaluate to true whenever type T has a + virtual destructor: currently evaluates to false in all cases, unless + user-specialised. + 12.4 + There is currently no way to portably implement + this trait, the default version provided always evaluates to false, and has to + be explicity specialised for types with virtual destructors. + +   ::boost::is_pod<T>::value @@ -588,7 +635,7 @@   - ::boost::is_base_and_derived<T,U>::value + ::boost::is_base_of<T,U>::value Evaluates to true if type T is a base class to type U.

Will detect non-public base classes, and ambiguous base classes.

Note that a class is not considered to be it's own base class, likewise, if @@ -603,13 +650,13 @@   -

Note that both is_convertible, and is_base_and_derived - can produce compiler errors if the convertion is ambiguous:

+

Note that both is_convertible, and is_base_of can + produce compiler errors if the convertion is ambiguous:

struct A {};
 struct B : A {};
 struct C : A {};
 struct D : B, C {};
-bool const x = boost::is_base_and_derived<A,D>::value;  // error
+bool const x = boost::is_base_of<A,D>::value;  // error
 bool const y = boost::is_convertible<D*,A*>::value;     // error
 

Transformations Between Types

@@ -684,7 +731,7 @@ bool const y = boost::is_convertible<D*,A*>::value; // error   - ::boost::remove_bounds<T>::type + ::boost::remove_extent<T>::type If T is an array type then removes the top level array qualifier from T, otherwise leaves T unchanged. For example "int[2][3]" becomes "int[3]". @@ -695,6 +742,19 @@ bool const y = boost::is_convertible<D*,A*>::value; // error   + + + ::boost::remove_all_extents<T>::type + If T is an array type then removes + the all the array qualifiers from T, otherwise leaves T unchanged. For example + "int[2][3]" becomes "int". + 8.3.4 + +

If the compiler does not support partial-specialization of class + templates, then this template will compile, but will have no effect.

+ + +   ::boost::remove_pointer<T>::type @@ -822,6 +882,15 @@ bool const y = boost::is_convertible<D*,A*>::value; // error     + + + ::boost::aligned_storage<Size,Align>::type + Attempts to find a POD type of size + Size, and alignment Align. + + + +

Function Traits

The ::boost::function_traits class template extracts information diff --git a/test/extent_test.cpp b/test/extent_test.cpp new file mode 100755 index 0000000..3a0b68c --- /dev/null +++ b/test/extent_test.cpp @@ -0,0 +1,43 @@ + +// (C) Copyright John Maddock 2005. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include "test.hpp" +#include "check_integral_constant.hpp" +#ifdef TEST_STD +# include +#else +# include +#endif + +TT_TEST_BEGIN(extent) + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::extent::value, 0); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::extent::value, 0); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::extent::value, 0); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::extent::value, 5); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::extent::value, 5); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::extent::value, 0); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::extent::value, 0); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::extent::value), 0); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::extent::value), 0); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::extent::value), 10); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::extent::value), 10); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::extent::value), 10); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::extent::value), 0); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::extent::value), 0); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::extent::value), 0); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::extent::value), 40); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::extent::value), 0); + +TT_TEST_END + + + + + + + + diff --git a/test/has_virtual_destructor_test.cpp b/test/has_virtual_destructor_test.cpp new file mode 100755 index 0000000..612fdd8 --- /dev/null +++ b/test/has_virtual_destructor_test.cpp @@ -0,0 +1,67 @@ + +// (C) Copyright John Maddock 2005. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include "test.hpp" +#include "check_integral_constant.hpp" +#ifdef TEST_STD +# include +#else +# include +#endif + +#include +#include + +TT_TEST_BEGIN(has_virtual_destructor) + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +#ifndef BOOST_NO_STD_LOCALE +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor >::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor >::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor >::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor >::value, false); +// some libraries don't make this one a polymorphic class, since this is a library +// rather than a type traits issue we won't test this for now... +//BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +#endif +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); + +TT_TEST_END + + + + + + + + diff --git a/test/is_base_of_test.cpp b/test/is_base_of_test.cpp new file mode 100755 index 0000000..d9a693f --- /dev/null +++ b/test/is_base_of_test.cpp @@ -0,0 +1,49 @@ + +// (C) Copyright John Maddock 2005. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + +#include "test.hpp" +#include "check_integral_constant.hpp" +#ifdef TEST_STD +# include +#else +# include +#endif + + + +TT_TEST_BEGIN(is_base_of) + +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), true); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), true); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), true); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), true); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), true); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), true); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), true); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), false); + +TT_TEST_END + + + + + + + + + diff --git a/test/is_floating_point_test.cpp b/test/is_floating_point_test.cpp new file mode 100755 index 0000000..262d51f --- /dev/null +++ b/test/is_floating_point_test.cpp @@ -0,0 +1,64 @@ + +// (C) Copyright John Maddock 2005. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include "test.hpp" +#include "check_integral_constant.hpp" +#ifdef TEST_STD +# include +#else +# include +#endif + +TT_TEST_BEGIN(is_floating_point) + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); + +// +// cases that should not be true: +// +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, false); + +// +// tricky cases: +// +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, false); + +TT_TEST_END + + + + + + + + diff --git a/test/is_member_obj_test.cpp b/test/is_member_obj_test.cpp new file mode 100755 index 0000000..31a36a6 --- /dev/null +++ b/test/is_member_obj_test.cpp @@ -0,0 +1,43 @@ + +// (C) Copyright John Maddock 2005. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include "test.hpp" +#include "check_integral_constant.hpp" +#ifdef TEST_STD +# include +#else +# include +#endif + +typedef const double (UDT::*mp2) ; + +TT_TEST_BEGIN(is_member_object_pointer) + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer::value, false); + +TT_TEST_END + + + + + + + + diff --git a/test/is_signed_test.cpp b/test/is_signed_test.cpp new file mode 100755 index 0000000..548ec41 --- /dev/null +++ b/test/is_signed_test.cpp @@ -0,0 +1,39 @@ + +// (C) Copyright John Maddock 2005. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include "test.hpp" +#include "check_integral_constant.hpp" +#ifdef TEST_STD +# include +#else +# include +#endif + +TT_TEST_BEGIN(is_signed) + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed::value, false); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed::value, false); + +TT_TEST_END + + + + + + + + diff --git a/test/is_unsigned_test.cpp b/test/is_unsigned_test.cpp new file mode 100755 index 0000000..868d576 --- /dev/null +++ b/test/is_unsigned_test.cpp @@ -0,0 +1,39 @@ + +// (C) Copyright John Maddock 2005. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include "test.hpp" +#include "check_integral_constant.hpp" +#ifdef TEST_STD +# include +#else +# include +#endif + +TT_TEST_BEGIN(is_signed) + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned::value, false); + +TT_TEST_END + + + + + + + + diff --git a/test/rank_test.cpp b/test/rank_test.cpp new file mode 100755 index 0000000..7e3e094 --- /dev/null +++ b/test/rank_test.cpp @@ -0,0 +1,33 @@ + +// (C) Copyright John Maddock 2005. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include "test.hpp" +#include "check_integral_constant.hpp" +#ifdef TEST_STD +# include +#else +# include +#endif + +TT_TEST_BEGIN(rank) + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::rank::value, 0); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::rank::value, 1); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::rank::value, 2); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::rank::value, 2); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::rank::value, 3); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::rank::value, 0); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::rank::value, 0); + +TT_TEST_END + + + + + + + + diff --git a/test/remove_all_extents_test.cpp b/test/remove_all_extents_test.cpp new file mode 100755 index 0000000..16236a5 --- /dev/null +++ b/test/remove_all_extents_test.cpp @@ -0,0 +1,59 @@ + +// (C) Copyright John Maddock 2005. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include "test.hpp" +#include "check_type.hpp" +#ifdef TEST_STD +# include +#else +# include +#endif + +BOOST_DECL_TRANSFORM_TEST(remove_all_extents_test_1, ::boost::remove_all_extents, const, const) +BOOST_DECL_TRANSFORM_TEST(remove_all_extents_test_2, ::boost::remove_all_extents, volatile, volatile) +BOOST_DECL_TRANSFORM_TEST3(remove_all_extents_test_3, ::boost::remove_all_extents, [2]) +BOOST_DECL_TRANSFORM_TEST0(remove_all_extents_test_4, ::boost::remove_all_extents) +BOOST_DECL_TRANSFORM_TEST(remove_all_extents_test_5, ::boost::remove_all_extents, const &, const&) +BOOST_DECL_TRANSFORM_TEST(remove_all_extents_test_6, ::boost::remove_all_extents, *, *) +BOOST_DECL_TRANSFORM_TEST(remove_all_extents_test_7, ::boost::remove_all_extents, *volatile, *volatile) +BOOST_DECL_TRANSFORM_TEST(remove_all_extents_test_8, ::boost::remove_all_extents, const [2], const) +BOOST_DECL_TRANSFORM_TEST(remove_all_extents_test_9, ::boost::remove_all_extents, const &, const&) +BOOST_DECL_TRANSFORM_TEST(remove_all_extents_test_10, ::boost::remove_all_extents, const*, const*) +BOOST_DECL_TRANSFORM_TEST(remove_all_extents_test_11, ::boost::remove_all_extents, volatile*, volatile*) +BOOST_DECL_TRANSFORM_TEST(remove_all_extents_test_12, ::boost::remove_all_extents, const[2][3], const) +BOOST_DECL_TRANSFORM_TEST(remove_all_extents_test_13, ::boost::remove_all_extents, (&)[2], (&)[2]) +BOOST_DECL_TRANSFORM_TEST3(remove_all_extents_test_14, ::boost::remove_all_extents, []) +BOOST_DECL_TRANSFORM_TEST(remove_all_extents_test_15, ::boost::remove_all_extents, const [], const) +BOOST_DECL_TRANSFORM_TEST(remove_all_extents_test_16, ::boost::remove_all_extents, const[][3], const) + +TT_TEST_BEGIN(remove_all_extents) + + remove_all_extents_test_1(); + remove_all_extents_test_2(); + remove_all_extents_test_3(); + remove_all_extents_test_4(); + remove_all_extents_test_5(); + remove_all_extents_test_6(); + remove_all_extents_test_7(); + remove_all_extents_test_8(); + remove_all_extents_test_9(); + remove_all_extents_test_10(); + remove_all_extents_test_11(); + remove_all_extents_test_12(); + remove_all_extents_test_13(); + remove_all_extents_test_14(); + remove_all_extents_test_15(); + remove_all_extents_test_16(); + +TT_TEST_END + + + + + + + + diff --git a/test/remove_extent_test.cpp b/test/remove_extent_test.cpp new file mode 100755 index 0000000..f71f14e --- /dev/null +++ b/test/remove_extent_test.cpp @@ -0,0 +1,59 @@ + +// (C) Copyright John Maddock 2005. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include "test.hpp" +#include "check_type.hpp" +#ifdef TEST_STD +# include +#else +# include +#endif + +BOOST_DECL_TRANSFORM_TEST(remove_extent_test_1, ::boost::remove_extent, const, const) +BOOST_DECL_TRANSFORM_TEST(remove_extent_test_2, ::boost::remove_extent, volatile, volatile) +BOOST_DECL_TRANSFORM_TEST3(remove_extent_test_3, ::boost::remove_extent, [2]) +BOOST_DECL_TRANSFORM_TEST0(remove_extent_test_4, ::boost::remove_extent) +BOOST_DECL_TRANSFORM_TEST(remove_extent_test_5, ::boost::remove_extent, const &, const&) +BOOST_DECL_TRANSFORM_TEST(remove_extent_test_6, ::boost::remove_extent, *, *) +BOOST_DECL_TRANSFORM_TEST(remove_extent_test_7, ::boost::remove_extent, *volatile, *volatile) +BOOST_DECL_TRANSFORM_TEST(remove_extent_test_8, ::boost::remove_extent, const [2], const) +BOOST_DECL_TRANSFORM_TEST(remove_extent_test_9, ::boost::remove_extent, const &, const&) +BOOST_DECL_TRANSFORM_TEST(remove_extent_test_10, ::boost::remove_extent, const*, const*) +BOOST_DECL_TRANSFORM_TEST(remove_extent_test_11, ::boost::remove_extent, volatile*, volatile*) +BOOST_DECL_TRANSFORM_TEST(remove_extent_test_12, ::boost::remove_extent, const[2][3], const[3]) +BOOST_DECL_TRANSFORM_TEST(remove_extent_test_13, ::boost::remove_extent, (&)[2], (&)[2]) +BOOST_DECL_TRANSFORM_TEST3(remove_extent_test_14, ::boost::remove_extent, []) +BOOST_DECL_TRANSFORM_TEST(remove_extent_test_15, ::boost::remove_extent, const [], const) +BOOST_DECL_TRANSFORM_TEST(remove_extent_test_16, ::boost::remove_extent, const[][3], const[3]) + +TT_TEST_BEGIN(remove_extent) + + remove_extent_test_1(); + remove_extent_test_2(); + remove_extent_test_3(); + remove_extent_test_4(); + remove_extent_test_5(); + remove_extent_test_6(); + remove_extent_test_7(); + remove_extent_test_8(); + remove_extent_test_9(); + remove_extent_test_10(); + remove_extent_test_11(); + remove_extent_test_12(); + remove_extent_test_13(); + remove_extent_test_14(); + remove_extent_test_15(); + remove_extent_test_16(); + +TT_TEST_END + + + + + + + + diff --git a/test/tricky_is_enum_test.cpp b/test/tricky_is_enum_test.cpp index 7f8f02a..b7c7d38 100755 --- a/test/tricky_is_enum_test.cpp +++ b/test/tricky_is_enum_test.cpp @@ -20,6 +20,7 @@ struct convertible_to_anything TT_TEST_BEGIN(is_enum) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_enum::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_enum::value, false); TT_TEST_END