Add some more traits back.

This commit is contained in:
jzmaddock
2015-01-17 13:35:26 +00:00
parent 1b1f90fdea
commit 6aa0878fb3
13 changed files with 1411 additions and 0 deletions

View File

@@ -0,0 +1,146 @@
// (C) Copyright Runar Undheim, Robert Ramey & John Maddock 2008.
// 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_NEW_OPERATOR_HPP_INCLUDED
#define BOOST_TT_HAS_NEW_OPERATOR_HPP_INCLUDED
#include <new> // std::nothrow_t
#include <cstddef> // std::size_t
#include <boost/type_traits/integral_constant.hpp>
#include <boost/type_traits/detail/yes_no_type.hpp>
#if defined(new)
# if BOOST_WORKAROUND(BOOST_MSVC, >= 1310)
# define BOOST_TT_AUX_MACRO_NEW_DEFINED
# pragma push_macro("new")
# undef new
# else
# error "Sorry but you can't include this header if 'new' is defined as a macro."
# endif
#endif
namespace boost {
namespace detail {
template <class U, U x>
struct test;
template <typename T>
struct has_new_operator_impl {
template<class U>
static type_traits::yes_type check_sig1(
U*,
test<
void *(*)(std::size_t),
&U::operator new
>* = NULL
);
template<class U>
static type_traits::no_type check_sig1(...);
template<class U>
static type_traits::yes_type check_sig2(
U*,
test<
void *(*)(std::size_t, const std::nothrow_t&),
&U::operator new
>* = NULL
);
template<class U>
static type_traits::no_type check_sig2(...);
template<class U>
static type_traits::yes_type check_sig3(
U*,
test<
void *(*)(std::size_t, void*),
&U::operator new
>* = NULL
);
template<class U>
static type_traits::no_type check_sig3(...);
template<class U>
static type_traits::yes_type check_sig4(
U*,
test<
void *(*)(std::size_t),
&U::operator new[]
>* = NULL
);
template<class U>
static type_traits::no_type check_sig4(...);
template<class U>
static type_traits::yes_type check_sig5(
U*,
test<
void *(*)(std::size_t, const std::nothrow_t&),
&U::operator new[]
>* = NULL
);
template<class U>
static type_traits::no_type check_sig5(...);
template<class U>
static type_traits::yes_type check_sig6(
U*,
test<
void *(*)(std::size_t, void*),
&U::operator new[]
>* = NULL
);
template<class U>
static type_traits::no_type check_sig6(...);
// GCC2 won't even parse this template if we embed the computation
// of s1 in the computation of value.
#ifdef __GNUC__
BOOST_STATIC_CONSTANT(unsigned, s1 = sizeof(has_new_operator_impl<T>::template check_sig1<T>(0)));
BOOST_STATIC_CONSTANT(unsigned, s2 = sizeof(has_new_operator_impl<T>::template check_sig2<T>(0)));
BOOST_STATIC_CONSTANT(unsigned, s3 = sizeof(has_new_operator_impl<T>::template check_sig3<T>(0)));
BOOST_STATIC_CONSTANT(unsigned, s4 = sizeof(has_new_operator_impl<T>::template check_sig4<T>(0)));
BOOST_STATIC_CONSTANT(unsigned, s5 = sizeof(has_new_operator_impl<T>::template check_sig5<T>(0)));
BOOST_STATIC_CONSTANT(unsigned, s6 = sizeof(has_new_operator_impl<T>::template check_sig6<T>(0)));
#else
#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
#pragma warning(push)
#pragma warning(disable:6334)
#endif
BOOST_STATIC_CONSTANT(unsigned, s1 = sizeof(check_sig1<T>(0)));
BOOST_STATIC_CONSTANT(unsigned, s2 = sizeof(check_sig2<T>(0)));
BOOST_STATIC_CONSTANT(unsigned, s3 = sizeof(check_sig3<T>(0)));
BOOST_STATIC_CONSTANT(unsigned, s4 = sizeof(check_sig4<T>(0)));
BOOST_STATIC_CONSTANT(unsigned, s5 = sizeof(check_sig5<T>(0)));
BOOST_STATIC_CONSTANT(unsigned, s6 = sizeof(check_sig6<T>(0)));
#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
#pragma warning(pop)
#endif
#endif
BOOST_STATIC_CONSTANT(bool, value =
(s1 == sizeof(type_traits::yes_type)) ||
(s2 == sizeof(type_traits::yes_type)) ||
(s3 == sizeof(type_traits::yes_type)) ||
(s4 == sizeof(type_traits::yes_type)) ||
(s5 == sizeof(type_traits::yes_type)) ||
(s6 == sizeof(type_traits::yes_type))
);
};
} // namespace detail
template <class T> struct has_new_operator : public integral_constant<bool, ::boost::detail::has_new_operator_impl<T>::value>{};
} // namespace boost
#if defined(BOOST_TT_AUX_MACRO_NEW_DEFINED)
# pragma pop_macro("new")
#endif
#endif // BOOST_TT_HAS_NEW_OPERATOR_HPP_INCLUDED

View File

