From 8dc33362b99c5c9c6f12a93727bfa2e923d57620 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Thu, 15 Jan 2015 11:31:18 +0000 Subject: [PATCH] Convert some more traits. --- include/boost/type_traits/add_cv.hpp | 41 ++++ include/boost/type_traits/add_pointer.hpp | 61 ++++++ include/boost/type_traits/add_volatile.hpp | 40 ++++ include/boost/type_traits/alignment_of.hpp | 119 ++++++++++++ .../boost/type_traits/composite_traits.hpp | 29 +++ include/boost/type_traits/detail/ice_and.hpp | 42 +++++ include/boost/type_traits/detail/ice_eq.hpp | 43 +++++ include/boost/type_traits/detail/ice_not.hpp | 38 ++++ include/boost/type_traits/detail/ice_or.hpp | 41 ++++ .../type_traits/has_trivial_destructor.hpp | 44 +++++ include/boost/type_traits/ice.hpp | 20 ++ test/add_cv_test.cpp | 61 ++++++ test/add_pointer_test.cpp | 41 ++++ test/add_volatile_test.cpp | 59 ++++++ test/alignment_of_a2_test.cpp | 126 +++++++++++++ test/alignment_of_test.cpp | 121 ++++++++++++ test/has_trivial_destructor_test.cpp | 176 ++++++++++++++++++ test/is_nothrow_move_constructible_test.cpp | 1 + 18 files changed, 1103 insertions(+) create mode 100644 include/boost/type_traits/add_cv.hpp create mode 100644 include/boost/type_traits/add_pointer.hpp create mode 100644 include/boost/type_traits/add_volatile.hpp create mode 100644 include/boost/type_traits/alignment_of.hpp create mode 100644 include/boost/type_traits/composite_traits.hpp create mode 100644 include/boost/type_traits/detail/ice_and.hpp create mode 100644 include/boost/type_traits/detail/ice_eq.hpp create mode 100644 include/boost/type_traits/detail/ice_not.hpp create mode 100644 include/boost/type_traits/detail/ice_or.hpp create mode 100644 include/boost/type_traits/has_trivial_destructor.hpp create mode 100644 include/boost/type_traits/ice.hpp create mode 100644 test/add_cv_test.cpp create mode 100644 test/add_pointer_test.cpp create mode 100644 test/add_volatile_test.cpp create mode 100644 test/alignment_of_a2_test.cpp create mode 100644 test/alignment_of_test.cpp create mode 100644 test/has_trivial_destructor_test.cpp diff --git a/include/boost/type_traits/add_cv.hpp b/include/boost/type_traits/add_cv.hpp new file mode 100644 index 0000000..e62ddee --- /dev/null +++ b/include/boost/type_traits/add_cv.hpp @@ -0,0 +1,41 @@ + +// (C) Copyright Dave Abrahams, 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_ADD_CV_HPP_INCLUDED +#define BOOST_TT_ADD_CV_HPP_INCLUDED + +#include + +namespace boost { + +// * convert a type T to a const volatile type - add_cv +// this is not required since the result is always +// the same as "T const volatile", but it does suppress warnings +// from some compilers: + +#if defined(BOOST_MSVC) +// This bogus warning will appear when add_volatile is applied to a +// const volatile reference because we can't detect const volatile +// references with MSVC6. +# pragma warning(push) +# pragma warning(disable:4181) // warning C4181: qualifier applied to reference type ignored +#endif + +template struct add_cv{ typedef T const volatile type; }; + +#if defined(BOOST_MSVC) +# pragma warning(pop) +#endif + +template struct add_cv{ typedef T& type; }; + +} // namespace boost + +#endif // BOOST_TT_ADD_CV_HPP_INCLUDED diff --git a/include/boost/type_traits/add_pointer.hpp b/include/boost/type_traits/add_pointer.hpp new file mode 100644 index 0000000..745f63a --- /dev/null +++ b/include/boost/type_traits/add_pointer.hpp @@ -0,0 +1,61 @@ + +// (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_ADD_POINTER_HPP_INCLUDED +#define BOOST_TT_ADD_POINTER_HPP_INCLUDED + +#include + +namespace boost { + +#if defined(__BORLANDC__) && (__BORLANDC__ < 0x5A0) +// +// For some reason this implementation stops Borlands compiler +// from dropping cv-qualifiers, it still fails with references +// to arrays for some reason though (shrug...) (JM 20021104) +// +template +struct add_pointer +{ + typedef T* type; +}; +template +struct add_pointer +{ + typedef T* type; +}; +template +struct add_pointer +{ + typedef T* type; +}; +template +struct add_pointer +{ + typedef T* type; +}; +template +struct add_pointer +{ + typedef T* type; +}; + +#else + +template +struct add_pointer +{ + typedef typename remove_reference::type no_ref_type; + typedef no_ref_type* type; +}; + +#endif + +} // namespace boost + +#endif // BOOST_TT_ADD_POINTER_HPP_INCLUDED diff --git a/include/boost/type_traits/add_volatile.hpp b/include/boost/type_traits/add_volatile.hpp new file mode 100644 index 0000000..24f515c --- /dev/null +++ b/include/boost/type_traits/add_volatile.hpp @@ -0,0 +1,40 @@ + +// (C) Copyright Dave Abrahams, 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_ADD_VOLATILE_HPP_INCLUDED +#define BOOST_TT_ADD_VOLATILE_HPP_INCLUDED + +#include + +namespace boost { + +// * convert a type T to volatile type - add_volatile +// this is not required since the result is always +// the same as "T volatile", but it does suppress warnings +// from some compilers: + +#if defined(BOOST_MSVC) +// This bogus warning will appear when add_volatile is applied to a +// const volatile reference because we can't detect const volatile +// references with MSVC6. +# pragma warning(push) +# pragma warning(disable:4181) // warning C4181: qualifier applied to reference type ignored +#endif + +template struct add_volatile{ typedef T volatile type; }; + +#if defined(BOOST_MSVC) +# pragma warning(pop) +#endif + +template struct add_volatile{ typedef T& type; }; + +} // namespace boost + +#endif // BOOST_TT_ADD_VOLATILE_HPP_INCLUDED diff --git a/include/boost/type_traits/alignment_of.hpp b/include/boost/type_traits/alignment_of.hpp new file mode 100644 index 0000000..7d960e3 --- /dev/null +++ b/include/boost/type_traits/alignment_of.hpp @@ -0,0 +1,119 @@ + +// (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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_ALIGNMENT_OF_HPP_INCLUDED +#define BOOST_TT_ALIGNMENT_OF_HPP_INCLUDED + +#include +#include + +#include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable: 4121 4512) // alignment is sensitive to packing +#endif +#if defined(__BORLANDC__) && (__BORLANDC__ < 0x600) +#pragma option push -Vx- -Ve- +#endif + +namespace boost { + +template struct alignment_of; + +// get the alignment of some arbitrary type: +namespace detail { + +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4324) // structure was padded due to __declspec(align()) +#endif +template +struct alignment_of_hack +{ + char c; + T t; + alignment_of_hack(); +}; +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +template +struct alignment_logic +{ + BOOST_STATIC_CONSTANT(std::size_t, value = A < S ? A : S); +}; + + +template< typename T > +struct alignment_of_impl +{ +#if defined(BOOST_MSVC) && (BOOST_MSVC >= 1400) + // + // With MSVC both the native __alignof operator + // and our own logic gets things wrong from time to time :-( + // Using a combination of the two seems to make the most of a bad job: + // + BOOST_STATIC_CONSTANT(std::size_t, value = + (::boost::detail::alignment_logic< + sizeof(::boost::detail::alignment_of_hack) - sizeof(T), + __alignof(T) + >::value)); +#elif !defined(BOOST_ALIGNMENT_OF) + BOOST_STATIC_CONSTANT(std::size_t, value = + (::boost::detail::alignment_logic< + sizeof(::boost::detail::alignment_of_hack) - sizeof(T), + sizeof(T) + >::value)); +#else + // + // We put this here, rather than in the definition of + // alignment_of below, because MSVC's __alignof doesn't + // always work in that context for some unexplained reason. + // (See type_with_alignment tests for test cases). + // + BOOST_STATIC_CONSTANT(std::size_t, value = BOOST_ALIGNMENT_OF(T)); +#endif +}; + +} // namespace detail + +template struct alignment_of : public integral_constant::value>{}; + +// references have to be treated specially, assume +// that a reference is just a special pointer: +template struct alignment_of : public alignment_of{}; + +#ifdef __BORLANDC__ +// long double gives an incorrect value of 10 (!) +// unless we do this... +struct long_double_wrapper{ long double ld; }; +template<> struct alignment_of : public alignment_of{}; +#endif + +// void has to be treated specially: +template<> struct alignment_of : integral_constant{}; +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +template<> struct alignment_of : integral_constant{}; +template<> struct alignment_of : integral_constant{}; +template<> struct alignment_of : integral_constant{}; +#endif + +} // namespace boost + +#if defined(__BORLANDC__) && (__BORLANDC__ < 0x600) +#pragma option pop +#endif +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +#endif // BOOST_TT_ALIGNMENT_OF_HPP_INCLUDED + diff --git a/include/boost/type_traits/composite_traits.hpp b/include/boost/type_traits/composite_traits.hpp new file mode 100644 index 0000000..985a4c5 --- /dev/null +++ b/include/boost/type_traits/composite_traits.hpp @@ -0,0 +1,29 @@ +// (C) Copyright Dave Abrahams, 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 traits classes for composite types: +// is_array, is_pointer, is_reference, is_member_pointer, is_enum, is_union. +// + +#ifndef BOOST_TT_COMPOSITE_TRAITS_HPP_INCLUDED +#define BOOST_TT_COMPOSITE_TRAITS_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include +#include + +#endif // BOOST_TT_COMPOSITE_TRAITS_HPP_INCLUDED + + + + + diff --git a/include/boost/type_traits/detail/ice_and.hpp b/include/boost/type_traits/detail/ice_and.hpp new file mode 100644 index 0000000..3ccb03e --- /dev/null +++ b/include/boost/type_traits/detail/ice_and.hpp @@ -0,0 +1,42 @@ +// (C) Copyright John Maddock and Steve Cleary 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_DETAIL_ICE_AND_HPP_INCLUDED +#define BOOST_TT_DETAIL_ICE_AND_HPP_INCLUDED + +#include + +// +// This header is deprecated and no longer used by type_traits: +// +#if defined(__GNUC__) || defined(_MSC_VER) +# pragma message("NOTE: Use of this header (ice_and.hpp) is deprecated") +#endif + +namespace boost { +namespace type_traits { + +template +struct ice_and; + +template +struct ice_and +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +template <> +struct ice_and +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; + +} // namespace type_traits +} // namespace boost + +#endif // BOOST_TT_DETAIL_ICE_AND_HPP_INCLUDED diff --git a/include/boost/type_traits/detail/ice_eq.hpp b/include/boost/type_traits/detail/ice_eq.hpp new file mode 100644 index 0000000..5908f81 --- /dev/null +++ b/include/boost/type_traits/detail/ice_eq.hpp @@ -0,0 +1,43 @@ +// (C) Copyright John Maddock and Steve Cleary 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_DETAIL_ICE_EQ_HPP_INCLUDED +#define BOOST_TT_DETAIL_ICE_EQ_HPP_INCLUDED + +#include + +// +// This header is deprecated and no longer used by type_traits: +// +#if defined(__GNUC__) || defined(_MSC_VER) +# pragma message("NOTE: Use of this header (ice_eq.hpp) is deprecated") +#endif + +namespace boost { +namespace type_traits { + +template +struct ice_eq +{ + BOOST_STATIC_CONSTANT(bool, value = (b1 == b2)); +}; + +template +struct ice_ne +{ + BOOST_STATIC_CONSTANT(bool, value = (b1 != b2)); +}; + +#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION +template bool const ice_eq::value; +template bool const ice_ne::value; +#endif + +} // namespace type_traits +} // namespace boost + +#endif // BOOST_TT_DETAIL_ICE_EQ_HPP_INCLUDED diff --git a/include/boost/type_traits/detail/ice_not.hpp b/include/boost/type_traits/detail/ice_not.hpp new file mode 100644 index 0000000..e095be9 --- /dev/null +++ b/include/boost/type_traits/detail/ice_not.hpp @@ -0,0 +1,38 @@ +// (C) Copyright John Maddock and Steve Cleary 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_DETAIL_ICE_NOT_HPP_INCLUDED +#define BOOST_TT_DETAIL_ICE_NOT_HPP_INCLUDED + +#include + +// +// This header is deprecated and no longer used by type_traits: +// +#if defined(__GNUC__) || defined(_MSC_VER) +# pragma message("NOTE: Use of this header (ice_not.hpp) is deprecated") +#endif + +namespace boost { +namespace type_traits { + +template +struct ice_not +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; + +template <> +struct ice_not +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +} // namespace type_traits +} // namespace boost + +#endif // BOOST_TT_DETAIL_ICE_NOT_HPP_INCLUDED diff --git a/include/boost/type_traits/detail/ice_or.hpp b/include/boost/type_traits/detail/ice_or.hpp new file mode 100644 index 0000000..ea523c8 --- /dev/null +++ b/include/boost/type_traits/detail/ice_or.hpp @@ -0,0 +1,41 @@ +// (C) Copyright John Maddock and Steve Cleary 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_DETAIL_ICE_OR_HPP_INCLUDED +#define BOOST_TT_DETAIL_ICE_OR_HPP_INCLUDED + +#include + +// +// This header is deprecated and no longer used by type_traits: +// +#if defined(__GNUC__) || defined(_MSC_VER) +# pragma message("NOTE: Use of this header (ice_or.hpp) is deprecated") +#endif + +namespace boost { +namespace type_traits { + +template +struct ice_or; + +template +struct ice_or +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; + +template <> +struct ice_or +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +} // namespace type_traits +} // namespace boost + +#endif // BOOST_TT_DETAIL_ICE_OR_HPP_INCLUDED diff --git a/include/boost/type_traits/has_trivial_destructor.hpp b/include/boost/type_traits/has_trivial_destructor.hpp new file mode 100644 index 0000000..dc1b24c --- /dev/null +++ b/include/boost/type_traits/has_trivial_destructor.hpp @@ -0,0 +1,44 @@ + +// (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_DESTRUCTOR_HPP_INCLUDED +#define BOOST_TT_HAS_TRIVIAL_DESTRUCTOR_HPP_INCLUDED + +#include +#include + +#ifdef BOOST_HAS_TRIVIAL_DESTRUCTOR + +#if defined(BOOST_INTEL) || defined(BOOST_MSVC) +#include +#endif +#ifdef BOOST_HAS_SGI_TYPE_TRAITS +#include +#endif + +namespace boost { + +template struct has_trivial_destructor : public integral_constant{}; +#else +#include + +namespace boost{ + +template struct has_trivial_destructor : public integral_constant::value>{}; +#endif + +template <> struct has_trivial_destructor : public false_type{}; +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +template <> struct has_trivial_destructor : public false_type{}; +template <> struct has_trivial_destructor : public false_type{}; +template <> struct has_trivial_destructor : public false_type{}; +#endif + +} // namespace boost + +#endif // BOOST_TT_HAS_TRIVIAL_DESTRUCTOR_HPP_INCLUDED diff --git a/include/boost/type_traits/ice.hpp b/include/boost/type_traits/ice.hpp new file mode 100644 index 0000000..134bc4b --- /dev/null +++ b/include/boost/type_traits/ice.hpp @@ -0,0 +1,20 @@ + +// (C) Copyright John Maddock and Steve Cleary 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. +// +// macros and helpers for working with integral-constant-expressions. + +#ifndef BOOST_TT_ICE_HPP_INCLUDED +#define BOOST_TT_ICE_HPP_INCLUDED + +#include +#include +#include +#include +#include + +#endif // BOOST_TT_ICE_HPP_INCLUDED diff --git a/test/add_cv_test.cpp b/test/add_cv_test.cpp new file mode 100644 index 0000000..c1f4353 --- /dev/null +++ b/test/add_cv_test.cpp @@ -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 +#else +# include +#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 + + + + + + + + diff --git a/test/add_pointer_test.cpp b/test/add_pointer_test.cpp new file mode 100644 index 0000000..3b52eda --- /dev/null +++ b/test/add_pointer_test.cpp @@ -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 +#else +# include +#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 + + + + + + + + diff --git a/test/add_volatile_test.cpp b/test/add_volatile_test.cpp new file mode 100644 index 0000000..cc9aeed --- /dev/null +++ b/test/add_volatile_test.cpp @@ -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 +#else +# include +#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 + + + + + + + + diff --git a/test/alignment_of_a2_test.cpp b/test/alignment_of_a2_test.cpp new file mode 100644 index 0000000..fe6b66e --- /dev/null +++ b/test/alignment_of_a2_test.cpp @@ -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 +#else +# include +#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 +// 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 +struct align_calc +{ + char padding; + T instance; + static std::ptrdiff_t get() + { + static align_calc a; + return reinterpret_cast(&(a.instance)) - reinterpret_cast(&(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::value, 0); +#endif +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(char)); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(short)); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(int)); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(long)); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(float)); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(double)); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::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::value, ALIGNOF(int[4])); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(int(*)(int))); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(int*)); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(VB)); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(VD)); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(enum_UDT)); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(mf2)); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(POD_UDT)); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(empty_UDT)); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(union_UDT)); + +#if defined(BOOST_MSVC) && (BOOST_MSVC >= 1400) +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(issue1946)); +#endif + +TT_TEST_END + + + + + + + + diff --git a/test/alignment_of_test.cpp b/test/alignment_of_test.cpp new file mode 100644 index 0000000..7faaf84 --- /dev/null +++ b/test/alignment_of_test.cpp @@ -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 +#else +# include +#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 +// 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 +struct align_calc +{ + char padding; + T instance; + static std::ptrdiff_t get() + { + static align_calc a; + return reinterpret_cast(&(a.instance)) - reinterpret_cast(&(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::value, 0); +#endif +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(char)); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(short)); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(int)); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(long)); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(float)); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(double)); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::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::value, ALIGNOF(int[4])); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(int(*)(int))); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(int*)); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(VB)); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(VD)); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(enum_UDT)); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(mf2)); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(POD_UDT)); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(empty_UDT)); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(union_UDT)); + +#if defined(BOOST_MSVC) && (BOOST_MSVC >= 1400) +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(issue1946)); +#endif + +TT_TEST_END + + + + + + + + diff --git a/test/has_trivial_destructor_test.cpp b/test/has_trivial_destructor_test.cpp new file mode 100644 index 0000000..48196b7 --- /dev/null +++ b/test/has_trivial_destructor_test.cpp @@ -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 +#else +# include +#endif + +TT_TEST_BEGIN(has_trivial_destructor) + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::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::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int8>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int8 const>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int8 volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int8 const volatile>::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int16>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int16 const>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int16 volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int16 const volatile>::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int32>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int32 const>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int32 volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int32 const volatile>::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int64>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int64 const>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int64 volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<__int64 const volatile>::value, true); + +#endif + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); + + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::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::value, false); +//BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, false); +// cases we would like to succeed but can't implement in the language: +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true, false); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor >::value, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_destructor >::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_destructor >::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_destructor >::value, true, false); + +TT_TEST_END + + + diff --git a/test/is_nothrow_move_constructible_test.cpp b/test/is_nothrow_move_constructible_test.cpp index 9d258ae..a15cacf 100644 --- a/test/is_nothrow_move_constructible_test.cpp +++ b/test/is_nothrow_move_constructible_test.cpp @@ -6,6 +6,7 @@ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include "test.hpp" +#include #include "check_integral_constant.hpp" #ifdef TEST_STD # include