forked from boostorg/type_traits
Convert some more traits.
This commit is contained in:
1 parent
3cf613228d
commit
8dc33362b9
18 files changed
+1103
No files matched your search
@@ -0,0 +1,61 @@
|
||||
|
||||
// (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.tt.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "test.hpp"
|
||||
#include "check_type.hpp"
|
||||
#ifdef TEST_STD
|
||||
# include <type_traits>
|
||||
#else
|
||||
# include <boost/type_traits/add_cv.hpp>
|
||||
#endif
|
||||
|
||||
BOOST_DECL_TRANSFORM_TEST(add_cv_test_1, ::tt::add_cv, const, const volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_cv_test_2, ::tt::add_cv, volatile, volatile const)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_cv_test_3, ::tt::add_cv, *, *const volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST2(add_cv_test_4, ::tt::add_cv, const volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_cv_test_7, ::tt::add_cv, *volatile, *volatile const)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_cv_test_10, ::tt::add_cv, const*, const*const volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_cv_test_11, ::tt::add_cv, volatile*, volatile*const volatile )
|
||||
BOOST_DECL_TRANSFORM_TEST(add_cv_test_5, ::tt::add_cv, const &, const&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_cv_test_6, ::tt::add_cv, &, &)
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
BOOST_DECL_TRANSFORM_TEST(add_cv_test_5a, ::tt::add_cv, const &&, const&&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_cv_test_6a, ::tt::add_cv, &&, &&)
|
||||
#endif
|
||||
BOOST_DECL_TRANSFORM_TEST(add_cv_test_8, ::tt::add_cv, const [2], const volatile [2])
|
||||
BOOST_DECL_TRANSFORM_TEST(add_cv_test_9, ::tt::add_cv, volatile &, volatile&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_cv_test_12, ::tt::add_cv, [2][3], const volatile[2][3])
|
||||
BOOST_DECL_TRANSFORM_TEST(add_cv_test_13, ::tt::add_cv, (&)[2], (&)[2])
|
||||
|
||||
TT_TEST_BEGIN(add_const)
|
||||
|
||||
add_cv_test_1();
|
||||
add_cv_test_2();
|
||||
add_cv_test_3();
|
||||
add_cv_test_4();
|
||||
add_cv_test_7();
|
||||
add_cv_test_10();
|
||||
add_cv_test_11();
|
||||
add_cv_test_5();
|
||||
add_cv_test_6();
|
||||
add_cv_test_8();
|
||||
add_cv_test_9();
|
||||
add_cv_test_12();
|
||||
add_cv_test_13();
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
add_cv_test_5a();
|
||||
add_cv_test_6a();
|
||||
#endif
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
|
||||
// (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.tt.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "test.hpp"
|
||||
#include "check_type.hpp"
|
||||
#ifdef TEST_STD
|
||||
# include <type_traits>
|
||||
#else
|
||||
# include <boost/type_traits/add_pointer.hpp>
|
||||
#endif
|
||||
|
||||
BOOST_DECL_TRANSFORM_TEST(add_pointer_test_1, ::tt::add_pointer, const, const*)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_pointer_test_2, ::tt::add_pointer, volatile, volatile*)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_pointer_test_3, ::tt::add_pointer, *, **)
|
||||
BOOST_DECL_TRANSFORM_TEST2(add_pointer_test_4, ::tt::add_pointer, *)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_pointer_test_7, ::tt::add_pointer, *volatile, *volatile*)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_pointer_test_10, ::tt::add_pointer, const*, const**)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_pointer_test_11, ::tt::add_pointer, volatile*, volatile**)
|
||||
|
||||
TT_TEST_BEGIN(add_pointer)
|
||||
|
||||
add_pointer_test_1();
|
||||
add_pointer_test_2();
|
||||
add_pointer_test_3();
|
||||
add_pointer_test_4();
|
||||
add_pointer_test_7();
|
||||
add_pointer_test_10();
|
||||
add_pointer_test_11();
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
|
||||
// (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.tt.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "test.hpp"
|
||||
#include "check_type.hpp"
|
||||
#ifdef TEST_STD
|
||||
# include <type_traits>
|
||||
#else
|
||||
# include <boost/type_traits/add_volatile.hpp>
|
||||
#endif
|
||||
|
||||
BOOST_DECL_TRANSFORM_TEST(add_volatile_test_1, ::tt::add_volatile, const, const volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_volatile_test_2, ::tt::add_volatile, volatile, volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_volatile_test_3, ::tt::add_volatile, *, *volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST2(add_volatile_test_4, ::tt::add_volatile, volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_volatile_test_7, ::tt::add_volatile, *volatile, *volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_volatile_test_10, ::tt::add_volatile, const*, const*volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_volatile_test_11, ::tt::add_volatile, volatile*, volatile*volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_volatile_test_5, ::tt::add_volatile, const &, const&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_volatile_test_6, ::tt::add_volatile, &, &)
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
BOOST_DECL_TRANSFORM_TEST(add_volatile_test_6a, ::tt::add_volatile, &&, &&)
|
||||
#endif
|
||||
BOOST_DECL_TRANSFORM_TEST(add_volatile_test_8, ::tt::add_volatile, const [2], const volatile [2])
|
||||
BOOST_DECL_TRANSFORM_TEST(add_volatile_test_9, ::tt::add_volatile, volatile &, volatile&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_volatile_test_12, ::tt::add_volatile, [2][3], volatile[2][3])
|
||||
BOOST_DECL_TRANSFORM_TEST(add_volatile_test_13, ::tt::add_volatile, (&)[2], (&)[2])
|
||||
|
||||
TT_TEST_BEGIN(add_volatile)
|
||||
|
||||
add_volatile_test_1();
|
||||
add_volatile_test_2();
|
||||
add_volatile_test_3();
|
||||
add_volatile_test_4();
|
||||
add_volatile_test_7();
|
||||
add_volatile_test_10();
|
||||
add_volatile_test_11();
|
||||
add_volatile_test_5();
|
||||
add_volatile_test_6();
|
||||
add_volatile_test_8();
|
||||
add_volatile_test_9();
|
||||
add_volatile_test_12();
|
||||
add_volatile_test_13();
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
add_volatile_test_6a();
|
||||
#endif
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack(2)
|
||||
#endif
|
||||
|
||||
// (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/alignment_of.hpp>
|
||||
#endif
|
||||
|
||||
//
|
||||
// Need to defined some member functions for empty_UDT,
|
||||
// we don't want to put these in the test.hpp as that
|
||||
// causes overly-clever compilers to figure out that they can't throw
|
||||
// which in turn breaks other tests.
|
||||
//
|
||||
empty_UDT::empty_UDT(){}
|
||||
empty_UDT::~empty_UDT(){}
|
||||
empty_UDT::empty_UDT(const empty_UDT&){}
|
||||
empty_UDT& empty_UDT::operator=(const empty_UDT&){ return *this; }
|
||||
bool empty_UDT::operator==(const empty_UDT&)const{ return true; }
|
||||
|
||||
|
||||
//
|
||||
// VC++ emits an awful lot of warnings unless we define these:
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(disable:4244 4121)
|
||||
//
|
||||
// What follows here is the test case for issue 1946.
|
||||
//
|
||||
#include <boost/function.hpp>
|
||||
// This kind of packing is set within MSVC 9.0 headers.
|
||||
// E.g. std::ostream has it.
|
||||
#pragma pack(push,8)
|
||||
|
||||
// The issue is gone if Root has no data members
|
||||
struct Root { int a; };
|
||||
// The issue is gone if Root is inherited non-virtually
|
||||
struct A : virtual public Root {};
|
||||
|
||||
#pragma pack(pop)
|
||||
//
|
||||
// This class has 8-byte alignment but is 44 bytes in size, which means
|
||||
// that elements in an array of this type will not actually be 8 byte
|
||||
// aligned. This appears to be an MSVC bug, and throws off our
|
||||
// alignment calculations: causing us to report a non-sensical 12-byte
|
||||
// alignment for this type. This is fixed by using the native __alignof
|
||||
// operator.
|
||||
//
|
||||
class issue1946 :
|
||||
public A
|
||||
{
|
||||
public:
|
||||
// The issue is gone if the type is not a boost::function. The signature doesn't matter.
|
||||
typedef boost::function0< void > function_type;
|
||||
function_type m_function;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
template <class T>
|
||||
struct align_calc
|
||||
{
|
||||
char padding;
|
||||
T instance;
|
||||
static std::ptrdiff_t get()
|
||||
{
|
||||
static align_calc<T> a;
|
||||
return reinterpret_cast<const char*>(&(a.instance)) - reinterpret_cast<const char*>(&(a.padding));
|
||||
}
|
||||
};
|
||||
|
||||
#define ALIGNOF(x) align_calc< x>::get()
|
||||
|
||||
TT_TEST_BEGIN(alignment_of)
|
||||
|
||||
#ifndef TEST_STD
|
||||
// This test is not required to work for non-boost implementations:
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<void>::value, 0);
|
||||
#endif
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<char>::value, ALIGNOF(char));
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<short>::value, ALIGNOF(short));
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<int>::value, ALIGNOF(int));
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<long>::value, ALIGNOF(long));
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<float>::value, ALIGNOF(float));
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<double>::value, ALIGNOF(double));
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<long double>::value, ALIGNOF(long double));
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of< ::boost::long_long_type>::value, ALIGNOF(::boost::long_long_type));
|
||||
#endif
|
||||
#ifdef BOOST_HAS_MS_INT64
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<__int64>::value, ALIGNOF(__int64));
|
||||
#endif
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<int[4]>::value, ALIGNOF(int[4]));
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<int(*)(int)>::value, ALIGNOF(int(*)(int)));
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<int*>::value, ALIGNOF(int*));
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<VB>::value, ALIGNOF(VB));
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<VD>::value, ALIGNOF(VD));
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<enum_UDT>::value, ALIGNOF(enum_UDT));
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<mf2>::value, ALIGNOF(mf2));
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<POD_UDT>::value, ALIGNOF(POD_UDT));
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<empty_UDT>::value, ALIGNOF(empty_UDT));
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<union_UDT>::value, ALIGNOF(union_UDT));
|
||||
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC >= 1400)
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<issue1946>::value, ALIGNOF(issue1946));
|
||||
#endif
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
|
||||
// (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/alignment_of.hpp>
|
||||
#endif
|
||||
|
||||
//
|
||||
// Need to defined some member function for empty_UDT,
|
||||
// we don't want to put these in the test.hpp as that
|
||||
// causes overly-clever compilers to figure out that they can't throw
|
||||
// which in turn breaks other tests.
|
||||
//
|
||||
empty_UDT::empty_UDT(){}
|
||||
empty_UDT::~empty_UDT(){}
|
||||
empty_UDT::empty_UDT(const empty_UDT&){}
|
||||
empty_UDT& empty_UDT::operator=(const empty_UDT&){ return *this; }
|
||||
bool empty_UDT::operator==(const empty_UDT&)const{ return true; }
|
||||
|
||||
//
|
||||
// VC++ emits an awful lot of warnings unless we define these:
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(disable:4244)
|
||||
//
|
||||
// What follows here is the test case for issue 1946.
|
||||
//
|
||||
#include <boost/function.hpp>
|
||||
// This kind of packing is set within MSVC 9.0 headers.
|
||||
// E.g. std::ostream has it.
|
||||
#pragma pack(push,8)
|
||||
|
||||
// The issue is gone if Root has no data members
|
||||
struct Root { int a; };
|
||||
// The issue is gone if Root is inherited non-virtually
|
||||
struct A : virtual public Root {};
|
||||
|
||||
#pragma pack(pop)
|
||||
//
|
||||
// This class has 8-byte alignment but is 44 bytes in size, which means
|
||||
// that elements in an array of this type will not actually be 8 byte
|
||||
// aligned. This appears to be an MSVC bug, and throws off our
|
||||
// alignment calculations: causing us to report a non-sensical 12-byte
|
||||
// alignment for this type. This is fixed by using the native __alignof
|
||||
// operator.
|
||||
//
|
||||
class issue1946 :
|
||||
public A
|
||||
{
|
||||
public:
|
||||
// The issue is gone if the type is not a boost::function. The signature doesn't matter.
|
||||
typedef boost::function0< void > function_type;
|
||||
function_type m_function;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
template <class T>
|
||||
struct align_calc
|
||||
{
|
||||
char padding;
|
||||
T instance;
|
||||
static std::ptrdiff_t get()
|
||||
{
|
||||
static align_calc<T> a;
|
||||
return reinterpret_cast<const char*>(&(a.instance)) - reinterpret_cast<const char*>(&(a.padding));
|
||||
}
|
||||
};
|
||||
|
||||
#define ALIGNOF(x) align_calc< x>::get()
|
||||
|
||||
TT_TEST_BEGIN(alignment_of)
|
||||
|
||||
#ifndef TEST_STD
|
||||
// This test is not required to work for non-boost implementations:
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<void>::value, 0);
|
||||
#endif
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<char>::value, ALIGNOF(char));
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<short>::value, ALIGNOF(short));
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<int>::value, ALIGNOF(int));
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<long>::value, ALIGNOF(long));
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<float>::value, ALIGNOF(float));
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<double>::value, ALIGNOF(double));
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<long double>::value, ALIGNOF(long double));
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of< ::boost::long_long_type>::value, ALIGNOF(::boost::long_long_type));
|
||||
#endif
|
||||
#ifdef BOOST_HAS_MS_INT64
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<__int64>::value, ALIGNOF(__int64));
|
||||
#endif
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<int[4]>::value, ALIGNOF(int[4]));
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<int(*)(int)>::value, ALIGNOF(int(*)(int)));
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<int*>::value, ALIGNOF(int*));
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<VB>::value, ALIGNOF(VB));
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<VD>::value, ALIGNOF(VD));
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<enum_UDT>::value, ALIGNOF(enum_UDT));
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<mf2>::value, ALIGNOF(mf2));
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<POD_UDT>::value, ALIGNOF(POD_UDT));
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<empty_UDT>::value, ALIGNOF(empty_UDT));
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<union_UDT>::value, ALIGNOF(union_UDT));
|
||||
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC >= 1400)
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of<issue1946>::value, ALIGNOF(issue1946));
|
||||
#endif
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
|
||||
// (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_destructor.hpp>
|
||||
#endif
|
||||
|
||||
TT_TEST_BEGIN(has_trivial_destructor)
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<bool>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<bool const>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<bool volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<bool const volatile>::value, true);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<signed char>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<signed char const>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<signed char volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<signed char const volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned char>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<char>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned char const>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<char const>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned char volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<char volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned char const volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<char const volatile>::value, true);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned short>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<short>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned short const>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<short const>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned short volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<short volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned short const volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<short const volatile>::value, true);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned int>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<int>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned int const>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<int const>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned int volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<int volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned int const volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<int const volatile>::value, true);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned long>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<long>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned long const>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<long const>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned long volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<long volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned long const volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<long const volatile>::value, true);
|
||||
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor< ::boost::ulong_long_type>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor< ::boost::long_long_type>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor< ::boost::ulong_long_type const>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor< ::boost::long_long_type const>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor< ::boost::ulong_long_type volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor< ::boost::long_long_type volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor< ::boost::ulong_long_type const volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor< ::boost::long_long_type const volatile>::value, true);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_HAS_MS_INT64
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned __int8>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int8>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned __int8 const>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int8 const>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned __int8 volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int8 volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned __int8 const volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int8 const volatile>::value, true);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned __int16>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int16>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned __int16 const>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int16 const>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned __int16 volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int16 volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned __int16 const volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int16 const volatile>::value, true);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned __int32>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int32>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned __int32 const>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int32 const>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned __int32 volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int32 volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned __int32 const volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int32 const volatile>::value, true);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned __int64>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int64>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned __int64 const>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int64 const>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned __int64 volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int64 volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<unsigned __int64 const volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int64 const volatile>::value, true);
|
||||
|
||||
#endif
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<float>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<float const>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<float volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<float const volatile>::value, true);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<double>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<double const>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<double volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<double const volatile>::value, true);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<long double>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<long double const>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<long double volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<long double const volatile>::value, true);
|
||||
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<int>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<void*>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<int*const>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<f1>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<f2>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<f3>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<mf1>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<mf2>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<mf3>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<mp>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<cmf>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<enum_UDT>::value, true);
|
||||
|
||||
//
|
||||
// These are commented out for now because it's not clear what the semantics should be:
|
||||
// on the one hand references always have trivial destructors (in the sense that there is
|
||||
// nothing to destruct), on the other hand the thing referenced may not have a trivial
|
||||
// destructor, it really depends upon the users code as to what should happen here:
|
||||
//
|
||||
//BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<int&>::value, false);
|
||||
//BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<const int&>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<int[2]>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<int[3][2]>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<int[2][4][5][6][3]>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<UDT>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<empty_UDT>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<void>::value, false);
|
||||
// cases we would like to succeed but can't implement in the language:
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<empty_POD_UDT>::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<POD_UDT>::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<POD_union_UDT>::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<empty_POD_union_UDT>::value, true, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<trivial_except_destroy>::value, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<trivial_except_copy>::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<trivial_except_construct>::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<trivial_except_assign>::value, true, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<wrap<trivial_except_destroy> >::value, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<wrap<trivial_except_copy> >::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<wrap<trivial_except_construct> >::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<wrap<trivial_except_assign> >::value, true, false);
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "test.hpp"
|
||||
#include <boost/config.hpp>
|
||||
#include "check_integral_constant.hpp"
|
||||
#ifdef TEST_STD
|
||||
# include <type_traits>
|
||||
|
||||
Reference in new issue
Block a user