@@ -0,0 +1,46 @@
// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
// Use, modification and distribution are subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt).
//
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
#ifndef BOOST_TT_HAS_NOTHROW_CONSTRUCTOR_HPP_INCLUDED
#define BOOST_TT_HAS_NOTHROW_CONSTRUCTOR_HPP_INCLUDED
#include <boost/type_traits/intrinsics.hpp>
#include <boost/type_traits/integral_constant.hpp>
#ifdef BOOST_HAS_NOTHROW_CONSTRUCTOR
#if defined(BOOST_MSVC) || defined(BOOST_INTEL)
#include <boost/type_traits/has_trivial_constructor.hpp>
#endif
namespace boost {
template <class T> struct has_nothrow_constructor : public integral_constant<bool, BOOST_HAS_NOTHROW_CONSTRUCTOR(T)>{};
#else
#include <boost/type_traits/has_trivial_constructor.hpp>
namespace boost {
template <class T> struct has_nothrow_constructor : public ::boost::has_trivial_constructor<T> {};
#endif
template<> struct has_nothrow_constructor<void> : public false_type {};
#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
template<> struct has_nothrow_constructor<void const> : public false_type{};
template<> struct has_nothrow_constructor<void const volatile> : public false_type{};
template<> struct has_nothrow_constructor<void volatile> : public false_type{};
#endif
template <class T> struct has_nothrow_default_constructor : public has_nothrow_constructor<T>{};
} // namespace boost
#endif // BOOST_TT_HAS_NOTHROW_CONSTRUCTOR_HPP_INCLUDED

View File

@@ -0,0 +1,39 @@
// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
// Use, modification and distribution are subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt).
//
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
#ifndef BOOST_TT_HAS_TRIVIAL_CONSTRUCTOR_HPP_INCLUDED
#define BOOST_TT_HAS_TRIVIAL_CONSTRUCTOR_HPP_INCLUDED
#include <boost/type_traits/intrinsics.hpp>
#include <boost/type_traits/is_pod.hpp>
#ifdef BOOST_HAS_TRIVIAL_CONSTRUCTOR
#ifdef BOOST_HAS_SGI_TYPE_TRAITS
#include <boost/type_traits/is_same.hpp>
#elif defined(__GNUC__)
#include <boost/type_traits/is_volatile.hpp>
#ifdef BOOST_INTEL
#include <boost/type_traits/is_pod.hpp>
#endif
#endif
#endif
namespace boost {
template <typename T> struct has_trivial_constructor
#ifdef BOOST_HAS_TRIVIAL_CONSTRUCTOR
: public integral_constant <bool, (::boost::is_pod<T>::value || BOOST_HAS_TRIVIAL_CONSTRUCTOR(T))>{};
#else
: public integral_constant <bool, ::boost::is_pod<T>::value>{};
#endif
template <class T> struct has_trivial_default_constructor : public has_trivial_constructor<T> {};
} // namespace boost
#endif // BOOST_TT_HAS_TRIVIAL_CONSTRUCTOR_HPP_INCLUDED

View File

@@ -0,0 +1,26 @@
// (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
#include <boost/type_traits/intrinsics.hpp>
#include <boost/type_traits/integral_constant.hpp>
namespace boost {
#ifdef BOOST_HAS_VIRTUAL_DESTRUCTOR
template <class T> struct has_virtual_destructor : public integral_constant<bool, BOOST_HAS_VIRTUAL_DESTRUCTOR(T)>{};
#else
template <class T> struct has_virtual_destructor : public integral_constant<bool, false>{};
#endif
} // namespace boost
#endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED

View File

@@ -0,0 +1,131 @@
// (C) Copyright John Maddock 2007.
// 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_MAKE_SIGNED_HPP_INCLUDED
#define BOOST_TT_MAKE_SIGNED_HPP_INCLUDED
#include <boost/type_traits/conditional.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/type_traits/is_signed.hpp>
#include <boost/type_traits/is_unsigned.hpp>
#include <boost/type_traits/is_enum.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_cv.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/is_volatile.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_volatile.hpp>
#include <boost/static_assert.hpp>
namespace boost {
template <class T>
struct make_signed
{
private:
BOOST_STATIC_ASSERT_MSG(( ::boost::is_integral<T>::value || ::boost::is_enum<T>::value), "The template argument to make_signed must be an integer or enum type.");
BOOST_STATIC_ASSERT_MSG(!(::boost::is_same<typename remove_cv<T>::type, bool>::value), "The template argument to make_signed must not be the type bool.");
typedef typename remove_cv<T>::type t_no_cv;
typedef typename conditional<
(::boost::is_signed<T>::value
&& ::boost::is_integral<T>::value
&& ! ::boost::is_same<t_no_cv, char>::value
&& ! ::boost::is_same<t_no_cv, wchar_t>::value
&& ! ::boost::is_same<t_no_cv, bool>::value),
T,
typename conditional<
(::boost::is_integral<T>::value
&& ! ::boost::is_same<t_no_cv, char>::value
&& ! ::boost::is_same<t_no_cv, wchar_t>::value
&& ! ::boost::is_same<t_no_cv, bool>::value),
typename conditional<
is_same<t_no_cv, unsigned char>::value,
signed char,
typename conditional<
is_same<t_no_cv, unsigned short>::value,
signed short,
typename conditional<
is_same<t_no_cv, unsigned int>::value,
int,
typename conditional<
is_same<t_no_cv, unsigned long>::value,
long,
#if defined(BOOST_HAS_LONG_LONG)
#ifdef BOOST_HAS_INT128
typename conditional<
sizeof(t_no_cv) == sizeof(boost::long_long_type),
boost::long_long_type,
boost::int128_type
>::type
#else
boost::long_long_type
#endif
#elif defined(BOOST_HAS_MS_INT64)
__int64
#else
long
#endif
>::type
>::type
>::type
>::type,
// Not a regular integer type:
typename conditional<
sizeof(t_no_cv) == sizeof(unsigned char),
signed char,
typename conditional<
sizeof(t_no_cv) == sizeof(unsigned short),
signed short,
typename conditional<
sizeof(t_no_cv) == sizeof(unsigned int),
int,
typename conditional<
sizeof(t_no_cv) == sizeof(unsigned long),
long,
#if defined(BOOST_HAS_LONG_LONG)
#ifdef BOOST_HAS_INT128
typename conditional<
sizeof(t_no_cv) == sizeof(boost::long_long_type),
boost::long_long_type,
boost::int128_type
>::type
#else
boost::long_long_type
#endif
#elif defined(BOOST_HAS_MS_INT64)
__int64
#else
long
#endif
>::type
>::type
>::type
>::type
>::type
>::type base_integer_type;
// Add back any const qualifier:
typedef typename conditional<
is_const<T>::value,
typename add_const<base_integer_type>::type,
base_integer_type
>::type const_base_integer_type;
public:
// Add back any volatile qualifier:
typedef typename conditional<
is_volatile<T>::value,
typename add_volatile<const_base_integer_type>::type,
const_base_integer_type
>::type type;
};
} // namespace boost
#endif // BOOST_TT_ADD_REFERENCE_HPP_INCLUDED

View File

@@ -0,0 +1,130 @@
// (C) Copyright John Maddock 2007.
// 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_MAKE_UNSIGNED_HPP_INCLUDED
#define BOOST_TT_MAKE_UNSIGNED_HPP_INCLUDED
#include <boost/type_traits/conditional.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/type_traits/is_signed.hpp>
#include <boost/type_traits/is_unsigned.hpp>
#include <boost/type_traits/is_enum.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_cv.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/is_volatile.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_volatile.hpp>
#include <boost/static_assert.hpp>
namespace boost {
template <class T>
struct make_unsigned
{
private:
BOOST_STATIC_ASSERT_MSG((::boost::is_integral<T>::value || ::boost::is_enum<T>::value), "The template argument to make_unsigned must be an integer or enum type.");
BOOST_STATIC_ASSERT_MSG((! ::boost::is_same<typename remove_cv<T>::type, bool>::value), "The template argument to make_unsigned must not be the type bool");
typedef typename remove_cv<T>::type t_no_cv;
typedef typename conditional<
(::boost::is_unsigned<T>::value && ::boost::is_integral<T>::value
&& ! ::boost::is_same<t_no_cv, char>::value
&& ! ::boost::is_same<t_no_cv, wchar_t>::value
&& ! ::boost::is_same<t_no_cv, bool>::value),
T,
typename conditional<
(::boost::is_integral<T>::value
&& ! ::boost::is_same<t_no_cv, char>::value
&& ! ::boost::is_same<t_no_cv, wchar_t>::value
&& ! ::boost::is_same<t_no_cv, bool>::value),
typename conditional<
is_same<t_no_cv, signed char>::value,
unsigned char,
typename conditional<
is_same<t_no_cv, short>::value,
unsigned short,
typename conditional<
is_same<t_no_cv, int>::value,
unsigned int,
typename conditional<
is_same<t_no_cv, long>::value,
unsigned long,
#if defined(BOOST_HAS_LONG_LONG)
#ifdef BOOST_HAS_INT128
typename conditional<
sizeof(t_no_cv) == sizeof(boost::ulong_long_type),
boost::ulong_long_type,
boost::uint128_type
>::type
#else
boost::ulong_long_type
#endif
#elif defined(BOOST_HAS_MS_INT64)
unsigned __int64
#else
unsigned long
#endif
>::type
>::type
>::type
>::type,
// Not a regular integer type:
typename conditional<
sizeof(t_no_cv) == sizeof(unsigned char),
unsigned char,
typename conditional<
sizeof(t_no_cv) == sizeof(unsigned short),
unsigned short,
typename conditional<
sizeof(t_no_cv) == sizeof(unsigned int),
unsigned int,
typename conditional<
sizeof(t_no_cv) == sizeof(unsigned long),
unsigned long,
#if defined(BOOST_HAS_LONG_LONG)
#ifdef BOOST_HAS_INT128
typename conditional<
sizeof(t_no_cv) == sizeof(boost::ulong_long_type),
boost::ulong_long_type,
boost::uint128_type
>::type
#else
boost::ulong_long_type
#endif
#elif defined(BOOST_HAS_MS_INT64)
unsigned __int64
#else
unsigned long
#endif
>::type
>::type
>::type
>::type
>::type
>::type base_integer_type;
// Add back any const qualifier:
typedef typename conditional<
is_const<T>::value,
typename add_const<base_integer_type>::type,
base_integer_type
>::type const_base_integer_type;
public:
// Add back any volatile qualifier:
typedef typename conditional<
is_volatile<T>::value,
typename add_volatile<const_base_integer_type>::type,
const_base_integer_type
>::type type;
};
} // namespace boost
#endif // BOOST_TT_ADD_REFERENCE_HPP_INCLUDED

View File

@@ -0,0 +1,33 @@
// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
// Use, modification and distribution are subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt).
//
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
//
// defines object traits classes:
// is_object, is_scalar, is_class, is_compound, is_pod,
// has_trivial_constructor, has_trivial_copy, has_trivial_assign,
// has_trivial_destructor, is_empty.
//
#ifndef BOOST_TT_OBJECT_TRAITS_HPP_INLCUDED
#define BOOST_TT_OBJECT_TRAITS_HPP_INLCUDED
#include <boost/type_traits/has_trivial_assign.hpp>
#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_nothrow_constructor.hpp>
#include <boost/type_traits/has_nothrow_copy.hpp>
#include <boost/type_traits/has_nothrow_assign.hpp>
#include <boost/type_traits/is_base_and_derived.hpp>
#include <boost/type_traits/is_class.hpp>
#include <boost/type_traits/is_compound.hpp>
#include <boost/type_traits/is_empty.hpp>
#include <boost/type_traits/is_object.hpp>
#include <boost/type_traits/is_pod.hpp>
#include <boost/type_traits/is_scalar.hpp>
#include <boost/type_traits/is_stateless.hpp>
#endif // BOOST_TT_OBJECT_TRAITS_HPP_INLCUDED

View File

@@ -0,0 +1,169 @@
// (C) Copyright John Maddock 2000.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include "test.hpp"
#include "check_integral_constant.hpp"
#ifdef TEST_STD
# include <type_traits>
#else
# include <boost/type_traits/has_nothrow_constructor.hpp>
#endif
TT_TEST_BEGIN(has_nothrow_constructor)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<bool>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<bool const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<bool volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<bool const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<signed char>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<signed char const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<signed char volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<signed char const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned char>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<char>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned char const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<char const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned char volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<char volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned char const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<char const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned short>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<short>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned short const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<short const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned short volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<short volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned short const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<short const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned int>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<int>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned int const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<int const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned int volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<int volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned int const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<int const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned long>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<long>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned long const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<long const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned long volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<long volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned long const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<long const volatile>::value, true);
#ifdef BOOST_HAS_LONG_LONG
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor< ::boost::ulong_long_type>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor< ::boost::long_long_type>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor< ::boost::ulong_long_type const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor< ::boost::long_long_type const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor< ::boost::ulong_long_type volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor< ::boost::long_long_type volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor< ::boost::ulong_long_type const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor< ::boost::long_long_type const volatile>::value, true);
#endif
#ifdef BOOST_HAS_MS_INT64
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned __int8>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int8>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned __int8 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int8 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned __int8 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int8 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned __int8 const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int8 const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned __int16>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int16>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned __int16 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int16 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned __int16 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int16 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned __int16 const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int16 const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned __int32>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int32>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned __int32 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int32 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned __int32 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int32 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned __int32 const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int32 const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned __int64>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int64>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned __int64 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int64 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned __int64 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int64 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<unsigned __int64 const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int64 const volatile>::value, true);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<float>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<float const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<float volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<float const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<double>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<double const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<double volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<double const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<long double>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<long double const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<long double volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<long double const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<int>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<void*>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<int*const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<f1>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<f2>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<f3>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<mf1>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<mf2>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<mf3>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<mp>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<cmf>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<enum_UDT>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<int&>::value, false);
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<int&&>::value, false);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<const int&>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<int[2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<int[3][2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<int[2][4][5][6][3]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<empty_UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<void>::value, false);
// cases we would like to succeed but can't implement in the language:
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<empty_POD_UDT>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<POD_UDT>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<POD_union_UDT>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<empty_POD_union_UDT>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<nothrow_construct_UDT>::value, true, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<nothrow_assign_UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<nothrow_copy_UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<test_abc1>::value, false);
TT_TEST_END

