Merge branch 'Version2' into develop

This commit is contained in:
jzmaddock
2015-06-18 11:23:28 +01:00
173 changed files with 2037 additions and 794 deletions
+4 -1
View File
@@ -29,7 +29,10 @@ rule all-tests {
{
result += [ run $(source) ] ;
}
for local source in has_nothrow_assign_test has_nothrow_constr_test
#
# These traits have both intrinsic support, and a std conforming version, test a version with intrinsics disabled for better code coverage:
#
for local source in has_nothrow_assign_test has_nothrow_constr_test has_nothrow_copy_test is_nothrow_move_assignable_test is_nothrow_move_constructible_test
{
result += [ run $(source).cpp : : : <define>BOOST_TT_DISABLE_INTRINSICS : $(source)_no_intrinsics ] ;
}
+6 -2
View File
@@ -120,20 +120,24 @@ TT_TEST_BEGIN(decay)
typedef int f1_type(void);
typedef int f2_type(int);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_same<
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_same<
::tt::decay<f1_type>::type,int (*)(void)>::value),
true );
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_same<
::tt::decay<f2_type>::type,int (*)(int)>::value),
true );
#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
//
// Don't test this if the std lib has no templated constructors (Oracle+STLPort):
//
std::pair<std::string,std::string> p = boost::make_pair( "foo", "bar" );
std::pair<std::string, int> p2 = boost::make_pair( "foo", 1 );
#ifndef BOOST_NO_STD_WSTRING
std::pair<std::wstring,std::string> p3 = boost::make_pair( L"foo", "bar" );
std::pair<std::wstring, int> p4 = boost::make_pair( L"foo", 1 );
#endif
#endif
//
// Todo: make these work sometime. The test id not directly
// related to decay<T>::type and can be avoided for now.
+8 -5
View File
@@ -34,7 +34,7 @@ struct delete_copy
struct noexcept_copy
{
noexcept_copy();
noexcept_copy& operator=(const non_copy&)noexcept;
noexcept_copy& operator=(const noexcept_copy&)noexcept;
};
#endif
@@ -212,9 +212,10 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<int&>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<int&&>::value, false);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<const int&>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<int[2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<int[3][2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<int[2][4][5][6][3]>::value, true);
// These used to be true, but are now false to match std conforming behavior:
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<int[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<int[3][2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<int[2][4][5][6][3]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<void>::value, false);
// cases we would like to succeed but can't implement in the language:
@@ -236,8 +237,10 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<delete_copy>::value, false)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<noexcept_copy>::value, true);
#endif
#if !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<non_copy>::value, false);
#endif
TT_TEST_END
+219
View File
@@ -0,0 +1,219 @@
// (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_destructor.hpp>
#endif
#ifdef BOOST_MSVC
#pragma warning(disable:4290) // exception spec ignored
#endif
struct nothrow_destruct
{
nothrow_destruct(int);
~nothrow_destruct()throw();
};
#if !defined(BOOST_NO_CXX11_NOEXCEPT)
struct noexcept_destruct
{
noexcept_destruct(int);
~noexcept_destruct()noexcept;
};
#endif
struct throwing_base
{
~throwing_base() throw(int);
};
struct throwing_derived : public throwing_base {};
struct throwing_contained{ throwing_base data; };
TT_TEST_BEGIN(has_nothrow_destructor)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<bool>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<bool const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<bool volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<bool const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<signed char>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<signed char const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<signed char volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<signed char const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned char>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<char>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned char const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<char const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned char volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<char volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned char const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<char const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned short>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<short>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned short const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<short const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned short volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<short volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned short const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<short const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned int>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<int>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned int const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<int const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned int volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<int volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned int const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<int const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned long>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<long>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned long const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<long const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned long volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<long volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned long const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<long const volatile>::value, true);
#ifdef BOOST_HAS_LONG_LONG
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor< ::boost::ulong_long_type>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor< ::boost::long_long_type>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor< ::boost::ulong_long_type const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor< ::boost::long_long_type const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor< ::boost::ulong_long_type volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor< ::boost::long_long_type volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor< ::boost::ulong_long_type const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor< ::boost::long_long_type const volatile>::value, true);
#endif
#ifdef BOOST_HAS_MS_INT64
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned __int8>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int8>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned __int8 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int8 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned __int8 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int8 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned __int8 const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int8 const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned __int16>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int16>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned __int16 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int16 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned __int16 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int16 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned __int16 const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int16 const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned __int32>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int32>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned __int32 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int32 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned __int32 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int32 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned __int32 const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int32 const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned __int64>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int64>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned __int64 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int64 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned __int64 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int64 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<unsigned __int64 const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int64 const volatile>::value, true);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<float>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<float const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<float volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<float const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<double>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<double const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<double volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<double const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<long double>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<long double const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<long double volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<long double const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<int>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<void*>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<int*const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<f1>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<f2>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<f3>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<mf1>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<mf2>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<mf3>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<mp>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<cmf>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_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_nothrow_destructor<int&>::value, false);
//BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<const int&>::value, false);
//
// Destructors on UDT's are non-throwing by default, unless they are explicity marked otherwise:
//
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<int[2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<int[3][2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<int[2][4][5][6][3]>::value, true);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<UDT>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<empty_UDT>::value, true, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<void>::value, false);
// cases we would like to succeed but can't implement in the language:
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<empty_POD_UDT>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<POD_UDT>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<POD_union_UDT>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<empty_POD_union_UDT>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<trivial_except_destroy>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<trivial_except_copy>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<trivial_except_construct>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<trivial_except_assign>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<wrap<trivial_except_destroy> >::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<wrap<trivial_except_copy> >::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<wrap<trivial_except_construct> >::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<wrap<trivial_except_assign> >::value, true, false);
#if !defined(BOOST_NO_CXX11_NOEXCEPT)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<noexcept_destruct>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<nothrow_destruct>::value, true);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<throwing_base>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<throwing_derived>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<throwing_contained>::value, false);
TT_TEST_END
+26 -3
View File
@@ -12,6 +12,23 @@
# include <boost/type_traits/has_trivial_assign.hpp>
#endif
struct non_assignable
{
non_assignable();
private:
non_assignable& operator=(const non_assignable&);
};
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
struct non_assignable2
{
non_assignable2();
non_assignable2& operator=(const non_assignable2&) = delete;
};
#endif
TT_TEST_BEGIN(has_trivial_assign)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign<bool>::value, true);
@@ -180,9 +197,10 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign<int&>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign<int&&>::value, false);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign<const int&>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign<int[2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign<int[3][2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign<int[2][4][5][6][3]>::value, true);
// Arrays can not be explicitly assigned:
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign<int[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign<int[3][2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign<int[2][4][5][6][3]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign<UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign<empty_UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign<void>::value, false);
@@ -203,6 +221,11 @@ BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_assign<wrap<trivial_except_
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign<test_abc1>::value, false);
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign<non_assignable2>::value, false);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign<non_assignable>::value, false);
TT_TEST_END
+23 -1
View File
@@ -27,6 +27,22 @@ public:
explicit bug11324_derived(char arg) : data(arg) {}
};
struct private_construct
{
private_construct(int);
private:
private_construct();
};
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
struct deleted_construct
{
deleted_construct(int);
deleted_construct() = delete;
};
#endif
TT_TEST_BEGIN(has_trivial_constructor)
@@ -167,7 +183,8 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<int[3][2]>::value, t
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);
// Can't construct type void:
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<void>::value, false);
// 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);
@@ -187,6 +204,11 @@ BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<wrap<trivial_ex
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<test_abc1>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<bug11324_derived>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<private_construct>::value, false);
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<deleted_construct>::value, false);
#endif
TT_TEST_END
+12 -3
View File
@@ -25,6 +25,13 @@ public:
#endif
struct private_copy
{
private_copy();
private:
private_copy(const private_copy&);
};
TT_TEST_BEGIN(has_trivial_copy)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<bool>::value, true);
@@ -194,9 +201,10 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<int&>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<int&&>::value, false);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<const int&>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<int[2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<int[3][2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<int[2][4][5][6][3]>::value, true);
// Arrays can not be explicitly copied:
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<int[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<int[3][2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<int[2][4][5][6][3]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<void>::value, false);
// cases we would like to succeed but can't implement in the language:
@@ -219,6 +227,7 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<test_abc1>::value, false);
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<bug_10389>::value, false);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<private_copy>::value, false);
TT_TEST_END
+22
View File
@@ -12,6 +12,23 @@
# include <boost/type_traits/has_trivial_destructor.hpp>
#endif
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
struct deleted_destruct
{
deleted_destruct();
~deleted_destruct() = delete;
};
#endif
struct private_destruct
{
private_destruct();
private:
~private_destruct();
};
TT_TEST_BEGIN(has_trivial_destructor)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<bool>::value, true);
@@ -170,6 +187,11 @@ BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<wrap<trivial_exc
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);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<private_destruct>::value, false);
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<deleted_destruct>::value, false);
#endif
TT_TEST_END
+41 -3
View File
@@ -13,6 +13,38 @@
# include <boost/type_traits/has_trivial_move_assign.hpp>
#endif
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
struct non_copyable_movable
{
int val;
non_copyable_movable(int);
non_copyable_movable(const non_copyable_movable&) = delete;
non_copyable_movable& operator=(const non_copyable_movable&) = delete;
//non_copyable_movable(non_copyable_movable&&) = default;
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1800)
non_copyable_movable& operator=(non_copyable_movable&& o)
{
val = std::move(o.val);
return *this;
}
#else
non_copyable_movable& operator=(non_copyable_movable&&) = default;
#endif
};
struct copyable_non_moveable
{
int val;
copyable_non_moveable(int);
copyable_non_moveable(const copyable_non_moveable&) = default;
copyable_non_moveable& operator=(const copyable_non_moveable&) = default;
copyable_non_moveable(copyable_non_moveable&&) = delete;
copyable_non_moveable& operator=(copyable_non_moveable&&) = delete;
};
#endif
TT_TEST_BEGIN(has_trivial_move_assign)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign<bool>::value, true);
@@ -181,9 +213,10 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign<int&>::value, false)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign<int&&>::value, false);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign<const int&>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign<int[2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign<int[3][2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign<int[2][4][5][6][3]>::value, true);
// array types are not assignable:
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign<int[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign<int[3][2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign<int[2][4][5][6][3]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign<UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign<empty_UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign<void>::value, false);
@@ -204,6 +237,11 @@ BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign<wrap<trivial_ex
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign<test_abc1>::value, false);
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign<non_copyable_movable>::value, true, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign<copyable_non_moveable>::value, false);
#endif
TT_TEST_END
+44 -6
View File
@@ -13,6 +13,39 @@
# include <boost/type_traits/has_trivial_move_constructor.hpp>
#endif
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
struct non_copyable_movable
{
int val;
non_copyable_movable(int);
non_copyable_movable(const non_copyable_movable&) = delete;
non_copyable_movable& operator=(const non_copyable_movable&) = delete;
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1800)
non_copyable_movable(non_copyable_movable&& o) : val(o.val){}
non_copyable_movable& operator=(non_copyable_movable&& o)
{
val = std::move(o.val);
return *this;
}
#else
non_copyable_movable(non_copyable_movable&&) = default;
non_copyable_movable& operator=(non_copyable_movable&&) = default;
#endif
};
struct copyable_non_moveable
{
int val;
copyable_non_moveable(int);
copyable_non_moveable(const copyable_non_moveable&) = default;
copyable_non_moveable& operator=(const copyable_non_moveable&) = default;
copyable_non_moveable(copyable_non_moveable&&) = delete;
copyable_non_moveable& operator=(copyable_non_moveable&&) = delete;
};
#endif
TT_TEST_BEGIN(has_trivial_move_constructor)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<bool>::value, true);
@@ -177,14 +210,14 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<mp>::value, tru
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<cmf>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<enum_UDT>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<int&>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<int&>::value, true);
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<int&&>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<int&&>::value, true);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<const int&>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<int[2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<int[3][2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<int[2][4][5][6][3]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<const int&>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<int[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<int[3][2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<int[2][4][5][6][3]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<void>::value, false);
// cases we would like to succeed but can't implement in the language:
@@ -204,6 +237,11 @@ BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<wrap<trivi
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<test_abc1>::value, false);
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<non_copyable_movable>::value, true, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<copyable_non_moveable>::value, false);
#endif
TT_TEST_END
+79
View File
@@ -0,0 +1,79 @@
// (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/is_constructible.hpp>
#endif
struct non_copy_constructible
{
non_copy_constructible();
non_copy_constructible(int);
non_copy_constructible(double*, double*);
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
non_copy_constructible(const non_copy_constructible&) = delete;
#endif
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
non_copy_constructible(non_copy_constructible&&);
#endif
};
struct A { };
struct B : A { };
TT_TEST_BEGIN(is_constructible)
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible<B &&, A>::value) , false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible<B const &&, A>::value) , false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible<B const &&, A const>::value) , false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible<B volatile &&, A>::value) , false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible<B volatile &&, A volatile>::value) , false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible<B const volatile &&, A>::value) , false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible<B const volatile &&, A const>::value) , false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible<B const volatile &&, A volatile>::value) , false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible<B const volatile &&, A const volatile>::value) , false);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible<B&, A>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible<B const &, A>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible<B const &, A&>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible<B const &, A const>::value), false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT((::tt::is_constructible<non_copy_constructible>::value), true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT((::tt::is_constructible<non_copy_constructible, int>::value), true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT((::tt::is_constructible<non_copy_constructible, int const>::value), true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT((::tt::is_constructible<non_copy_constructible, int const&>::value), true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT((::tt::is_constructible<non_copy_constructible, non_copy_constructible>::value), true, false);
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800)
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT((::tt::is_constructible<non_copy_constructible, double*, double*>::value), true, false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible<non_copy_constructible, double const*, double*>::value), false);
#endif
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible<non_copy_constructible, const non_copy_constructible&>::value), false);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible<int, const int>::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible<int, const int&>::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible<int*, const int&>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible<int*, const int*>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible<int*, int*>::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible<int*, int[2]>::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible<int*, int[]>::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible<int(*)(int), int&>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible<int(*)(int), int(*)(int)>::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible<int(&)(int), int(int)>::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible<int(int), int(int)>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible<int(int), int(&)(int)>::value), false);
TT_TEST_END
+7 -13
View File
@@ -80,7 +80,10 @@ TT_TEST_BEGIN(is_copy_constructible)
// Main part of the test
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible<has>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible<has2>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible<has3>::value, true);
// Only constructible from has3& not from const-reference, this only works if we have decltype:
#if !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible<has3>::value, false);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible<has4>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible<has_not>::value, false);
#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) && !defined(BOOST_INTEL_CXX_VERSION)
@@ -260,18 +263,9 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible<enum_UDT>::value, true
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible<int&>::value, true);
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
// Code like `int&& a = 10;` or
// struct nonc {
// nonc() = default;
// nonc(const nonc&) = delete;
// nonc(nonc&&) = delete;
// nonc& operator=(const nonc&) = delete;
// nonc& operator=(nonc&&) = delete;
// };
//
// nonc && a = nonc();
// is legal in C++11. so this trait MUST return true.
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible<int&&>::value, true);
// This is debatable, we used to insist this was true, but copy-constructibility
// implies copying a constant-object, and that isn't the case here:
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible<int&&>::value, false);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible<const int&>::value, true);
+190
View File
@@ -0,0 +1,190 @@
// (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/is_destructible.hpp>
#endif
#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
struct deleted_destruct
{
deleted_destruct();
~deleted_destruct() = delete;
};
#endif
TT_TEST_BEGIN(is_destructible)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<bool>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<bool const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<bool volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<bool const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<signed char>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<signed char const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<signed char volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<signed char const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned char>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<char>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned char const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<char const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned char volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<char volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned char const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<char const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned short>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<short>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned short const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<short const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned short volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<short volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned short const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<short const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned int>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<int>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned int const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<int const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned int volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<int volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned int const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<int const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned long>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<long>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned long const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<long const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned long volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<long volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned long const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<long const volatile>::value, true);
#ifdef BOOST_HAS_LONG_LONG
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::ulong_long_type>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::long_long_type>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::ulong_long_type const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::long_long_type const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::ulong_long_type volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::long_long_type volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::ulong_long_type const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::long_long_type const volatile>::value, true);
#endif
#ifdef BOOST_HAS_MS_INT64
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int8>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int8>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int8 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int8 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int8 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int8 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int8 const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int8 const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int16>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int16>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int16 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int16 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int16 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int16 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int16 const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int16 const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int32>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int32>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int32 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int32 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int32 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int32 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int32 const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int32 const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int64>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int64>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int64 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int64 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int64 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int64 volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int64 const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int64 const volatile>::value, true);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<float>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<float const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<float volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<float const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<double>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<double const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<double volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<double const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<long double>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<long double const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<long double volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<long double const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<int>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<void*>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<int*const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<f1>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<f2>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<f3>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<mf1>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<mf2>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<mf3>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<mp>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<cmf>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT&>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT const&>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT const volatile&>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT volatile&>::value, true);
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT&&>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT const&&>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT const volatile&&>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT volatile&&>::value, true);
#endif
//
// 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::is_destructible<int&>::value, false);
//BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<const int&>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<int[2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<int[3][2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<int[2][4][5][6][3]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<UDT>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<empty_UDT>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<void>::value, false);
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<deleted_destruct>::value, false);
#endif
TT_TEST_END
+35
View File
@@ -13,6 +13,33 @@
# include <boost/type_traits/is_nothrow_move_assignable.hpp>
#endif
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
struct non_assignable
{
non_assignable();
non_assignable& operator=(const non_assignable&) = delete;
};
#endif
#ifndef BOOST_NO_CXX11_NOEXCEPT
struct noexcept_assignable
{
noexcept_assignable();
noexcept_assignable& operator=(const non_assignable&)noexcept;
};
struct noexcept_move_assignable
{
noexcept_move_assignable();
noexcept_move_assignable& operator=(const noexcept_move_assignable&);
noexcept_move_assignable& operator=(noexcept_move_assignable&&)noexcept;
};
#endif
TT_TEST_BEGIN(is_nothrow_move_assignable)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_assignable<bool>::value, true);
@@ -214,6 +241,14 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_assignable<nothrow_copy_UDT>
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_assignable<nothrow_construct_UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_assignable<test_abc1>::value, false);
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_assignable<non_assignable>::value, false);
#endif
#ifndef BOOST_NO_CXX11_NOEXCEPT
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_assignable<noexcept_assignable>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_assignable<noexcept_move_assignable>::value, true);
#endif
TT_TEST_END
+48 -3
View File
@@ -14,6 +14,40 @@
# include <boost/type_traits/is_nothrow_move_constructible.hpp>
#endif
struct non_copy
{
non_copy();
private:
non_copy(const non_copy&);
};
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
struct delete_copy
{
delete_copy();
delete_copy(const delete_copy&) = delete;
};
#endif
#ifndef BOOST_NO_CXX11_NOEXCEPT
struct noexcept_copy
{
noexcept_copy();
noexcept_copy(const noexcept_copy&)noexcept;
};
struct noexcept_move
{
noexcept_move();
noexcept_move(const noexcept_move&);
noexcept_move(noexcept_move&&)noexcept;
};
#endif
TT_TEST_BEGIN(is_nothrow_move_constructible)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<bool>::value, true);
@@ -182,11 +216,11 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<mp>::value, tr
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<cmf>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<enum_UDT>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<int&>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<int&>::value, true);
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<int&&>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<int&&>::value, true);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<const int&>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<const int&>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<int[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<int[3][2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<int[2][4][5][6][3]>::value, false);
@@ -211,6 +245,17 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<nothrow_assign
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<nothrow_construct_UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<test_abc1>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<non_copy>::value, false);
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<delete_copy>::value, false);
#endif
#ifndef BOOST_NO_CXX11_NOEXCEPT
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<noexcept_copy>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<noexcept_move>::value, true);
#endif
TT_TEST_END