forked from boostorg/type_traits
Bring type traits into line with TR1
[SVN r26937]
This commit is contained in:
@@ -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
include/boost/type_traits/aligned_storage.hpp
Executable file
32
include/boost/type_traits/aligned_storage.hpp
Executable 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
include/boost/type_traits/extent.hpp
Executable file
134
include/boost/type_traits/extent.hpp
Executable 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
include/boost/type_traits/has_virtual_destructor.hpp
Executable file
24
include/boost/type_traits/has_virtual_destructor.hpp
Executable 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
include/boost/type_traits/integral_constant.hpp
Executable file
82
include/boost/type_traits/integral_constant.hpp
Executable 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
include/boost/type_traits/is_base_of.hpp
Executable file
36
include/boost/type_traits/is_base_of.hpp
Executable 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
include/boost/type_traits/is_floating_point.hpp
Executable file
27
include/boost/type_traits/is_floating_point.hpp
Executable 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
include/boost/type_traits/is_member_object_pointer.hpp
Executable file
46
include/boost/type_traits/is_member_object_pointer.hpp
Executable 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
include/boost/type_traits/is_signed.hpp
Executable file
75
include/boost/type_traits/is_signed.hpp
Executable 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
include/boost/type_traits/is_unsigned.hpp
Executable file
71
include/boost/type_traits/is_unsigned.hpp
Executable 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
include/boost/type_traits/rank.hpp
Executable file
81
include/boost/type_traits/rank.hpp
Executable 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
include/boost/type_traits/remove_all_extents.hpp
Executable file
39
include/boost/type_traits/remove_all_extents.hpp
Executable 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
include/boost/type_traits/remove_extent.hpp
Executable file
39
include/boost/type_traits/remove_extent.hpp
Executable 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
|
89
index.html
89
index.html
@@ -40,10 +40,10 @@
|
||||
<p>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 <code>is_integral<T>::value</code>
|
||||
and <code>is_float<T>::value</code> 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.</p>
|
||||
and <code>is_floating_point<T>::value</code> 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.</p>
|
||||
<table border="0" cellpadding="7" cellspacing="1" width="100%">
|
||||
<tr>
|
||||
<td valign="top" width="5%"> </td>
|
||||
@@ -80,7 +80,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="5%"> </td>
|
||||
<td valign="top" width="23%" bgcolor="#c0c0c0"><code>::boost::is_float<T>::value</code></td>
|
||||
<td valign="top" width="23%" bgcolor="#c0c0c0"><code>::boost::is_floating_point<T>::value</code></td>
|
||||
<td valign="top" width="26%" bgcolor="#c0c0c0">Evaluates to true only if T is a
|
||||
cv-qualified floating point type.</td>
|
||||
<td valign="top" width="16%" bgcolor="#c0c0c0"><p align="center">3.9.1p8</p>
|
||||
@@ -279,6 +279,19 @@
|
||||
<td bgcolor="#c0c0c0"> </td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<TR>
|
||||
<TD></TD>
|
||||
<TD bgColor="#c0c0c0"><CODE>::boost::is_member_object_pointer<T>::value</CODE></TD>
|
||||
<TD bgColor="#c0c0c0">Evaluates 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.</TD>
|
||||
<TD bgColor="#c0c0c0">
|
||||
<P align="center">3.9.2</P>
|
||||
<P align="center">8.3.3</P>
|
||||
</TD>
|
||||
<TD bgColor="#c0c0c0"></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
</table>
|
||||
<p> </p>
|
||||
<h2><a name="properties"></a>Type Properties</h2>
|
||||
@@ -309,6 +322,28 @@
|
||||
<td valign="top" bgcolor="#c0c0c0"> </td>
|
||||
<td valign="top" width="5%"> </td>
|
||||
</tr>
|
||||
<TR>
|
||||
<TD vAlign="top" width="5%"></TD>
|
||||
<TD vAlign="top" bgColor="#c0c0c0"><CODE>::boost::rank<T>::value</CODE></TD>
|
||||
<TD vAlign="top" bgColor="#c0c0c0">The number of array dimentions in type T.
|
||||
Zero if T is not an array type.</TD>
|
||||
<TD vAlign="top" bgColor="#c0c0c0"></TD>
|
||||
<TD vAlign="top" bgColor="#c0c0c0">Requires partial specialisation of class
|
||||
templates.</TD>
|
||||
<TD vAlign="top" width="5%"></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="5%"></TD>
|
||||
<TD vAlign="top" bgColor="#c0c0c0"><CODE>::boost::extent<T, std::size_t N =
|
||||
0>::value</CODE></TD>
|
||||
<TD vAlign="top" bgColor="#c0c0c0">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.</TD>
|
||||
<TD vAlign="top" bgColor="#c0c0c0"></TD>
|
||||
<TD vAlign="top" bgColor="#c0c0c0">Requires partial specialisation of class
|
||||
templates.</TD>
|
||||
<TD vAlign="top" width="5%"></TD>
|
||||
</TR>
|
||||
<tr>
|
||||
<td valign="top" width="5%"> </td>
|
||||
<td valign="top" bgcolor="#c0c0c0"><code>::boost::is_empty<T>::value</code></td>
|
||||
@@ -382,6 +417,18 @@
|
||||
actually seem to work with the majority of compilers though.</td>
|
||||
<td valign="top" width="5%"> </td>
|
||||
</tr>
|
||||
<TR>
|
||||
<TD vAlign="top" width="5%"></TD>
|
||||
<TD vAlign="top" bgColor="#c0c0c0"><CODE>::boost::has_virtual_destructor<T>::value</CODE></TD>
|
||||
<TD vAlign="top" bgColor="#c0c0c0">Should evaluate to true whenever type T has a
|
||||
virtual destructor: currently evaluates to false in all cases, unless
|
||||
user-specialised.</TD>
|
||||
<TD vAlign="top" bgColor="#c0c0c0">12.4</TD>
|
||||
<TD vAlign="top" bgColor="#c0c0c0">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.</TD>
|
||||
<TD vAlign="top" width="5%"></TD>
|
||||
</TR>
|
||||
<tr>
|
||||
<td valign="top" width="5%"> </td>
|
||||
<td valign="top" bgcolor="#c0c0c0"><code>::boost::is_pod<T>::value</code></td>
|
||||
@@ -588,7 +635,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td valign="top" bgcolor="#c0c0c0"><code>::boost::is_base_and_derived<T,U>::value</code></td>
|
||||
<td valign="top" bgcolor="#c0c0c0"><code>::boost::is_base_of<T,U>::value</code></td>
|
||||
<td bgcolor="#c0c0c0">Evaluates to true if type T is a base class to type U.<p>Will
|
||||
detect non-public base classes, and ambiguous base classes.</p>
|
||||
<p>Note that a class is not considered to be it's own base class, likewise, if
|
||||
@@ -603,13 +650,13 @@
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>Note that both <code>is_convertible</code>, and <code>is_base_and_derived</code>
|
||||
can produce compiler errors if the convertion is ambiguous:</p>
|
||||
<p>Note that both <code>is_convertible</code>, and <code>is_base_of</code> can
|
||||
produce compiler errors if the convertion is ambiguous:</p>
|
||||
<pre>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
|
||||
</pre>
|
||||
<h2><a name="transformations"></a>Transformations Between Types</h2>
|
||||
@@ -684,7 +731,7 @@ bool const y = boost::is_convertible<D*,A*>::value; // error
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="5%"> </td>
|
||||
<td valign="top" width="23%" bgcolor="#c0c0c0"><code>::boost::remove_bounds<T>::type</code></td>
|
||||
<td valign="top" width="23%" bgcolor="#c0c0c0"><code>::boost::remove_extent<T>::type</code></td>
|
||||
<td valign="top" width="28%" bgcolor="#c0c0c0">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]".</td>
|
||||
@@ -695,6 +742,19 @@ bool const y = boost::is_convertible<D*,A*>::value; // error
|
||||
</td>
|
||||
<td valign="top" width="5%"> </td>
|
||||
</tr>
|
||||
<TR>
|
||||
<TD vAlign="top" width="5%"></TD>
|
||||
<TD vAlign="top" width="23%" bgColor="#c0c0c0"><FONT face="Courier New"><CODE>::boost::remove_all_extents<T>::type</CODE></FONT></TD>
|
||||
<TD vAlign="top" width="28%" bgColor="#c0c0c0">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".</TD>
|
||||
<TD vAlign="top" width="13%" bgColor="#c0c0c0">8.3.4</TD>
|
||||
<TD width="25%" bgColor="#c0c0c0">
|
||||
<P align="left">If the compiler does not support partial-specialization of class
|
||||
templates, then this template will compile, but will have no effect.</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="5%"></TD>
|
||||
</TR>
|
||||
<tr>
|
||||
<td valign="top" width="5%"> </td>
|
||||
<td valign="top" width="23%" bgcolor="#c0c0c0"><code>::boost::remove_pointer<T>::type</code></td>
|
||||
@@ -822,6 +882,15 @@ bool const y = boost::is_convertible<D*,A*>::value; // error
|
||||
<td width="25%" bgcolor="#c0c0c0"> </td>
|
||||
<td valign="top" width="5%"> </td>
|
||||
</tr>
|
||||
<TR>
|
||||
<TD vAlign="top" width="5%"></TD>
|
||||
<TD vAlign="top" width="23%" bgColor="#c0c0c0"><CODE>::boost::aligned_storage<Size,Align>::type</CODE></TD>
|
||||
<TD vAlign="top" width="28%" bgColor="#c0c0c0">Attempts to find a POD type of size
|
||||
Size, and alignment Align.</TD>
|
||||
<TD vAlign="top" width="13%" bgColor="#c0c0c0"></TD>
|
||||
<TD width="25%" bgColor="#c0c0c0"></TD>
|
||||
<TD vAlign="top" width="5%"></TD>
|
||||
</TR>
|
||||
</table>
|
||||
<h2><a name="function_traits"></a>Function Traits</h2>
|
||||
<p>The <code>::boost::function_traits</code> class template extracts information
|
||||
|
43
test/extent_test.cpp
Executable file
43
test/extent_test.cpp
Executable file
@@ -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 <type_traits>
|
||||
#else
|
||||
# include <boost/type_traits/extent.hpp>
|
||||
#endif
|
||||
|
||||
TT_TEST_BEGIN(extent)
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::extent<int>::value, 0);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::extent<int[]>::value, 0);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::extent<int[][10]>::value, 0);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::extent<int[5][10]>::value, 5);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::extent<int[5][10][40]>::value, 5);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::extent<int (&)[5][10]>::value, 0);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::extent<int (*)[5][10]>::value, 0);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::extent<int,1>::value), 0);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::extent<int[],1>::value), 0);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::extent<int[][10],1>::value), 10);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::extent<int[5][10],1>::value), 10);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::extent<int[5][10][40],1>::value), 10);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::extent<int (&)[5][10],1>::value), 0);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::extent<int (*)[5][10],1>::value), 0);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::extent<int[5][10],2>::value), 0);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::extent<int[5][10][40],2>::value), 40);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::extent<int[5][10][40],3>::value), 0);
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
67
test/has_virtual_destructor_test.cpp
Executable file
67
test/has_virtual_destructor_test.cpp
Executable file
@@ -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 <type_traits>
|
||||
#else
|
||||
# include <boost/type_traits/has_virtual_destructor.hpp>
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
|
||||
TT_TEST_BEGIN(has_virtual_destructor)
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<int>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<const int>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<volatile int>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<int*>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<int* const>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<int[2]>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<int&>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<mf4>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<f1>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<enum_UDT>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<UDT>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<empty_UDT>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<UDT*>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<UDT[2]>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<UDT&>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<void>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<VB>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<VD>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<test_abc1>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<test_abc2>::value, false);
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::iostream>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::basic_streambuf<char> >::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::basic_ios<char> >::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::basic_istream<char> >::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::basic_streambuf<char> >::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<std::ios_base>::value, false);
|
||||
#endif
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::exception>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::bad_alloc>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::runtime_error>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::out_of_range>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::range_error>::value, false);
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
49
test/is_base_of_test.cpp
Executable file
49
test/is_base_of_test.cpp
Executable file
@@ -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 <type_traits>
|
||||
#else
|
||||
# include <boost/type_traits/is_base_of.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
TT_TEST_BEGIN(is_base_of)
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Derived,Base>::value), false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Derived,Derived>::value), false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Base,Base>::value), false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Base,Derived>::value), true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Base,MultiBase>::value), true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Derived,MultiBase>::value), true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Derived2,MultiBase>::value), true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Base,PrivateBase>::value), true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<NonDerived,Base>::value), false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Base,void>::value), false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Base,const void>::value), false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<void,Derived>::value), false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<const void,Derived>::value), false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<int, int>::value), false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<const int, int>::value), false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<VB,VD>::value), true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<VD,VB>::value), false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<test_abc1,test_abc3>::value), true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<test_abc3,test_abc1>::value), false);
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
64
test/is_floating_point_test.cpp
Executable file
64
test/is_floating_point_test.cpp
Executable file
@@ -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 <type_traits>
|
||||
#else
|
||||
# include <boost/type_traits/is_floating_point.hpp>
|
||||
#endif
|
||||
|
||||
TT_TEST_BEGIN(is_floating_point)
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<float>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<float const>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<float volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<float const volatile>::value, true);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<double>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<double const>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<double volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<double const volatile>::value, true);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<long double>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<long double const>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<long double volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<long double const volatile>::value, true);
|
||||
|
||||
//
|
||||
// cases that should not be true:
|
||||
//
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<void>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<int>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<UDT>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<test_abc1>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<empty_UDT>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<float*>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<float&>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<const float&>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<float[2]>::value, false);
|
||||
|
||||
//
|
||||
// tricky cases:
|
||||
//
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<test_abc1>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<foo0_t>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<foo1_t>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<foo2_t>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<foo3_t>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<foo4_t>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<incomplete_type>::value, false);
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
43
test/is_member_obj_test.cpp
Executable file
43
test/is_member_obj_test.cpp
Executable file
@@ -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 <type_traits>
|
||||
#else
|
||||
# include <boost/type_traits/is_member_object_pointer.hpp>
|
||||
#endif
|
||||
|
||||
typedef const double (UDT::*mp2) ;
|
||||
|
||||
TT_TEST_BEGIN(is_member_object_pointer)
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer<f1>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer<f2>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer<f3>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer<void*>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer<mf1>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer<mf2>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer<mf3>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer<mf4>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer<cmf>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer<mp>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer<mp2>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer<void>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer<test_abc1>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer<incomplete_type>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer<foo0_t>::value, false);
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
39
test/is_signed_test.cpp
Executable file
39
test/is_signed_test.cpp
Executable 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)
|
||||
|
||||
#include "test.hpp"
|
||||
#include "check_integral_constant.hpp"
|
||||
#ifdef TEST_STD
|
||||
# include <type_traits>
|
||||
#else
|
||||
# include <boost/type_traits/is_signed.hpp>
|
||||
#endif
|
||||
|
||||
TT_TEST_BEGIN(is_signed)
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<int>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<long>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<short>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<signed char>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<unsigned int>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<unsigned long>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<unsigned short>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<unsigned char>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<UDT>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<int&>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<int*>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<int[2]>::value, false);
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
39
test/is_unsigned_test.cpp
Executable file
39
test/is_unsigned_test.cpp
Executable 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)
|
||||
|
||||
#include "test.hpp"
|
||||
#include "check_integral_constant.hpp"
|
||||
#ifdef TEST_STD
|
||||
# include <type_traits>
|
||||
#else
|
||||
# include <boost/type_traits/is_unsigned.hpp>
|
||||
#endif
|
||||
|
||||
TT_TEST_BEGIN(is_signed)
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<int>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<long>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<short>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<signed char>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<unsigned int>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<unsigned long>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<unsigned short>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<unsigned char>::value, true);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<UDT>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<int&>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<int*>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<int[2]>::value, false);
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
33
test/rank_test.cpp
Executable file
33
test/rank_test.cpp
Executable file
@@ -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 <type_traits>
|
||||
#else
|
||||
# include <boost/type_traits/rank.hpp>
|
||||
#endif
|
||||
|
||||
TT_TEST_BEGIN(rank)
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::rank<int>::value, 0);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::rank<int[]>::value, 1);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::rank<int[][10]>::value, 2);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::rank<int[5][10]>::value, 2);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::rank<int[5][10][40]>::value, 3);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::rank<int (&)[5][10]>::value, 0);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::rank<int (*)[5][10]>::value, 0);
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
59
test/remove_all_extents_test.cpp
Executable file
59
test/remove_all_extents_test.cpp
Executable file
@@ -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 <type_traits>
|
||||
#else
|
||||
# include <boost/type_traits/remove_all_extents.hpp>
|
||||
#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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
59
test/remove_extent_test.cpp
Executable file
59
test/remove_extent_test.cpp
Executable file
@@ -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 <type_traits>
|
||||
#else
|
||||
# include <boost/type_traits/remove_extent.hpp>
|
||||
#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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -20,6 +20,7 @@ struct convertible_to_anything
|
||||
TT_TEST_BEGIN(is_enum)
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_enum<convertible_to_anything>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_enum<int[] >::value, false);
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
Reference in New Issue
Block a user