View File

@@ -0,0 +1,213 @@
// (C) Copyright John Maddock 2000.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include "test.hpp"
#include "check_integral_constant.hpp"
#include <boost/type_traits/has_new_operator.hpp>
#ifdef BOOST_INTEL
// remark #1720: function "class_with_new_op::operator new" has no corresponding member operator delete (to be called if an exception is thrown during initialization of an allocated object)
// void * operator new(std::size_t);
// ^
#pragma warning(disable:1720)
#endif
#if defined(new)
# if BOOST_WORKAROUND(BOOST_MSVC, >= 1310)
# define BOOST_TT_AUX_MACRO_NEW_DEFINED
# pragma push_macro("new")
# undef new
# else
# error "Sorry but you can't include this header if 'new' is defined as a macro."
# endif
#endif
struct class_with_new_op {
void * operator new(std::size_t);
};
struct derived_class_with_new_op : public class_with_new_op {};
struct class_with_new_op2 {
void* operator new(std::size_t size, const std::nothrow_t&);
};
struct class_with_new_op3 {
void* operator new[](std::size_t size);
};
struct class_with_new_op4 {
void* operator new[](std::size_t size, const std::nothrow_t&);
};
struct class_with_new_op5 {
void* operator new (std::size_t size, void* ptr);
};
struct class_with_new_op6 {
void* operator new[] (std::size_t size, void* ptr);
};
struct class_with_all_ops
{
void * operator new(std::size_t);
void* operator new(std::size_t size, const std::nothrow_t&);
void* operator new[](std::size_t size);
void* operator new[](std::size_t size, const std::nothrow_t&);
void* operator new (std::size_t size, void* ptr);
void* operator new[] (std::size_t size, void* ptr);
};
TT_TEST_BEGIN(has_new_operator)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<class_with_new_op>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<derived_class_with_new_op>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<class_with_new_op2>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<class_with_new_op3>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<class_with_new_op4>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<class_with_new_op5>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<class_with_new_op6>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<class_with_all_ops>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<bool>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<bool const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<bool volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<bool const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<signed char>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<signed char const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<signed char volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<signed char const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned char>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<char>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned char const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<char const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned char volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<char volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned char const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<char const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned short>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<short>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned short const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<short const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned short volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<short volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned short const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<short const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned int>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<int>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned int const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<int const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned int volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<int volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned int const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<int const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned long>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<long>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned long const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<long const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned long volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<long volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned long const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<long const volatile>::value, false);
#ifdef BOOST_HAS_LONG_LONG
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator< ::boost::ulong_long_type>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator< ::boost::long_long_type>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator< ::boost::ulong_long_type const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator< ::boost::long_long_type const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator< ::boost::ulong_long_type volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator< ::boost::long_long_type volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator< ::boost::ulong_long_type const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator< ::boost::long_long_type const volatile>::value, false);
#endif
#ifdef BOOST_HAS_MS_INT64
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned __int8>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int8>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned __int8 const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int8 const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned __int8 volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int8 volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned __int8 const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int8 const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned __int16>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int16>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned __int16 const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int16 const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned __int16 volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int16 volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned __int16 const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int16 const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned __int32>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int32>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned __int32 const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int32 const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned __int32 volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int32 volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned __int32 const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int32 const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned __int64>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int64>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned __int64 const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int64 const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned __int64 volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int64 volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<unsigned __int64 const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int64 const volatile>::value, false);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<float>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<float const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<float volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<float const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<double>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<double const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<double volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<double const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<long double>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<long double const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<long double volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<long double const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<int>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<void*>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<int*const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<f1>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<f2>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<f3>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<mf1>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<mf2>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<mf3>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<mp>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<cmf>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<enum_UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<int&>::value, false);
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<int&&>::value, false);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<const int&>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<int[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<int[3][2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<int[2][4][5][6][3]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<empty_UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<void>::value, false);
TT_TEST_END

View File

@@ -0,0 +1,181 @@
// (C) Copyright John Maddock 2000.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include "test.hpp"
#include "check_integral_constant.hpp"
#ifdef TEST_STD
# include <type_traits>
#else
# include <boost/type_traits/has_trivial_constructor.hpp>
#endif
TT_TEST_BEGIN(has_trivial_constructor)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<bool>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<bool const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<bool volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<bool const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<signed char>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<signed char const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<signed char volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<signed char const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned char>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<char>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned char const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<char const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned char volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<char volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned char const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<char const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned short>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<short>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned short const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<short const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned short volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<short volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned short const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<short const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned int>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<int>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned int const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<int const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned int volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<int volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned int const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<int const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned long>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<long>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned long const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<long const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned long volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<long volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned long const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<long const volatile>::value, true);
#ifdef BOOST_HAS_LONG_LONG
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor< ::boost::ulong_long_type>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor< ::boost::long_long_type>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor< ::boost::ulong_long_type const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor< ::boost::long_long_type const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor< ::boost::ulong_long_type volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor< ::boost::long_long_type volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor< ::boost::ulong_long_type const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor< ::boost::long_long_type const volatile>::value, true);
#endif
#ifdef BOOST_HAS_MS_INT64
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned __int8>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int8>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned __int8 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int8 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned __int8 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int8 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned __int8 const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int8 const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned __int16>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int16>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned __int16 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int16 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned __int16 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int16 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned __int16 const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int16 const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned __int32>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int32>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned __int32 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int32 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned __int32 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int32 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned __int32 const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int32 const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned __int64>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int64>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned __int64 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int64 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned __int64 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int64 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<unsigned __int64 const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int64 const volatile>::value, true);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<float>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<float const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<float volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<float const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<double>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<double const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<double volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<double const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<long double>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<long double const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<long double volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<long double const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<int>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<void*>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<int*const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<f1>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<f2>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<f3>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<mf1>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<mf2>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<mf3>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<mp>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<cmf>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<enum_UDT>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<int&>::value, false);
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<int&&>::value, false);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<const int&>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<int[2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<int[3][2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<int[2][4][5][6][3]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<empty_UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<void>::value, true);
// cases we would like to succeed but can't implement in the language:
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<empty_POD_UDT>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<POD_UDT>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<POD_union_UDT>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<empty_POD_union_UDT>::value, true, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<trivial_except_construct>::value, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<trivial_except_destroy>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<trivial_except_assign>::value, true, false);
//BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<trivial_except_copy>::value, true, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<wrap<trivial_except_construct> >::value, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<wrap<trivial_except_destroy> >::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<wrap<trivial_except_assign> >::value, true, false);
//BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<wrap<trivial_except_copy> >::value, true, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<test_abc1>::value, false);
TT_TEST_END

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)
#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>
#include <new>
class polymorphic_no_virtual_destructor
{
public:
virtual void method() = 0;
};
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);
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<UDT&&>::value, false);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<void>::value, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<VB>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<VD>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<test_abc1>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<test_abc2>::value, true, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<polymorphic_no_virtual_destructor>::value, false);
#ifndef BOOST_NO_STD_LOCALE
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::iostream>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::basic_streambuf<char> >::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::basic_ios<char> >::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::basic_istream<char> >::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::basic_streambuf<char> >::value, true, false);
#endif
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::exception>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::bad_alloc>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::runtime_error>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::out_of_range>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::range_error>::value, true, false);
TT_TEST_END

