Bring type traits into line with TR1

[SVN r26937]
This commit is contained in:
John Maddock committed 2005-01-30 15:47:46 +00:00
1 parent 07c3946e77
commit 119a76547b
27 files changed
+1284 -61

No files matched your search

+11
View File
@@ -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"
+32
View File
@@ -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 <std::size_t Len, std::size_t Align>
struct aligned_storage
{
typedef typename type_with_alignment<Align>::type aligned_type;
struct type{
union
{
char m_buf[Len];
aligned_type m_align;
};
};
};
} // namespace boost
#endif // BOOST_TT_ALIGNED_STORAGE_HPP_INCLUDED
@@ -12,13 +12,14 @@
// $Revision$
#include <boost/type_traits/detail/template_arity_spec.hpp>
#include <boost/type_traits/integral_constant.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/aux_/lambda_support.hpp>
#include <boost/config.hpp>
#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<bool,C> 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<bool,C> 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<bool,C>
#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 <boost/mpl/integral_c.hpp>
//
// this is not a TR1 conforming integral_constant,
// but it is a first start:
//
namespace boost{
template <class T, T val>
struct integral_constant
: public BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::integral_c<T,val> {};
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
@@ -12,16 +12,19 @@
// $Revision$
#include <boost/type_traits/detail/template_arity_spec.hpp>
#include <boost/mpl/size_t.hpp>
#include <boost/type_traits/integral_constant.hpp>
#include <boost/mpl/aux_/lambda_support.hpp>
#include <boost/mpl/size_t.hpp>
#include <cstddef>
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1200
# define BOOST_TT_AUX_SIZE_T_BASE(C) ::boost::integral_constant<std::size_t,C>
# define BOOST_TT_AUX_SIZE_T_TRAIT_VALUE_DECL(C) /**/
#else
# define BOOST_TT_AUX_SIZE_T_BASE(C) ::boost::mpl::size_t<C>
# define BOOST_TT_AUX_SIZE_T_TRAIT_VALUE_DECL(C) \
typedef mpl::size_t< C > base_; \
typedef ::boost::mpl::size_t<C> 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<spec> \
: 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<spec> \
#define BOOST_TT_AUX_SIZE_T_TRAIT_PARTIAL_SPEC1_1(param,trait,spec,C) \
template< param > struct trait<spec> \
: mpl::size_t< C > \
: BOOST_TT_AUX_SIZE_T_BASE(C) \
{ \
}; \
/**/
+134
View File
@@ -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 <class T, std::size_t N>
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 <class T, std::size_t R, std::size_t N>
struct extent_imp<T[R], N>
{
BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
};
template <class T, std::size_t R, std::size_t N>
struct extent_imp<T const[R], N>
{
BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
};
template <class T, std::size_t R, std::size_t N>
struct extent_imp<T volatile[R], N>
{
BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
};
template <class T, std::size_t R, std::size_t N>
struct extent_imp<T const volatile[R], N>
{
BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
};
template <class T, std::size_t R>
struct extent_imp<T[R],0>
{
BOOST_STATIC_CONSTANT(std::size_t, value = R);
};
template <class T, std::size_t R>
struct extent_imp<T const[R], 0>
{
BOOST_STATIC_CONSTANT(std::size_t, value = R);
};
template <class T, std::size_t R>
struct extent_imp<T volatile[R], 0>
{
BOOST_STATIC_CONSTANT(std::size_t, value = R);
};
template <class T, std::size_t R>
struct extent_imp<T const volatile[R], 0>
{
BOOST_STATIC_CONSTANT(std::size_t, value = R);
};
#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840))
template <class T, std::size_t N>
struct extent_imp<T[], N>
{
BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
};
template <class T, std::size_t N>
struct extent_imp<T const[], N>
{
BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
};
template <class T, std::size_t N>
struct extent_imp<T volatile[], N>
{
BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
};
template <class T, std::size_t N>
struct extent_imp<T const volatile[], N>
{
BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
};
template <class T>
struct extent_imp<T[], 0>
{
BOOST_STATIC_CONSTANT(std::size_t, value = 0);
};
template <class T>
struct extent_imp<T const[], 0>
{
BOOST_STATIC_CONSTANT(std::size_t, value = 0);
};
template <class T>
struct extent_imp<T volatile[], 0>
{
BOOST_STATIC_CONSTANT(std::size_t, value = 0);
};
template <class T>
struct extent_imp<T const volatile[], 0>
{
BOOST_STATIC_CONSTANT(std::size_t, value = 0);
};
#endif
#endif
}
template <class T, std::size_t N = 0>
struct extent
: public ::boost::integral_constant<std::size_t, ::boost::detail::extent_imp<T,N>::value>
{
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
typedef ::boost::integral_constant<std::size_t, ::boost::detail::extent_imp<T,N>::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
+24
View File
@@ -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
+82
View File
@@ -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 <boost/config.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/integral_c.hpp>
namespace boost{
#if defined(BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS) || defined(__BORLANDC__)
template <class T, int val>
#else
template <class T, T val>
#endif
struct integral_constant : public mpl::integral_c<T, val>
{
//BOOST_STATIC_CONSTANT(T, value = val);
//typedef T value_type;
typedef integral_constant<T,val> 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<T,next_value> next;
typedef integral_constant<T,prior_value> 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<T, ( BOOST_MPL_AUX_STATIC_CAST(T, (val + 1)) )> next;
typedef integral_constant<T, ( BOOST_MPL_AUX_STATIC_CAST(T, (val - 1)) )> prior;
#else
typedef integral_constant<T, ( BOOST_MPL_AUX_STATIC_CAST(T, (value + 1)) )> next;
typedef integral_constant<T, ( BOOST_MPL_AUX_STATIC_CAST(T, (value - 1)) )> 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<T>(this->value); }
#endif
};
template<> struct integral_constant<bool,true> : public mpl::true_
{
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
typedef mpl::true_ base_;
using base_::value;
#endif
typedef integral_constant<bool,true> type;
};
template<> struct integral_constant<bool,false> : public mpl::false_
{
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
typedef mpl::false_ base_;
using base_::value;
#endif
typedef integral_constant<bool,false> type;
};
typedef integral_constant<bool,true> true_type;
typedef integral_constant<bool,false> false_type;
}
#endif
+36
View File
@@ -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<Base,Derived>::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
+27
View File
@@ -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
+46
View File
@@ -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 <typename T>
struct is_member_object_pointer_impl
{
BOOST_STATIC_CONSTANT(
bool, value = (::boost::type_traits::ice_and<
::boost::is_member_pointer<T>::value,
::boost::type_traits::ice_not<
::boost::is_member_function_pointer<T>::value
>::value
>::value ));
};
} // namespace detail
BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_object_pointer,T,::boost::detail::is_member_object_pointer_impl<T>::value)
} // namespace boost
#include "boost/type_traits/detail/bool_trait_undef.hpp"
#endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED
+75
View File
@@ -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 <class T>
struct is_signed_helper
{
BOOST_STATIC_CONSTANT(bool, value = (static_cast<T>(-1) < 0));
};
template <bool integral_type>
struct is_signed_select_helper
{
template <class T>
struct rebind
{
typedef is_signed_helper<T> type;
};
};
template <>
struct is_signed_select_helper<false>
{
template <class T>
struct rebind
{
typedef false_type type;
};
};
template <class T>
struct is_signed_imp
{
typedef is_signed_select_helper<
::boost::type_traits::ice_or<
::boost::is_integral<T>::value,
::boost::is_enum<T>::value>::value
> selector;
typedef typename selector::template rebind<T> binder;
typedef typename binder::type type;
#if defined(BOOST_MSVC) && (BOOST_MSVC <= 1200)
BOOST_STATIC_CONSTANT(bool, value = is_signed_imp<T>::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<T>::value)
} // namespace boost
#include "boost/type_traits/detail/bool_trait_undef.hpp"
#endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED
+71
View File
@@ -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 <class T>
struct is_unsigned_helper
{
BOOST_STATIC_CONSTANT(bool, value = (static_cast<T>(-1) > 0));
};
template <bool integral_type>
struct is_unsigned_select_helper
{
template <class T>
struct rebind
{
typedef is_unsigned_helper<T> type;
};
};
template <>
struct is_unsigned_select_helper<false>
{
template <class T>
struct rebind
{
typedef false_type type;
};
};
template <class T>
struct is_unsigned_imp
{
typedef is_unsigned_select_helper<
::boost::type_traits::ice_or<
::boost::is_integral<T>::value,
::boost::is_enum<T>::value>::value
> selector;
typedef typename selector::template rebind<T> 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<T>::value)
} // namespace boost
#include "boost/type_traits/detail/bool_trait_undef.hpp"
#endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED
+81
View File
@@ -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 <class T, std::size_t N>
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 <class T, std::size_t R, std::size_t N>
struct rank_imp<T[R], N>
{
BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp<T, N+1>::value));
};
template <class T, std::size_t R, std::size_t N>
struct rank_imp<T const[R], N>
{
BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp<T, N+1>::value));
};
template <class T, std::size_t R, std::size_t N>
struct rank_imp<T volatile[R], N>
{
BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp<T, N+1>::value));
};
template <class T, std::size_t R, std::size_t N>
struct rank_imp<T const volatile[R], N>
{
BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp<T, N+1>::value));
};
#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840))
template <class T, std::size_t N>
struct rank_imp<T[], N>
{
BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp<T, N+1>::value));
};
template <class T, std::size_t N>
struct rank_imp<T const[], N>
{
BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp<T, N+1>::value));
};
template <class T, std::size_t N>
struct rank_imp<T volatile[], N>
{
BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp<T, N+1>::value));
};
template <class T, std::size_t N>
struct rank_imp<T const volatile[], N>
{
BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp<T, N+1>::value));
};
#endif
#endif
}
BOOST_TT_AUX_SIZE_T_TRAIT_DEF1(rank,T,(::boost::detail::rank_imp<T,0>::value))
} // namespace boost
#include "boost/type_traits/detail/bool_trait_undef.hpp"
#endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED
+39
View File
@@ -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 <cstddef>
// 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<T>::type type)
BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_all_extents,T const[N],typename boost::remove_all_extents<T const>::type type)
BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_all_extents,T volatile[N],typename boost::remove_all_extents<T volatile>::type type)
BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_all_extents,T const volatile[N],typename boost::remove_all_extents<T const volatile>::type type)
#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<T>::type)
BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_all_extents,T const[],typename boost::remove_all_extents<T const>::type)
BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_all_extents,T volatile[],typename boost::remove_all_extents<T volatile>::type)
BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_all_extents,T const volatile[],typename boost::remove_all_extents<T const volatile>::type)
#endif
#endif
} // namespace boost
#include "boost/type_traits/detail/type_trait_undef.hpp"
#endif // BOOST_TT_REMOVE_BOUNDS_HPP_INCLUDED
+39
View File
@@ -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 <cstddef>
// should be the last #include
#include "boost/type_traits/detail/type_trait_def.hpp"
namespace boost {
BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_extent,T,T)
#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