diff --git a/include/boost/type_traits/has_new_operator.hpp b/include/boost/type_traits/has_new_operator.hpp new file mode 100644 index 0000000..7eb9205 --- /dev/null +++ b/include/boost/type_traits/has_new_operator.hpp @@ -0,0 +1,146 @@ + +// (C) Copyright Runar Undheim, Robert Ramey & John Maddock 2008. +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_NEW_OPERATOR_HPP_INCLUDED +#define BOOST_TT_HAS_NEW_OPERATOR_HPP_INCLUDED + +#include // std::nothrow_t +#include // std::size_t +#include +#include + +#if defined(new) +# if BOOST_WORKAROUND(BOOST_MSVC, >= 1310) +# define BOOST_TT_AUX_MACRO_NEW_DEFINED +# pragma push_macro("new") +# undef new +# else +# error "Sorry but you can't include this header if 'new' is defined as a macro." +# endif +#endif + +namespace boost { +namespace detail { + template + struct test; + + template + struct has_new_operator_impl { + template + static type_traits::yes_type check_sig1( + U*, + test< + void *(*)(std::size_t), + &U::operator new + >* = NULL + ); + template + static type_traits::no_type check_sig1(...); + + template + static type_traits::yes_type check_sig2( + U*, + test< + void *(*)(std::size_t, const std::nothrow_t&), + &U::operator new + >* = NULL + ); + template + static type_traits::no_type check_sig2(...); + + template + static type_traits::yes_type check_sig3( + U*, + test< + void *(*)(std::size_t, void*), + &U::operator new + >* = NULL + ); + template + static type_traits::no_type check_sig3(...); + + + template + static type_traits::yes_type check_sig4( + U*, + test< + void *(*)(std::size_t), + &U::operator new[] + >* = NULL + ); + template + static type_traits::no_type check_sig4(...); + + template + static type_traits::yes_type check_sig5( + U*, + test< + void *(*)(std::size_t, const std::nothrow_t&), + &U::operator new[] + >* = NULL + ); + template + static type_traits::no_type check_sig5(...); + + template + static type_traits::yes_type check_sig6( + U*, + test< + void *(*)(std::size_t, void*), + &U::operator new[] + >* = NULL + ); + template + static type_traits::no_type check_sig6(...); + + // GCC2 won't even parse this template if we embed the computation + // of s1 in the computation of value. + #ifdef __GNUC__ + BOOST_STATIC_CONSTANT(unsigned, s1 = sizeof(has_new_operator_impl::template check_sig1(0))); + BOOST_STATIC_CONSTANT(unsigned, s2 = sizeof(has_new_operator_impl::template check_sig2(0))); + BOOST_STATIC_CONSTANT(unsigned, s3 = sizeof(has_new_operator_impl::template check_sig3(0))); + BOOST_STATIC_CONSTANT(unsigned, s4 = sizeof(has_new_operator_impl::template check_sig4(0))); + BOOST_STATIC_CONSTANT(unsigned, s5 = sizeof(has_new_operator_impl::template check_sig5(0))); + BOOST_STATIC_CONSTANT(unsigned, s6 = sizeof(has_new_operator_impl::template check_sig6(0))); + #else + #if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) + #pragma warning(push) + #pragma warning(disable:6334) + #endif + + BOOST_STATIC_CONSTANT(unsigned, s1 = sizeof(check_sig1(0))); + BOOST_STATIC_CONSTANT(unsigned, s2 = sizeof(check_sig2(0))); + BOOST_STATIC_CONSTANT(unsigned, s3 = sizeof(check_sig3(0))); + BOOST_STATIC_CONSTANT(unsigned, s4 = sizeof(check_sig4(0))); + BOOST_STATIC_CONSTANT(unsigned, s5 = sizeof(check_sig5(0))); + BOOST_STATIC_CONSTANT(unsigned, s6 = sizeof(check_sig6(0))); + + #if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) + #pragma warning(pop) + #endif + #endif + BOOST_STATIC_CONSTANT(bool, value = + (s1 == sizeof(type_traits::yes_type)) || + (s2 == sizeof(type_traits::yes_type)) || + (s3 == sizeof(type_traits::yes_type)) || + (s4 == sizeof(type_traits::yes_type)) || + (s5 == sizeof(type_traits::yes_type)) || + (s6 == sizeof(type_traits::yes_type)) + ); + }; +} // namespace detail + +template struct has_new_operator : public integral_constant::value>{}; + +} // namespace boost + +#if defined(BOOST_TT_AUX_MACRO_NEW_DEFINED) +# pragma pop_macro("new") +#endif + +#endif // BOOST_TT_HAS_NEW_OPERATOR_HPP_INCLUDED diff --git a/include/boost/type_traits/has_nothrow_constructor.hpp b/include/boost/type_traits/has_nothrow_constructor.hpp new file mode 100644 index 0000000..f176c0f --- /dev/null +++ b/include/boost/type_traits/has_nothrow_constructor.hpp @@ -0,0 +1,46 @@ + +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_NOTHROW_CONSTRUCTOR_HPP_INCLUDED +#define BOOST_TT_HAS_NOTHROW_CONSTRUCTOR_HPP_INCLUDED + +#include +#include + +#ifdef BOOST_HAS_NOTHROW_CONSTRUCTOR + +#if defined(BOOST_MSVC) || defined(BOOST_INTEL) +#include +#endif + +namespace boost { + +template struct has_nothrow_constructor : public integral_constant{}; + +#else + +#include + +namespace boost { + +template struct has_nothrow_constructor : public ::boost::has_trivial_constructor {}; + +#endif + +template<> struct has_nothrow_constructor : public false_type {}; +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +template<> struct has_nothrow_constructor : public false_type{}; +template<> struct has_nothrow_constructor : public false_type{}; +template<> struct has_nothrow_constructor : public false_type{}; +#endif + +template struct has_nothrow_default_constructor : public has_nothrow_constructor{}; + +} // namespace boost + +#endif // BOOST_TT_HAS_NOTHROW_CONSTRUCTOR_HPP_INCLUDED diff --git a/include/boost/type_traits/has_trivial_constructor.hpp b/include/boost/type_traits/has_trivial_constructor.hpp new file mode 100644 index 0000000..24e581d --- /dev/null +++ b/include/boost/type_traits/has_trivial_constructor.hpp @@ -0,0 +1,39 @@ + +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_TRIVIAL_CONSTRUCTOR_HPP_INCLUDED +#define BOOST_TT_HAS_TRIVIAL_CONSTRUCTOR_HPP_INCLUDED + +#include +#include + +#ifdef BOOST_HAS_TRIVIAL_CONSTRUCTOR +#ifdef BOOST_HAS_SGI_TYPE_TRAITS +#include +#elif defined(__GNUC__) +#include +#ifdef BOOST_INTEL +#include +#endif +#endif +#endif + +namespace boost { + +template struct has_trivial_constructor +#ifdef BOOST_HAS_TRIVIAL_CONSTRUCTOR + : public integral_constant ::value || BOOST_HAS_TRIVIAL_CONSTRUCTOR(T))>{}; +#else + : public integral_constant ::value>{}; +#endif + +template struct has_trivial_default_constructor : public has_trivial_constructor {}; + +} // namespace boost + +#endif // BOOST_TT_HAS_TRIVIAL_CONSTRUCTOR_HPP_INCLUDED diff --git a/include/boost/type_traits/has_virtual_destructor.hpp b/include/boost/type_traits/has_virtual_destructor.hpp new file mode 100644 index 0000000..4b0f383 --- /dev/null +++ b/include/boost/type_traits/has_virtual_destructor.hpp @@ -0,0 +1,26 @@ + +// (C) Copyright John Maddock 2005. +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + + +#ifndef BOOST_TT_HAS_VIRTUAL_DESTRUCTOR_HPP_INCLUDED +#define BOOST_TT_HAS_VIRTUAL_DESTRUCTOR_HPP_INCLUDED + +#include +#include + +namespace boost { + +#ifdef BOOST_HAS_VIRTUAL_DESTRUCTOR + template struct has_virtual_destructor : public integral_constant{}; +#else + template struct has_virtual_destructor : public integral_constant{}; +#endif + +} // namespace boost + +#endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/include/boost/type_traits/make_signed.hpp b/include/boost/type_traits/make_signed.hpp new file mode 100644 index 0000000..0d2d5df --- /dev/null +++ b/include/boost/type_traits/make_signed.hpp @@ -0,0 +1,131 @@ + +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_MAKE_SIGNED_HPP_INCLUDED +#define BOOST_TT_MAKE_SIGNED_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + +template +struct make_signed +{ +private: + BOOST_STATIC_ASSERT_MSG(( ::boost::is_integral::value || ::boost::is_enum::value), "The template argument to make_signed must be an integer or enum type."); + BOOST_STATIC_ASSERT_MSG(!(::boost::is_same::type, bool>::value), "The template argument to make_signed must not be the type bool."); + + typedef typename remove_cv::type t_no_cv; + typedef typename conditional< + (::boost::is_signed::value + && ::boost::is_integral::value + && ! ::boost::is_same::value + && ! ::boost::is_same::value + && ! ::boost::is_same::value), + T, + typename conditional< + (::boost::is_integral::value + && ! ::boost::is_same::value + && ! ::boost::is_same::value + && ! ::boost::is_same::value), + typename conditional< + is_same::value, + signed char, + typename conditional< + is_same::value, + signed short, + typename conditional< + is_same::value, + int, + typename conditional< + is_same::value, + long, +#if defined(BOOST_HAS_LONG_LONG) +#ifdef BOOST_HAS_INT128 + typename conditional< + sizeof(t_no_cv) == sizeof(boost::long_long_type), + boost::long_long_type, + boost::int128_type + >::type +#else + boost::long_long_type +#endif +#elif defined(BOOST_HAS_MS_INT64) + __int64 +#else + long +#endif + >::type + >::type + >::type + >::type, + // Not a regular integer type: + typename conditional< + sizeof(t_no_cv) == sizeof(unsigned char), + signed char, + typename conditional< + sizeof(t_no_cv) == sizeof(unsigned short), + signed short, + typename conditional< + sizeof(t_no_cv) == sizeof(unsigned int), + int, + typename conditional< + sizeof(t_no_cv) == sizeof(unsigned long), + long, +#if defined(BOOST_HAS_LONG_LONG) +#ifdef BOOST_HAS_INT128 + typename conditional< + sizeof(t_no_cv) == sizeof(boost::long_long_type), + boost::long_long_type, + boost::int128_type + >::type +#else + boost::long_long_type +#endif +#elif defined(BOOST_HAS_MS_INT64) + __int64 +#else + long +#endif + >::type + >::type + >::type + >::type + >::type + >::type base_integer_type; + + // Add back any const qualifier: + typedef typename conditional< + is_const::value, + typename add_const::type, + base_integer_type + >::type const_base_integer_type; +public: + // Add back any volatile qualifier: + typedef typename conditional< + is_volatile::value, + typename add_volatile::type, + const_base_integer_type + >::type type; +}; + +} // namespace boost + +#endif // BOOST_TT_ADD_REFERENCE_HPP_INCLUDED + diff --git a/include/boost/type_traits/make_unsigned.hpp b/include/boost/type_traits/make_unsigned.hpp new file mode 100644 index 0000000..4b21eba --- /dev/null +++ b/include/boost/type_traits/make_unsigned.hpp @@ -0,0 +1,130 @@ + +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_MAKE_UNSIGNED_HPP_INCLUDED +#define BOOST_TT_MAKE_UNSIGNED_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + +template +struct make_unsigned +{ +private: + BOOST_STATIC_ASSERT_MSG((::boost::is_integral::value || ::boost::is_enum::value), "The template argument to make_unsigned must be an integer or enum type."); + BOOST_STATIC_ASSERT_MSG((! ::boost::is_same::type, bool>::value), "The template argument to make_unsigned must not be the type bool"); + + typedef typename remove_cv::type t_no_cv; + typedef typename conditional< + (::boost::is_unsigned::value && ::boost::is_integral::value + && ! ::boost::is_same::value + && ! ::boost::is_same::value + && ! ::boost::is_same::value), + T, + typename conditional< + (::boost::is_integral::value + && ! ::boost::is_same::value + && ! ::boost::is_same::value + && ! ::boost::is_same::value), + typename conditional< + is_same::value, + unsigned char, + typename conditional< + is_same::value, + unsigned short, + typename conditional< + is_same::value, + unsigned int, + typename conditional< + is_same::value, + unsigned long, +#if defined(BOOST_HAS_LONG_LONG) +#ifdef BOOST_HAS_INT128 + typename conditional< + sizeof(t_no_cv) == sizeof(boost::ulong_long_type), + boost::ulong_long_type, + boost::uint128_type + >::type +#else + boost::ulong_long_type +#endif +#elif defined(BOOST_HAS_MS_INT64) + unsigned __int64 +#else + unsigned long +#endif + >::type + >::type + >::type + >::type, + // Not a regular integer type: + typename conditional< + sizeof(t_no_cv) == sizeof(unsigned char), + unsigned char, + typename conditional< + sizeof(t_no_cv) == sizeof(unsigned short), + unsigned short, + typename conditional< + sizeof(t_no_cv) == sizeof(unsigned int), + unsigned int, + typename conditional< + sizeof(t_no_cv) == sizeof(unsigned long), + unsigned long, +#if defined(BOOST_HAS_LONG_LONG) +#ifdef BOOST_HAS_INT128 + typename conditional< + sizeof(t_no_cv) == sizeof(boost::ulong_long_type), + boost::ulong_long_type, + boost::uint128_type + >::type +#else + boost::ulong_long_type +#endif +#elif defined(BOOST_HAS_MS_INT64) + unsigned __int64 +#else + unsigned long +#endif + >::type + >::type + >::type + >::type + >::type + >::type base_integer_type; + + // Add back any const qualifier: + typedef typename conditional< + is_const::value, + typename add_const::type, + base_integer_type + >::type const_base_integer_type; +public: + // Add back any volatile qualifier: + typedef typename conditional< + is_volatile::value, + typename add_volatile::type, + const_base_integer_type + >::type type; +}; + +} // namespace boost + +#endif // BOOST_TT_ADD_REFERENCE_HPP_INCLUDED + diff --git a/include/boost/type_traits/object_traits.hpp b/include/boost/type_traits/object_traits.hpp new file mode 100644 index 0000000..c812a62 --- /dev/null +++ b/include/boost/type_traits/object_traits.hpp @@ -0,0 +1,33 @@ +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. +// +// defines object traits classes: +// is_object, is_scalar, is_class, is_compound, is_pod, +// has_trivial_constructor, has_trivial_copy, has_trivial_assign, +// has_trivial_destructor, is_empty. +// + +#ifndef BOOST_TT_OBJECT_TRAITS_HPP_INLCUDED +#define BOOST_TT_OBJECT_TRAITS_HPP_INLCUDED + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // BOOST_TT_OBJECT_TRAITS_HPP_INLCUDED diff --git a/test/has_nothrow_constr_test.cpp b/test/has_nothrow_constr_test.cpp new file mode 100644 index 0000000..4ac8032 --- /dev/null +++ b/test/has_nothrow_constr_test.cpp @@ -0,0 +1,169 @@ + +// (C) Copyright John Maddock 2000. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include "test.hpp" +#include "check_integral_constant.hpp" +#ifdef TEST_STD +# include +#else +# include +#endif + +TT_TEST_BEGIN(has_nothrow_constructor) + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); + +#ifdef BOOST_HAS_LONG_LONG + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor< ::boost::ulong_long_type>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor< ::boost::long_long_type>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor< ::boost::ulong_long_type const>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor< ::boost::long_long_type const>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor< ::boost::ulong_long_type volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor< ::boost::long_long_type volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor< ::boost::ulong_long_type const volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor< ::boost::long_long_type const volatile>::value, true); + +#endif + +#ifdef BOOST_HAS_MS_INT64 + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int8>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int8 const>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int8 volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int8 const volatile>::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int16>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int16 const>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int16 volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int16 const volatile>::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int32>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int32 const>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int32 volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int32 const volatile>::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int64>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int64 const>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int64 volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int64 const volatile>::value, true); + +#endif + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); + + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, false); +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, false); +#endif +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, false); +// cases we would like to succeed but can't implement in the language: +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, false); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, false); + +TT_TEST_END + + + diff --git a/test/has_operator_new_test.cpp b/test/has_operator_new_test.cpp new file mode 100644 index 0000000..22d54c6 --- /dev/null +++ b/test/has_operator_new_test.cpp @@ -0,0 +1,213 @@ +// (C) Copyright John Maddock 2000. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include "test.hpp" +#include "check_integral_constant.hpp" +#include + +#ifdef BOOST_INTEL +// remark #1720: function "class_with_new_op::operator new" has no corresponding member operator delete (to be called if an exception is thrown during initialization of an allocated object) +// void * operator new(std::size_t); +// ^ +#pragma warning(disable:1720) +#endif + +#if defined(new) +# if BOOST_WORKAROUND(BOOST_MSVC, >= 1310) +# define BOOST_TT_AUX_MACRO_NEW_DEFINED +# pragma push_macro("new") +# undef new +# else +# error "Sorry but you can't include this header if 'new' is defined as a macro." +# endif +#endif + + +struct class_with_new_op { + void * operator new(std::size_t); +}; + +struct derived_class_with_new_op : public class_with_new_op {}; + +struct class_with_new_op2 { + void* operator new(std::size_t size, const std::nothrow_t&); +}; + +struct class_with_new_op3 { + void* operator new[](std::size_t size); +}; + +struct class_with_new_op4 { + void* operator new[](std::size_t size, const std::nothrow_t&); +}; + +struct class_with_new_op5 { + void* operator new (std::size_t size, void* ptr); +}; + +struct class_with_new_op6 { + void* operator new[] (std::size_t size, void* ptr); +}; + +struct class_with_all_ops +{ + void * operator new(std::size_t); + void* operator new(std::size_t size, const std::nothrow_t&); + void* operator new[](std::size_t size); + void* operator new[](std::size_t size, const std::nothrow_t&); + void* operator new (std::size_t size, void* ptr); + void* operator new[] (std::size_t size, void* ptr); +}; + +TT_TEST_BEGIN(has_new_operator) + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); + +#ifdef BOOST_HAS_LONG_LONG + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator< ::boost::ulong_long_type>::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator< ::boost::long_long_type>::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator< ::boost::ulong_long_type const>::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator< ::boost::long_long_type const>::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator< ::boost::ulong_long_type volatile>::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator< ::boost::long_long_type volatile>::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator< ::boost::ulong_long_type const volatile>::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator< ::boost::long_long_type const volatile>::value, false); + +#endif + +#ifdef BOOST_HAS_MS_INT64 + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int8>::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int8 const>::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int8 volatile>::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int8 const volatile>::value, false); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int16>::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int16 const>::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int16 volatile>::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int16 const volatile>::value, false); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int32>::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int32 const>::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int32 volatile>::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int32 const volatile>::value, false); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int64>::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int64 const>::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int64 volatile>::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<__int64 const volatile>::value, false); + +#endif + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +#endif +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator::value, false); + +TT_TEST_END diff --git a/test/has_trivial_constr_test.cpp b/test/has_trivial_constr_test.cpp new file mode 100644 index 0000000..e163a6b --- /dev/null +++ b/test/has_trivial_constr_test.cpp @@ -0,0 +1,181 @@ + +// (C) Copyright John Maddock 2000. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include "test.hpp" +#include "check_integral_constant.hpp" +#ifdef TEST_STD +# include +#else +# include +#endif + +TT_TEST_BEGIN(has_trivial_constructor) + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); + +#ifdef BOOST_HAS_LONG_LONG + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor< ::boost::ulong_long_type>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor< ::boost::long_long_type>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor< ::boost::ulong_long_type const>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor< ::boost::long_long_type const>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor< ::boost::ulong_long_type volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor< ::boost::long_long_type volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor< ::boost::ulong_long_type const volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor< ::boost::long_long_type const volatile>::value, true); + +#endif + +#ifdef BOOST_HAS_MS_INT64 + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int8>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int8 const>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int8 volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int8 const volatile>::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int16>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int16 const>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int16 volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int16 const volatile>::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int32>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int32 const>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int32 volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int32 const volatile>::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int64>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int64 const>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int64 volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<__int64 const volatile>::value, true); + +#endif + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); + + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, false); +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, false); +#endif +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true); +// cases we would like to succeed but can't implement in the language: +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true, false); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true, false); +//BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, true, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor >::value, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_constructor >::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_constructor >::value, true, false); +//BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_constructor >::value, true, false); + + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, false); + +TT_TEST_END + + + + + + + + diff --git a/test/has_virtual_destructor_test.cpp b/test/has_virtual_destructor_test.cpp new file mode 100644 index 0000000..5f03ac5 --- /dev/null +++ b/test/has_virtual_destructor_test.cpp @@ -0,0 +1,75 @@ + +// (C) Copyright John Maddock 2005. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include "test.hpp" +#include "check_integral_constant.hpp" +#ifdef TEST_STD +# include +#else +# include +#endif + +#include +#include +#include + +class polymorphic_no_virtual_destructor +{ +public: + virtual void method() = 0; +}; + +TT_TEST_BEGIN(has_virtual_destructor) + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +#endif +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); + +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, true, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, false); +#ifndef BOOST_NO_STD_LOCALE +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor >::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor >::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor >::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor >::value, true, false); +#endif +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor::value, true, false); + +TT_TEST_END + + + + + + + + diff --git a/test/make_signed_test.cpp b/test/make_signed_test.cpp new file mode 100644 index 0000000..cb9da2d --- /dev/null +++ b/test/make_signed_test.cpp @@ -0,0 +1,111 @@ + +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.tt.org/LICENSE_1_0.txt) + +#include "test.hpp" +#include "check_type.hpp" +#include "check_integral_constant.hpp" +#ifdef TEST_STD +# include +#else +# include +#endif + +TT_TEST_BEGIN(make_signed) +// signed types: +BOOST_CHECK_TYPE(::tt::make_signed::type, signed char); +BOOST_CHECK_TYPE(::tt::make_signed::type, short); +BOOST_CHECK_TYPE(::tt::make_signed::type, int); +BOOST_CHECK_TYPE(::tt::make_signed::type, long); +#ifdef BOOST_HAS_LONG_LONG +BOOST_CHECK_TYPE(::tt::make_signed::type, boost::long_long_type); +#elif defined(BOOST_HAS_MS_INT64) +BOOST_CHECK_TYPE(::tt::make_signed<__int64>::type, __int64); +#endif +// const signed types: +BOOST_CHECK_TYPE(::tt::make_signed::type, const signed char); +BOOST_CHECK_TYPE(::tt::make_signed::type, const short); +BOOST_CHECK_TYPE(::tt::make_signed::type, const int); +BOOST_CHECK_TYPE(::tt::make_signed::type, const long); +#ifdef BOOST_HAS_LONG_LONG +BOOST_CHECK_TYPE(::tt::make_signed::type, const boost::long_long_type); +#elif defined(BOOST_HAS_MS_INT64) +BOOST_CHECK_TYPE(::tt::make_signed::type, const __int64); +#endif +// volatile signed types: +BOOST_CHECK_TYPE(::tt::make_signed::type, volatile signed char); +BOOST_CHECK_TYPE(::tt::make_signed::type, volatile short); +BOOST_CHECK_TYPE(::tt::make_signed::type, volatile int); +BOOST_CHECK_TYPE(::tt::make_signed::type, volatile long); +#ifdef BOOST_HAS_LONG_LONG +BOOST_CHECK_TYPE(::tt::make_signed::type, volatile boost::long_long_type); +#elif defined(BOOST_HAS_MS_INT64) +BOOST_CHECK_TYPE(::tt::make_signed::type, volatile __int64); +#endif +// const volatile signed types: +BOOST_CHECK_TYPE(::tt::make_signed::type, const volatile signed char); +BOOST_CHECK_TYPE(::tt::make_signed::type, const volatile short); +BOOST_CHECK_TYPE(::tt::make_signed::type, const volatile int); +BOOST_CHECK_TYPE(::tt::make_signed::type, const volatile long); +#ifdef BOOST_HAS_LONG_LONG +BOOST_CHECK_TYPE(::tt::make_signed::type, const volatile boost::long_long_type); +#elif defined(BOOST_HAS_MS_INT64) +BOOST_CHECK_TYPE(::tt::make_signed::type, const volatile __int64); +#endif + +// unsigned types: +BOOST_CHECK_TYPE(::tt::make_signed::type, signed char); +BOOST_CHECK_TYPE(::tt::make_signed::type, short); +BOOST_CHECK_TYPE(::tt::make_signed::type, int); +BOOST_CHECK_TYPE(::tt::make_signed::type, long); +#ifdef BOOST_HAS_LONG_LONG +BOOST_CHECK_TYPE(::tt::make_signed::type, boost::long_long_type); +#elif defined(BOOST_HAS_MS_INT64) +BOOST_CHECK_TYPE(::tt::make_signed::type, __int64); +#endif +// const unsigned types: +BOOST_CHECK_TYPE(::tt::make_signed::type, const signed char); +BOOST_CHECK_TYPE(::tt::make_signed::type, const short); +BOOST_CHECK_TYPE(::tt::make_signed::type, const int); +BOOST_CHECK_TYPE(::tt::make_signed::type, const long); +#ifdef BOOST_HAS_LONG_LONG +BOOST_CHECK_TYPE(::tt::make_signed::type, const boost::long_long_type); +#elif defined(BOOST_HAS_MS_INT64) +BOOST_CHECK_TYPE(::tt::make_signed::type, const __int64); +#endif +// volatile unsigned types: +BOOST_CHECK_TYPE(::tt::make_signed::type, volatile signed char); +BOOST_CHECK_TYPE(::tt::make_signed::type, volatile short); +BOOST_CHECK_TYPE(::tt::make_signed::type, volatile int); +BOOST_CHECK_TYPE(::tt::make_signed::type, volatile long); +#ifdef BOOST_HAS_LONG_LONG +BOOST_CHECK_TYPE(::tt::make_signed::type, volatile boost::long_long_type); +#elif defined(BOOST_HAS_MS_INT64) +BOOST_CHECK_TYPE(::tt::make_signed::type, volatile __int64); +#endif +// const volatile unsigned types: +BOOST_CHECK_TYPE(::tt::make_signed::type, const volatile signed char); +BOOST_CHECK_TYPE(::tt::make_signed::type, const volatile short); +BOOST_CHECK_TYPE(::tt::make_signed::type, const volatile int); +BOOST_CHECK_TYPE(::tt::make_signed::type, const volatile long); +#ifdef BOOST_HAS_LONG_LONG +BOOST_CHECK_TYPE(::tt::make_signed::type, const volatile boost::long_long_type); +#elif defined(BOOST_HAS_MS_INT64) +BOOST_CHECK_TYPE(::tt::make_signed::type, const volatile __int64); +#endif +#ifdef BOOST_HAS_INT128 +BOOST_CHECK_TYPE(::tt::make_signed::type, boost::int128_type); +BOOST_CHECK_TYPE(::tt::make_signed::type, boost::int128_type); +#endif + +// character types: +BOOST_CHECK_TYPE(::tt::make_signed::type, signed char); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_integral< ::tt::make_signed::type>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed< ::tt::make_signed::type>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_integral< ::tt::make_signed::type>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed< ::tt::make_signed::type>::value, true); +TT_TEST_END + + diff --git a/test/make_unsigned_test.cpp b/test/make_unsigned_test.cpp new file mode 100644 index 0000000..117a8e6 --- /dev/null +++ b/test/make_unsigned_test.cpp @@ -0,0 +1,111 @@ + +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.tt.org/LICENSE_1_0.txt) + +#include "test.hpp" +#include "check_type.hpp" +#include "check_integral_constant.hpp" +#ifdef TEST_STD +# include +#else +# include +#endif + +TT_TEST_BEGIN(make_unsigned) +// signed types: +BOOST_CHECK_TYPE(::tt::make_unsigned::type, unsigned char); +BOOST_CHECK_TYPE(::tt::make_unsigned::type, unsigned short); +BOOST_CHECK_TYPE(::tt::make_unsigned::type, unsigned int); +BOOST_CHECK_TYPE(::tt::make_unsigned::type, unsigned long); +#ifdef BOOST_HAS_LONG_LONG +BOOST_CHECK_TYPE(::tt::make_unsigned::type, boost::ulong_long_type); +#elif defined(BOOST_HAS_MS_INT64) +BOOST_CHECK_TYPE(::tt::make_unsigned<__int64>::type, unsigned __int64); +#endif +// const signed types: +BOOST_CHECK_TYPE(::tt::make_unsigned::type, const unsigned char); +BOOST_CHECK_TYPE(::tt::make_unsigned::type, const unsigned short); +BOOST_CHECK_TYPE(::tt::make_unsigned::type, const unsigned int); +BOOST_CHECK_TYPE(::tt::make_unsigned::type, const unsigned long); +#ifdef BOOST_HAS_LONG_LONG +BOOST_CHECK_TYPE(::tt::make_unsigned::type, const boost::ulong_long_type); +#elif defined(BOOST_HAS_MS_INT64) +BOOST_CHECK_TYPE(::tt::make_unsigned::type, const unsigned __int64); +#endif +// volatile signed types: +BOOST_CHECK_TYPE(::tt::make_unsigned::type, volatile unsigned char); +BOOST_CHECK_TYPE(::tt::make_unsigned::type, volatile unsigned short); +BOOST_CHECK_TYPE(::tt::make_unsigned::type, volatile unsigned int); +BOOST_CHECK_TYPE(::tt::make_unsigned::type, volatile unsigned long); +#ifdef BOOST_HAS_LONG_LONG +BOOST_CHECK_TYPE(::tt::make_unsigned::type, volatile boost::ulong_long_type); +#elif defined(BOOST_HAS_MS_INT64) +BOOST_CHECK_TYPE(::tt::make_unsigned::type, volatile unsigned __int64); +#endif +// const volatile signed types: +BOOST_CHECK_TYPE(::tt::make_unsigned::type, const volatile unsigned char); +BOOST_CHECK_TYPE(::tt::make_unsigned::type, const volatile unsigned short); +BOOST_CHECK_TYPE(::tt::make_unsigned::type, const volatile unsigned int); +BOOST_CHECK_TYPE(::tt::make_unsigned::type, const volatile unsigned long); +#ifdef BOOST_HAS_LONG_LONG +BOOST_CHECK_TYPE(::tt::make_unsigned::type, const volatile boost::ulong_long_type); +#elif defined(BOOST_HAS_MS_INT64) +BOOST_CHECK_TYPE(::tt::make_unsigned::type, const volatile unsigned __int64); +#endif + +// unsigned types: +BOOST_CHECK_TYPE(::tt::make_unsigned::type, unsigned char); +BOOST_CHECK_TYPE(::tt::make_unsigned::type, unsigned short); +BOOST_CHECK_TYPE(::tt::make_unsigned::type, unsigned int); +BOOST_CHECK_TYPE(::tt::make_unsigned::type, unsigned long); +#ifdef BOOST_HAS_LONG_LONG +BOOST_CHECK_TYPE(::tt::make_unsigned::type, boost::ulong_long_type); +#elif defined(BOOST_HAS_MS_INT64) +BOOST_CHECK_TYPE(::tt::make_unsigned::type, unsigned __int64); +#endif +// const unsigned types: +BOOST_CHECK_TYPE(::tt::make_unsigned::type, const unsigned char); +BOOST_CHECK_TYPE(::tt::make_unsigned::type, const unsigned short); +BOOST_CHECK_TYPE(::tt::make_unsigned::type, const unsigned int); +BOOST_CHECK_TYPE(::tt::make_unsigned::type, const unsigned long); +#ifdef BOOST_HAS_LONG_LONG +BOOST_CHECK_TYPE(::tt::make_unsigned::type, const boost::ulong_long_type); +#elif defined(BOOST_HAS_MS_INT64) +BOOST_CHECK_TYPE(::tt::make_unsigned::type, const unsigned __int64); +#endif +// volatile unsigned types: +BOOST_CHECK_TYPE(::tt::make_unsigned::type, volatile unsigned char); +BOOST_CHECK_TYPE(::tt::make_unsigned::type, volatile unsigned short); +BOOST_CHECK_TYPE(::tt::make_unsigned::type, volatile unsigned int); +BOOST_CHECK_TYPE(::tt::make_unsigned::type, volatile unsigned long); +#ifdef BOOST_HAS_LONG_LONG +BOOST_CHECK_TYPE(::tt::make_unsigned::type, volatile boost::ulong_long_type); +#elif defined(BOOST_HAS_MS_INT64) +BOOST_CHECK_TYPE(::tt::make_unsigned::type, volatile unsigned __int64); +#endif +// const volatile unsigned types: +BOOST_CHECK_TYPE(::tt::make_unsigned::type, const volatile unsigned char); +BOOST_CHECK_TYPE(::tt::make_unsigned::type, const volatile unsigned short); +BOOST_CHECK_TYPE(::tt::make_unsigned::type, const volatile unsigned int); +BOOST_CHECK_TYPE(::tt::make_unsigned::type, const volatile unsigned long); +#ifdef BOOST_HAS_LONG_LONG +BOOST_CHECK_TYPE(::tt::make_unsigned::type, const volatile boost::ulong_long_type); +#elif defined(BOOST_HAS_MS_INT64) +BOOST_CHECK_TYPE(::tt::make_unsigned::type, const volatile unsigned __int64); +#endif +#ifdef BOOST_HAS_INT128 +BOOST_CHECK_TYPE(::tt::make_unsigned::type, boost::uint128_type); +BOOST_CHECK_TYPE(::tt::make_unsigned::type, boost::uint128_type); +#endif + +// character types: +BOOST_CHECK_TYPE(::tt::make_unsigned::type, unsigned char); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_integral< ::tt::make_unsigned::type>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned< ::tt::make_unsigned::type>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_integral< ::tt::make_unsigned::type>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned< ::tt::make_unsigned::type>::value, true); +TT_TEST_END + +