111
test/make_signed_test.cpp Normal file
View File

@@ -0,0 +1,111 @@
// (C) Copyright John Maddock 2007.
// 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.tt.org/LICENSE_1_0.txt)
#include "test.hpp"
#include "check_type.hpp"
#include "check_integral_constant.hpp"
#ifdef TEST_STD
# include <type_traits>
#else
# include <boost/type_traits/make_signed.hpp>
#endif
TT_TEST_BEGIN(make_signed)
// signed types:
BOOST_CHECK_TYPE(::tt::make_signed<signed char>::type, signed char);
BOOST_CHECK_TYPE(::tt::make_signed<short>::type, short);
BOOST_CHECK_TYPE(::tt::make_signed<int>::type, int);
BOOST_CHECK_TYPE(::tt::make_signed<long>::type, long);
#ifdef BOOST_HAS_LONG_LONG
BOOST_CHECK_TYPE(::tt::make_signed<boost::long_long_type>::type, boost::long_long_type);
#elif defined(BOOST_HAS_MS_INT64)
BOOST_CHECK_TYPE(::tt::make_signed<__int64>::type, __int64);
#endif
// const signed types:
BOOST_CHECK_TYPE(::tt::make_signed<const signed char>::type, const signed char);
BOOST_CHECK_TYPE(::tt::make_signed<const short>::type, const short);
BOOST_CHECK_TYPE(::tt::make_signed<const int>::type, const int);
BOOST_CHECK_TYPE(::tt::make_signed<const long>::type, const long);
#ifdef BOOST_HAS_LONG_LONG
BOOST_CHECK_TYPE(::tt::make_signed<const boost::long_long_type>::type, const boost::long_long_type);
#elif defined(BOOST_HAS_MS_INT64)
BOOST_CHECK_TYPE(::tt::make_signed<const __int64>::type, const __int64);
#endif
// volatile signed types:
BOOST_CHECK_TYPE(::tt::make_signed<volatile signed char>::type, volatile signed char);
BOOST_CHECK_TYPE(::tt::make_signed<volatile short>::type, volatile short);
BOOST_CHECK_TYPE(::tt::make_signed<volatile int>::type, volatile int);
BOOST_CHECK_TYPE(::tt::make_signed<volatile long>::type, volatile long);
#ifdef BOOST_HAS_LONG_LONG
BOOST_CHECK_TYPE(::tt::make_signed<volatile boost::long_long_type>::type, volatile boost::long_long_type);
#elif defined(BOOST_HAS_MS_INT64)
BOOST_CHECK_TYPE(::tt::make_signed<volatile __int64>::type, volatile __int64);
#endif
// const volatile signed types:
BOOST_CHECK_TYPE(::tt::make_signed<const volatile signed char>::type, const volatile signed char);
BOOST_CHECK_TYPE(::tt::make_signed<const volatile short>::type, const volatile short);
BOOST_CHECK_TYPE(::tt::make_signed<const volatile int>::type, const volatile int);
BOOST_CHECK_TYPE(::tt::make_signed<const volatile long>::type, const volatile long);
#ifdef BOOST_HAS_LONG_LONG
BOOST_CHECK_TYPE(::tt::make_signed<const volatile boost::long_long_type>::type, const volatile boost::long_long_type);
#elif defined(BOOST_HAS_MS_INT64)
BOOST_CHECK_TYPE(::tt::make_signed<const volatile __int64>::type, const volatile __int64);
#endif
// unsigned types:
BOOST_CHECK_TYPE(::tt::make_signed<unsigned char>::type, signed char);
BOOST_CHECK_TYPE(::tt::make_signed<unsigned short>::type, short);
BOOST_CHECK_TYPE(::tt::make_signed<unsigned int>::type, int);
BOOST_CHECK_TYPE(::tt::make_signed<unsigned long>::type, long);
#ifdef BOOST_HAS_LONG_LONG
BOOST_CHECK_TYPE(::tt::make_signed<boost::ulong_long_type>::type, boost::long_long_type);
#elif defined(BOOST_HAS_MS_INT64)
BOOST_CHECK_TYPE(::tt::make_signed<unsigned __int64>::type, __int64);
#endif
// const unsigned types:
BOOST_CHECK_TYPE(::tt::make_signed<const unsigned char>::type, const signed char);
BOOST_CHECK_TYPE(::tt::make_signed<const unsigned short>::type, const short);
BOOST_CHECK_TYPE(::tt::make_signed<const unsigned int>::type, const int);
BOOST_CHECK_TYPE(::tt::make_signed<const unsigned long>::type, const long);
#ifdef BOOST_HAS_LONG_LONG
BOOST_CHECK_TYPE(::tt::make_signed<const boost::ulong_long_type>::type, const boost::long_long_type);
#elif defined(BOOST_HAS_MS_INT64)
BOOST_CHECK_TYPE(::tt::make_signed<const unsigned __int64>::type, const __int64);
#endif
// volatile unsigned types:
BOOST_CHECK_TYPE(::tt::make_signed<volatile unsigned char>::type, volatile signed char);
BOOST_CHECK_TYPE(::tt::make_signed<volatile unsigned short>::type, volatile short);
BOOST_CHECK_TYPE(::tt::make_signed<volatile unsigned int>::type, volatile int);
BOOST_CHECK_TYPE(::tt::make_signed<volatile unsigned long>::type, volatile long);
#ifdef BOOST_HAS_LONG_LONG
BOOST_CHECK_TYPE(::tt::make_signed<volatile boost::ulong_long_type>::type, volatile boost::long_long_type);
#elif defined(BOOST_HAS_MS_INT64)
BOOST_CHECK_TYPE(::tt::make_signed<volatile unsigned __int64>::type, volatile __int64);
#endif
// const volatile unsigned types:
BOOST_CHECK_TYPE(::tt::make_signed<const volatile unsigned char>::type, const volatile signed char);
BOOST_CHECK_TYPE(::tt::make_signed<const volatile unsigned short>::type, const volatile short);
BOOST_CHECK_TYPE(::tt::make_signed<const volatile unsigned int>::type, const volatile int);
BOOST_CHECK_TYPE(::tt::make_signed<const volatile unsigned long>::type, const volatile long);
#ifdef BOOST_HAS_LONG_LONG
BOOST_CHECK_TYPE(::tt::make_signed<const volatile boost::ulong_long_type>::type, const volatile boost::long_long_type);
#elif defined(BOOST_HAS_MS_INT64)
BOOST_CHECK_TYPE(::tt::make_signed<const volatile unsigned __int64>::type, const volatile __int64);
#endif
#ifdef BOOST_HAS_INT128
BOOST_CHECK_TYPE(::tt::make_signed<boost::int128_type>::type, boost::int128_type);
BOOST_CHECK_TYPE(::tt::make_signed<boost::uint128_type>::type, boost::int128_type);
#endif
// character types:
BOOST_CHECK_TYPE(::tt::make_signed<char>::type, signed char);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_integral< ::tt::make_signed<wchar_t>::type>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed< ::tt::make_signed<wchar_t>::type>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_integral< ::tt::make_signed<enum_UDT>::type>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed< ::tt::make_signed<enum_UDT>::type>::value, true);
TT_TEST_END

111
test/make_unsigned_test.cpp Normal file
View File

@@ -0,0 +1,111 @@
// (C) Copyright John Maddock 2007.
// 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.tt.org/LICENSE_1_0.txt)
#include "test.hpp"
#include "check_type.hpp"
#include "check_integral_constant.hpp"
#ifdef TEST_STD
# include <type_traits>
#else
# include <boost/type_traits/make_unsigned.hpp>
#endif
TT_TEST_BEGIN(make_unsigned)
// signed types:
BOOST_CHECK_TYPE(::tt::make_unsigned<signed char>::type, unsigned char);
BOOST_CHECK_TYPE(::tt::make_unsigned<short>::type, unsigned short);
BOOST_CHECK_TYPE(::tt::make_unsigned<int>::type, unsigned int);
BOOST_CHECK_TYPE(::tt::make_unsigned<long>::type, unsigned long);
#ifdef BOOST_HAS_LONG_LONG
BOOST_CHECK_TYPE(::tt::make_unsigned<boost::long_long_type>::type, boost::ulong_long_type);
#elif defined(BOOST_HAS_MS_INT64)
BOOST_CHECK_TYPE(::tt::make_unsigned<__int64>::type, unsigned __int64);
#endif
// const signed types:
BOOST_CHECK_TYPE(::tt::make_unsigned<const signed char>::type, const unsigned char);
BOOST_CHECK_TYPE(::tt::make_unsigned<const short>::type, const unsigned short);
BOOST_CHECK_TYPE(::tt::make_unsigned<const int>::type, const unsigned int);
BOOST_CHECK_TYPE(::tt::make_unsigned<const long>::type, const unsigned long);
#ifdef BOOST_HAS_LONG_LONG
BOOST_CHECK_TYPE(::tt::make_unsigned<const boost::long_long_type>::type, const boost::ulong_long_type);
#elif defined(BOOST_HAS_MS_INT64)
BOOST_CHECK_TYPE(::tt::make_unsigned<const __int64>::type, const unsigned __int64);
#endif
// volatile signed types:
BOOST_CHECK_TYPE(::tt::make_unsigned<volatile signed char>::type, volatile unsigned char);
BOOST_CHECK_TYPE(::tt::make_unsigned<volatile short>::type, volatile unsigned short);
BOOST_CHECK_TYPE(::tt::make_unsigned<volatile int>::type, volatile unsigned int);
BOOST_CHECK_TYPE(::tt::make_unsigned<volatile long>::type, volatile unsigned long);
#ifdef BOOST_HAS_LONG_LONG
BOOST_CHECK_TYPE(::tt::make_unsigned<volatile boost::long_long_type>::type, volatile boost::ulong_long_type);
#elif defined(BOOST_HAS_MS_INT64)
BOOST_CHECK_TYPE(::tt::make_unsigned<volatile __int64>::type, volatile unsigned __int64);
#endif
// const volatile signed types:
BOOST_CHECK_TYPE(::tt::make_unsigned<const volatile signed char>::type, const volatile unsigned char);
BOOST_CHECK_TYPE(::tt::make_unsigned<const volatile short>::type, const volatile unsigned short);
BOOST_CHECK_TYPE(::tt::make_unsigned<const volatile int>::type, const volatile unsigned int);
BOOST_CHECK_TYPE(::tt::make_unsigned<const volatile long>::type, const volatile unsigned long);
#ifdef BOOST_HAS_LONG_LONG
BOOST_CHECK_TYPE(::tt::make_unsigned<const volatile boost::long_long_type>::type, const volatile boost::ulong_long_type);
#elif defined(BOOST_HAS_MS_INT64)
BOOST_CHECK_TYPE(::tt::make_unsigned<const volatile __int64>::type, const volatile unsigned __int64);
#endif
// unsigned types:
BOOST_CHECK_TYPE(::tt::make_unsigned<unsigned char>::type, unsigned char);
BOOST_CHECK_TYPE(::tt::make_unsigned<unsigned short>::type, unsigned short);
BOOST_CHECK_TYPE(::tt::make_unsigned<unsigned int>::type, unsigned int);
BOOST_CHECK_TYPE(::tt::make_unsigned<unsigned long>::type, unsigned long);
#ifdef BOOST_HAS_LONG_LONG
BOOST_CHECK_TYPE(::tt::make_unsigned<boost::ulong_long_type>::type, boost::ulong_long_type);
#elif defined(BOOST_HAS_MS_INT64)
BOOST_CHECK_TYPE(::tt::make_unsigned<unsigned __int64>::type, unsigned __int64);
#endif
// const unsigned types:
BOOST_CHECK_TYPE(::tt::make_unsigned<const unsigned char>::type, const unsigned char);
BOOST_CHECK_TYPE(::tt::make_unsigned<const unsigned short>::type, const unsigned short);
BOOST_CHECK_TYPE(::tt::make_unsigned<const unsigned int>::type, const unsigned int);
BOOST_CHECK_TYPE(::tt::make_unsigned<const unsigned long>::type, const unsigned long);
#ifdef BOOST_HAS_LONG_LONG
BOOST_CHECK_TYPE(::tt::make_unsigned<const boost::ulong_long_type>::type, const boost::ulong_long_type);
#elif defined(BOOST_HAS_MS_INT64)
BOOST_CHECK_TYPE(::tt::make_unsigned<const unsigned __int64>::type, const unsigned __int64);
#endif
// volatile unsigned types:
BOOST_CHECK_TYPE(::tt::make_unsigned<volatile unsigned char>::type, volatile unsigned char);
BOOST_CHECK_TYPE(::tt::make_unsigned<volatile unsigned short>::type, volatile unsigned short);
BOOST_CHECK_TYPE(::tt::make_unsigned<volatile unsigned int>::type, volatile unsigned int);
BOOST_CHECK_TYPE(::tt::make_unsigned<volatile unsigned long>::type, volatile unsigned long);
#ifdef BOOST_HAS_LONG_LONG
BOOST_CHECK_TYPE(::tt::make_unsigned<volatile boost::ulong_long_type>::type, volatile boost::ulong_long_type);
#elif defined(BOOST_HAS_MS_INT64)
BOOST_CHECK_TYPE(::tt::make_unsigned<volatile unsigned __int64>::type, volatile unsigned __int64);
#endif
// const volatile unsigned types:
BOOST_CHECK_TYPE(::tt::make_unsigned<const volatile unsigned char>::type, const volatile unsigned char);
BOOST_CHECK_TYPE(::tt::make_unsigned<const volatile unsigned short>::type, const volatile unsigned short);
BOOST_CHECK_TYPE(::tt::make_unsigned<const volatile unsigned int>::type, const volatile unsigned int);
BOOST_CHECK_TYPE(::tt::make_unsigned<const volatile unsigned long>::type, const volatile unsigned long);
#ifdef BOOST_HAS_LONG_LONG
BOOST_CHECK_TYPE(::tt::make_unsigned<const volatile boost::ulong_long_type>::type, const volatile boost::ulong_long_type);
#elif defined(BOOST_HAS_MS_INT64)
BOOST_CHECK_TYPE(::tt::make_unsigned<const volatile unsigned __int64>::type, const volatile unsigned __int64);
#endif
#ifdef BOOST_HAS_INT128
BOOST_CHECK_TYPE(::tt::make_unsigned<boost::int128_type>::type, boost::uint128_type);
BOOST_CHECK_TYPE(::tt::make_unsigned<boost::uint128_type>::type, boost::uint128_type);
#endif
// character types:
BOOST_CHECK_TYPE(::tt::make_unsigned<char>::type, unsigned char);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_integral< ::tt::make_unsigned<wchar_t>::type>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned< ::tt::make_unsigned<wchar_t>::type>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_integral< ::tt::make_unsigned<enum_UDT>::type>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned< ::tt::make_unsigned<enum_UDT>::type>::value, true);
TT_TEST_END