From 4a16185e276f79ad30e09cc4541440eccc7f6813 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Mon, 8 Jun 2015 19:19:08 +0100 Subject: [PATCH 01/51] Improve is_constructible. Add is_destructible. Add tests. --- .../boost/type_traits/is_constructible.hpp | 17 +++- include/boost/type_traits/is_destructible.hpp | 49 ++++++++++++ test/is_constructible_test.cpp | 79 +++++++++++++++++++ 3 files changed, 143 insertions(+), 2 deletions(-) create mode 100644 include/boost/type_traits/is_destructible.hpp create mode 100644 test/is_constructible_test.cpp diff --git a/include/boost/type_traits/is_constructible.hpp b/include/boost/type_traits/is_constructible.hpp index 0361012..d1accc1 100644 --- a/include/boost/type_traits/is_constructible.hpp +++ b/include/boost/type_traits/is_constructible.hpp @@ -14,6 +14,7 @@ #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) +#include #include #include @@ -25,14 +26,26 @@ namespace boost{ { template()...))> static boost::type_traits::yes_type test(int); - - template + template static boost::type_traits::no_type test(...); + + template()))> + static boost::type_traits::yes_type test1(int); + template + static boost::type_traits::no_type test1(...); + + template + static boost::type_traits::yes_type ref_test(T); + template + static boost::type_traits::no_type ref_test(...); }; } template struct is_constructible : public integral_constant(0)) == sizeof(boost::type_traits::yes_type)>{}; + template struct is_constructible : public integral_constant::value && sizeof(detail::is_constructible_imp::test1(0)) == sizeof(boost::type_traits::yes_type)>{}; + template struct is_constructible : public integral_constant(detail::tt_declval())) == sizeof(boost::type_traits::yes_type)>{}; + template struct is_constructible : public integral_constant(detail::tt_declval())) == sizeof(boost::type_traits::yes_type)>{}; #else diff --git a/include/boost/type_traits/is_destructible.hpp b/include/boost/type_traits/is_destructible.hpp new file mode 100644 index 0000000..fe421d9 --- /dev/null +++ b/include/boost/type_traits/is_destructible.hpp @@ -0,0 +1,49 @@ + +// (C) Copyright John Maddock 2015. +// 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_IS_DESTRUCTIBLE_HPP_INCLUDED +#define BOOST_TT_IS_DESTRUCTIBLE_HPP_INCLUDED + +#include +#include + +#if !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) + +#include +#include + +namespace boost{ + + namespace detail{ + + struct is_destructible_imp + { + template().~T())> + static boost::type_traits::yes_type test(int); + template + static boost::type_traits::no_type test(...); + }; + + } + + template struct is_destructible : public integral_constant(0)) == sizeof(boost::type_traits::yes_type)>{}; + +#else + +#include +#include + +namespace boost{ + + // We don't know how to implement this: + template struct is_destructible : public integral_constant::value || is_class::value>{}; +#endif + +} // namespace boost + +#endif // BOOST_TT_IS_DESTRUCTIBLE_HPP_INCLUDED diff --git a/test/is_constructible_test.cpp b/test/is_constructible_test.cpp new file mode 100644 index 0000000..8bcd7ab --- /dev/null +++ b/test/is_constructible_test.cpp @@ -0,0 +1,79 @@ + +// (C) Copyright John Maddock 2000. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include "test.hpp" +#include "check_integral_constant.hpp" +#ifdef TEST_STD +# include +#else +# include +#endif + + +struct non_copy_constructible +{ + non_copy_constructible(); + non_copy_constructible(int); + non_copy_constructible(double*, double*); +#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS + non_copy_constructible(const non_copy_constructible&) = delete; +#endif +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + non_copy_constructible(non_copy_constructible&&); +#endif +}; + + +struct A { }; +struct B : A { }; + +TT_TEST_BEGIN(is_constructible) + +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible::value) , false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible::value) , false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible::value) , false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible::value) , false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible::value) , false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible::value) , false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible::value) , false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible::value) , false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible::value) , false); +#endif +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible::value), false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible::value), false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible::value), false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible::value), false); + +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT((::tt::is_constructible::value), true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT((::tt::is_constructible::value), true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT((::tt::is_constructible::value), true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT((::tt::is_constructible::value), true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT((::tt::is_constructible::value), true, false); +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT((::tt::is_constructible::value), true, false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible::value), false); +#endif +#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible::value), false); +#endif + +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible::value), true); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible::value), true); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible::value), false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible::value), false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible::value), true); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible::value), true); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible::value), true); + +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible::value), false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible::value), true); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible::value), true); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible::value), false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible::value), false); + +TT_TEST_END + From b21b0f04769f3083c9a4a8639170f0b800b2df3e Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Tue, 9 Jun 2015 18:48:46 +0100 Subject: [PATCH 02/51] Fix test case: arrays are not explicitly copyable --- doc/has_nothrow_copy.qbk | 15 ++++-------- .../boost/type_traits/has_nothrow_copy.hpp | 23 +++++++++++++++++++ .../boost/type_traits/has_trivial_copy.hpp | 22 +++++------------- test/has_nothrow_copy_test.cpp | 11 +++++---- test/has_trivial_copy_test.cpp | 7 +++--- 5 files changed, 45 insertions(+), 33 deletions(-) diff --git a/doc/has_nothrow_copy.qbk b/doc/has_nothrow_copy.qbk index c00a5a3..28c251e 100644 --- a/doc/has_nothrow_copy.qbk +++ b/doc/has_nothrow_copy.qbk @@ -19,16 +19,11 @@ must be a complete type. These two traits are synonyms for each other. -__compat If the compiler does not support partial-specialization of class -templates, then this template can not be used with function types. - -Without some (as yet unspecified) help from the compiler, -`has_nothrow_copy` will never report that a class or struct has a -non-throwing copy-constructor; this is always safe, if possibly sub-optimal. -Currently (May 2011) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0, -Intel-11.0, and Codegear have the necessary compiler __intrinsics to ensure that this -trait "just works". You may also test to see if the necessary __intrinsics are available -by checking to see if the macro `BOOST_HAS_NOTHROW_COPY` is defined. +__compat Either requires C++11 `noexcept` and `decltype` or else some (unspecified) help from the compiler. +Currently (June 2015) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0, +Intel-11.0, and Codegear and all recent GCC versions have the necessary compiler __intrinsics to ensure that this +trait "just works". You may test to see if the necessary support is available +by checking to see if `defined(BOOST_HAS_NOTHROW_COPY) || (!defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_CXX11_NOEXCEPT))` is true. __header ` #include ` or ` #include ` diff --git a/include/boost/type_traits/has_nothrow_copy.hpp b/include/boost/type_traits/has_nothrow_copy.hpp index bbfcb1d..1d4ae0e 100644 --- a/include/boost/type_traits/has_nothrow_copy.hpp +++ b/include/boost/type_traits/has_nothrow_copy.hpp @@ -16,18 +16,41 @@ #if defined(BOOST_CLANG) || defined(__GNUC__) || defined(__ghs__) || defined(__CODEGEARC__) #include +#include #include #ifdef BOOST_INTEL #include #endif #elif defined(BOOST_MSVC) || defined(BOOST_INTEL) #include +#include #endif namespace boost { template struct has_nothrow_copy_constructor : public integral_constant{}; +#elif !defined(BOOST_NO_CXX11_NOEXCEPT) + +#include +#include + +namespace boost{ + +namespace detail{ + +template +struct has_nothrow_copy_constructor_imp : public boost::integral_constant{}; +template +struct has_nothrow_copy_constructor_imp : public boost::integral_constant()))>{}; + +} + +template struct has_nothrow_copy_constructor : public detail::has_nothrow_copy_constructor_imp::value>{}; +template struct has_nothrow_copy_constructor : public integral_constant{}; +template struct has_nothrow_copy_constructor : public integral_constant{}; +template struct has_nothrow_copy_constructor : public integral_constant{}; + #else #include diff --git a/include/boost/type_traits/has_trivial_copy.hpp b/include/boost/type_traits/has_trivial_copy.hpp index 95bf159..c717f1d 100644 --- a/include/boost/type_traits/has_trivial_copy.hpp +++ b/include/boost/type_traits/has_trivial_copy.hpp @@ -10,35 +10,25 @@ #define BOOST_TT_HAS_TRIVIAL_COPY_HPP_INCLUDED #include -#include #include #include - -#ifdef __clang__ #include -#endif namespace boost { template struct has_trivial_copy : public integral_constant::value -# else - BOOST_HAS_TRIVIAL_COPY(T) -# endif #else - ::boost::is_pod::value && ! ::boost::is_volatile::value + ::boost::is_pod::value #endif >{}; - -#ifdef __clang__ - -template -struct has_trivial_copy : public has_trivial_copy{}; - -#endif +// Arrays are not explicitly copyable: +template struct has_trivial_copy : public false_type{}; +template struct has_trivial_copy : public false_type{}; +// Are volatile types ever trivial? We don't really know, so assume not: +template struct has_trivial_copy : public false_type{}; template <> struct has_trivial_copy : public false_type{}; #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS diff --git a/test/has_nothrow_copy_test.cpp b/test/has_nothrow_copy_test.cpp index befbb1d..a389abd 100644 --- a/test/has_nothrow_copy_test.cpp +++ b/test/has_nothrow_copy_test.cpp @@ -212,9 +212,10 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy::value, false); #endif BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy::value, false); -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy::value, true); -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy::value, true); -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy::value, true); +// These used to be true, but are now false to match std conforming behavior: +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy::value, false); // cases we would like to succeed but can't implement in the language: @@ -236,8 +237,10 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy::value, false) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy::value, true); #endif +#if !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy::value, false); - +#endif + TT_TEST_END diff --git a/test/has_trivial_copy_test.cpp b/test/has_trivial_copy_test.cpp index 9a0a042..6a803b8 100644 --- a/test/has_trivial_copy_test.cpp +++ b/test/has_trivial_copy_test.cpp @@ -194,9 +194,10 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy::value, false); #endif BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy::value, false); -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy::value, true); -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy::value, true); -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy::value, true); +// Arrays can not be explicitly copied: +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy::value, false); // cases we would like to succeed but can't implement in the language: From 05e1b3b7a5ef7f9f5a52515cb0795bbf5974c36e Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Tue, 9 Jun 2015 18:51:04 +0100 Subject: [PATCH 03/51] Reduce trivial copy dependencies. --- include/boost/type_traits/intrinsics.hpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/boost/type_traits/intrinsics.hpp b/include/boost/type_traits/intrinsics.hpp index 2d85f8b..3a90608 100644 --- a/include/boost/type_traits/intrinsics.hpp +++ b/include/boost/type_traits/intrinsics.hpp @@ -99,11 +99,11 @@ # define BOOST_IS_POD(T) (__is_pod(T) && __has_trivial_constructor(T)) # define BOOST_IS_EMPTY(T) __is_empty(T) # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T) -# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T)|| ( ::boost::is_pod::value && !::boost::is_volatile::value)) +# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) || ::boost::is_pod::value) # define BOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) || ( ::boost::is_pod::value && ! ::boost::is_const::value && !::boost::is_volatile::value)) # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) || ::boost::is_pod::value) # define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_constructor(T) || ::boost::has_trivial_constructor::value) -# define BOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T) || ::boost::has_trivial_copy::value) +# define BOOST_HAS_NOTHROW_COPY(T) ((__has_nothrow_copy(T) || ::boost::has_trivial_copy::value) && !is_array::value) # define BOOST_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) || ::boost::has_trivial_assign::value) # define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T) @@ -171,7 +171,7 @@ # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T) # endif # if __has_feature(has_trivial_copy) -# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) && !is_reference::value && !is_volatile::value) +# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) && !is_reference::value) # endif # if __has_feature(has_trivial_assign) # define BOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) && !is_volatile::value) @@ -240,11 +240,11 @@ # define BOOST_IS_POD(T) __is_pod(T) # define BOOST_IS_EMPTY(T) __is_empty(T) # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) ((__has_trivial_constructor(T) BOOST_INTEL_TT_OPTS) && ! ::boost::is_volatile::value) -# define BOOST_HAS_TRIVIAL_COPY(T) ((__has_trivial_copy(T) BOOST_INTEL_TT_OPTS) && !is_reference::value && ! ::boost::is_volatile::value) +# define BOOST_HAS_TRIVIAL_COPY(T) ((__has_trivial_copy(T) BOOST_INTEL_TT_OPTS) && !is_reference::value) # define BOOST_HAS_TRIVIAL_ASSIGN(T) ((__has_trivial_assign(T) BOOST_INTEL_TT_OPTS) && ! ::boost::is_volatile::value && ! ::boost::is_const::value) # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) BOOST_INTEL_TT_OPTS) # define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_constructor(T) && is_default_constructible::value BOOST_INTEL_TT_OPTS) -# define BOOST_HAS_NOTHROW_COPY(T) ((__has_nothrow_copy(T) BOOST_INTEL_TT_OPTS) && !is_volatile::value && !is_reference::value) +# define BOOST_HAS_NOTHROW_COPY(T) ((__has_nothrow_copy(T) BOOST_INTEL_TT_OPTS) && !is_volatile::value && !is_reference::value && is_constructible::value) # define BOOST_HAS_NOTHROW_ASSIGN(T) ((__has_nothrow_assign(T) BOOST_INTEL_TT_OPTS) && !is_volatile::value && !is_const::value && is_assignable::value) # define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T) @@ -275,7 +275,7 @@ # define BOOST_IS_POD(T) __oracle_is_pod(T) # define BOOST_IS_EMPTY(T) __oracle_is_empty(T) # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) (__oracle_has_trivial_constructor(T) && ! ::boost::is_volatile::value) -# define BOOST_HAS_TRIVIAL_COPY(T) (__oracle_has_trivial_copy(T) && !is_reference::value && ! ::boost::is_volatile::value) +# define BOOST_HAS_TRIVIAL_COPY(T) (__oracle_has_trivial_copy(T) && !is_reference::value) # define BOOST_HAS_TRIVIAL_ASSIGN(T) ((__oracle_has_trivial_assign(T) || __oracle_is_trivial(T)) && ! ::boost::is_volatile::value && ! ::boost::is_const::value) # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) __oracle_has_trivial_destructor(T) # define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) ((__oracle_has_nothrow_constructor(T) || __oracle_has_trivial_constructor(T) || __oracle_is_trivial(T)) && is_default_constructible::value) @@ -303,7 +303,7 @@ # define BOOST_IS_POD(T) __is_pod(T) # define BOOST_IS_EMPTY(T) __is_empty(T) # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T) -# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) && !is_reference::value && !is_volatile::value) +# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) && !is_reference::value) # define BOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) && !is_volatile::value) # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T) # define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) __has_nothrow_constructor(T) @@ -330,7 +330,7 @@ # define BOOST_IS_POD(T) __is_pod(T) # define BOOST_IS_EMPTY(T) __is_empty(T) # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) (__has_trivial_default_constructor(T)) -# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy_constructor(T) && !is_volatile::value && !is_reference::value) +# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy_constructor(T) && !is_reference::value) # define BOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) && !is_volatile::value) # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T)) # define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_default_constructor(T)) From 4777c0b4a6c823b1d907b05525ce7dac6f95a05a Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Tue, 9 Jun 2015 18:51:46 +0100 Subject: [PATCH 04/51] Fix has_nothrow_destructor so it actually works. Add tests for it. --- .../type_traits/has_nothrow_destructor.hpp | 26 +++ test/has_nothrow_destructor_test.cpp | 219 ++++++++++++++++++ 2 files changed, 245 insertions(+) create mode 100644 test/has_nothrow_destructor_test.cpp diff --git a/include/boost/type_traits/has_nothrow_destructor.hpp b/include/boost/type_traits/has_nothrow_destructor.hpp index e510ece..a3cf832 100644 --- a/include/boost/type_traits/has_nothrow_destructor.hpp +++ b/include/boost/type_traits/has_nothrow_destructor.hpp @@ -11,10 +11,36 @@ #include +#if !defined(BOOST_NO_CXX11_NOEXCEPT) + +#include +#include + +namespace boost{ + + namespace detail{ + + template + struct has_nothrow_destructor_imp : public boost::integral_constant{}; + template + struct has_nothrow_destructor_imp : public boost::integral_constant()->~T())>{}; + + } + + template struct has_nothrow_destructor : public detail::has_nothrow_destructor_imp::value>{}; + template struct has_nothrow_destructor : public has_nothrow_destructor{}; + template struct has_nothrow_destructor : public integral_constant{}; + template struct has_nothrow_destructor : public integral_constant{}; + +} +#else + namespace boost { template struct has_nothrow_destructor : public ::boost::has_trivial_destructor {}; } // namespace boost +#endif + #endif // BOOST_TT_HAS_NOTHROW_DESTRUCTOR_HPP_INCLUDED diff --git a/test/has_nothrow_destructor_test.cpp b/test/has_nothrow_destructor_test.cpp new file mode 100644 index 0000000..74f31bf --- /dev/null +++ b/test/has_nothrow_destructor_test.cpp @@ -0,0 +1,219 @@ + +// (C) Copyright John Maddock 2000. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include "test.hpp" +#include "check_integral_constant.hpp" +#ifdef TEST_STD +# include +#else +# include +#endif + +#ifdef BOOST_MSVC +#pragma warning(disable:4290) // exception spec ignored +#endif + +struct nothrow_destruct +{ + nothrow_destruct(int); + ~nothrow_destruct()throw(); +}; + +#if !defined(BOOST_NO_CXX11_NOEXCEPT) + +struct noexcept_destruct +{ + noexcept_destruct(int); + ~noexcept_destruct()noexcept; +}; + +#endif + +struct throwing_base +{ + ~throwing_base() throw(int); +}; + +struct throwing_derived : public throwing_base {}; + +struct throwing_contained{ throwing_base data; }; + +TT_TEST_BEGIN(has_nothrow_destructor) + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); + +#ifdef BOOST_HAS_LONG_LONG + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor< ::boost::ulong_long_type>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor< ::boost::long_long_type>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor< ::boost::ulong_long_type const>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor< ::boost::long_long_type const>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor< ::boost::ulong_long_type volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor< ::boost::long_long_type volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor< ::boost::ulong_long_type const volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor< ::boost::long_long_type const volatile>::value, true); + +#endif + +#ifdef BOOST_HAS_MS_INT64 + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int8>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int8 const>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int8 volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int8 const volatile>::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int16>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int16 const>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int16 volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int16 const volatile>::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int32>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int32 const>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int32 volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int32 const volatile>::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int64>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int64 const>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int64 volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor<__int64 const volatile>::value, true); + +#endif + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); + + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_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_nothrow_destructor::value, false); +//BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, false); +// +// Destructors on UDT's are non-throwing by default, unless they are explicity marked otherwise: +// +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, false); +// cases we would like to succeed but can't implement in the language: +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true, false); + +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor >::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor >::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor >::value, true, false); +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor >::value, true, false); + +#if !defined(BOOST_NO_CXX11_NOEXCEPT) + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, true); + +#endif + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_destructor::value, false); + +TT_TEST_END + + + From c1d885edbd25859f5c6f6ddcab7f60a29803097b Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Tue, 9 Jun 2015 18:52:17 +0100 Subject: [PATCH 05/51] Test nothrow_copy in no-intrinsics mode. --- test/Jamfile.v2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index f24698a..2b6928e 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -29,7 +29,7 @@ rule all-tests { { result += [ run $(source) ] ; } - for local source in has_nothrow_assign_test has_nothrow_constr_test + for local source in has_nothrow_assign_test has_nothrow_constr_test has_nothrow_copy_test { result += [ run $(source).cpp : : : BOOST_TT_DISABLE_INTRINSICS : $(source)_no_intrinsics ] ; } From ade5857d786cb356852030ba45bda8dbee075525 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Tue, 9 Jun 2015 19:33:07 +0100 Subject: [PATCH 06/51] Clang intrinsic needs to be filtered through is_constructible. --- include/boost/type_traits/intrinsics.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/type_traits/intrinsics.hpp b/include/boost/type_traits/intrinsics.hpp index 3a90608..fa4f92f 100644 --- a/include/boost/type_traits/intrinsics.hpp +++ b/include/boost/type_traits/intrinsics.hpp @@ -183,7 +183,7 @@ # define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) __has_nothrow_constructor(T) # endif # if __has_feature(has_nothrow_copy) -# define BOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T) && !is_volatile::value && !is_reference::value) +# define BOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T) && !is_volatile::value && !is_reference::value && is_constructible::value) # endif # if __has_feature(has_nothrow_assign) # define BOOST_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) && !is_volatile::value) From 79942e93cdd91d9e69dac454665bcac2039f1b00 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Tue, 9 Jun 2015 19:38:05 +0100 Subject: [PATCH 07/51] More intrinsics corrections for clang --- include/boost/type_traits/intrinsics.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/type_traits/intrinsics.hpp b/include/boost/type_traits/intrinsics.hpp index fa4f92f..72095dc 100644 --- a/include/boost/type_traits/intrinsics.hpp +++ b/include/boost/type_traits/intrinsics.hpp @@ -180,13 +180,13 @@ # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T) # endif # if __has_feature(has_nothrow_constructor) -# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) __has_nothrow_constructor(T) +# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_constructor(T) && is_default_constructible::value) # endif # if __has_feature(has_nothrow_copy) # define BOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T) && !is_volatile::value && !is_reference::value && is_constructible::value) # endif # if __has_feature(has_nothrow_assign) -# define BOOST_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) && !is_volatile::value) +# define BOOST_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) && !is_volatile::value && is_assignable::value) # endif # if __has_feature(has_virtual_destructor) # define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T) From c0ca135b784dcf53d88bdf39ce659d01d3c932d4 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Wed, 10 Jun 2015 17:10:41 +0100 Subject: [PATCH 08/51] Add docs for undocumented has_nothrow_destructor trait. --- doc/has_nothrow_destruct.qbk | 29 +++++++++++++++++++++++++++++ doc/type_traits.qbk | 2 ++ doc/value_traits.qbk | 3 +++ 3 files changed, 34 insertions(+) create mode 100644 doc/has_nothrow_destruct.qbk diff --git a/doc/has_nothrow_destruct.qbk b/doc/has_nothrow_destruct.qbk new file mode 100644 index 0000000..3d865c1 --- /dev/null +++ b/doc/has_nothrow_destruct.qbk @@ -0,0 +1,29 @@ +[/ + Copyright 2015 John Maddock. + Distributed under 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). +] + +[section:has_nothrow_destruct has_nothrow_destructor] + + template + struct has_nothrow_destructor : public __tof {}; + +__inherit If T is a (possibly cv-qualified) type with a non-throwing destructor +then inherits from __true_type, otherwise inherits from __false_type. Type `T` +must be a complete type. + +__compat Either requires C++11 `noexcept` and `decltype` or else some (unspecified) help from the compiler. +You may test to see if the necessary support is available +by checking to see if `!defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_CXX11_NOEXCEPT)` is true. + +__header ` #include ` or ` #include ` + +[note +Note that destructors are assumed to be non-throwing unless they are explicitly marked otherwise with a `throw(something)` specification. +This is in line with the C++11 standard. +] + +[endsect] + diff --git a/doc/type_traits.qbk b/doc/type_traits.qbk index 60613d1..3c3a28d 100644 --- a/doc/type_traits.qbk +++ b/doc/type_traits.qbk @@ -92,6 +92,7 @@ [def __has_nothrow_copy [link boost_typetraits.reference.has_nothrow_copy has_nothrow_copy]] [def __has_nothrow_default_constructor [link boost_typetraits.reference.has_nothrow_constructor has_nothrow_default_constructor]] [def __has_nothrow_copy_constructor [link boost_typetraits.reference.has_nothrow_copy has_nothrow_copy_constructor]] +[def __has_nothrow_destructor [link boost_typetraits.reference.has_nothrow_destruct has_nothrow_destructor]] [def __is_nothrow_move_constructible [link boost_typetraits.reference.is_nothrow_move_constructible is_nothrow_move_constructible]] [def __has_nothrow_assign [link boost_typetraits.reference.has_nothrow_assign has_nothrow_assign]] [def __is_nothrow_move_assignable [link boost_typetraits.reference.is_nothrow_move_assignable is_nothrow_move_assignable]] @@ -231,6 +232,7 @@ that is the result of the transformation. [include has_nothrow_assign.qbk] [include has_nothrow_constructor.qbk] [include has_nothrow_copy.qbk] +[include has_nothrow_destruct.qbk] [section:has_nothrow_cp_cons has_nothrow_copy_constructor] See __has_nothrow_copy. [endsect] diff --git a/doc/value_traits.qbk b/doc/value_traits.qbk index e3b6c85..c782cdd 100644 --- a/doc/value_traits.qbk +++ b/doc/value_traits.qbk @@ -126,6 +126,9 @@ The following templates describe the general properties of a type. template struct __has_nothrow_copy_constructor; + template + struct __has_nothrow_destructor; + template struct __has_trivial_assign; From 1dfcdd7bb279f9b601830949d53f4dc2cdce3a9b Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Thu, 11 Jun 2015 09:57:56 +0100 Subject: [PATCH 09/51] Bring more docs up to date. --- doc/has_trivial_assign.qbk | 11 +++++------ doc/has_trivial_constructor.qbk | 9 ++++----- doc/has_trivial_copy.qbk | 9 ++++----- doc/has_trivial_destructor.qbk | 9 ++++----- doc/has_trivial_move_assign.qbk | 14 +++++++------- doc/has_trivial_move_constructor.qbk | 12 ++++++------ 6 files changed, 30 insertions(+), 34 deletions(-) diff --git a/doc/has_trivial_assign.qbk b/doc/has_trivial_assign.qbk index 5ecfc0e..30fa560 100644 --- a/doc/has_trivial_assign.qbk +++ b/doc/has_trivial_assign.qbk @@ -16,13 +16,12 @@ If a type has a trivial assignment-operator then the operator has the same effec as copying the bits of one object to the other: calls to the operator can be safely replaced with a call to `memcpy`. -__compat If the compiler does not support partial-specialization of class -templates, then this template can not be used with function types. - -Without some (as yet unspecified) help from the compiler, +__compat Without some (as yet unspecified) help from the compiler, has_trivial_assign will never report that a user-defined class or struct has a -trivial constructor; this is always safe, if possibly sub-optimal. -Currently (May 2011) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0, +trivial constructor; this is always safe, if possibly sub-optimal. In order to +correctly handle deleted or private assignment operators, the compiler must also +support C++11's `decltype`. +Currently (May 2015) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0, Intel-11.0, and Codegear have the necessary compiler __intrinsics to ensure that this trait "just works". You may also test to see if the necessary __intrinsics are available by checking to see if the macro `BOOST_HAS_TRIVIAL_ASSIGN` is defined. diff --git a/doc/has_trivial_constructor.qbk b/doc/has_trivial_constructor.qbk index 6bf7529..cf964c4 100644 --- a/doc/has_trivial_constructor.qbk +++ b/doc/has_trivial_constructor.qbk @@ -24,13 +24,12 @@ to omit a call to a single trivial-constructor call is of no benefit whatsoever. However, if loops and/or exception handling code can also be omitted, then some benefit in terms of code size and speed can be obtained. -__compat If the compiler does not support partial-specialization of class -templates, then this template can not be used with function types. - -Without some (as yet unspecified) help from the compiler, +__compat Without some (as yet unspecified) help from the compiler, has_trivial_constructor will never report that a user-defined class or struct has a trivial constructor; this is always safe, if possibly sub-optimal. -Currently (May 2011) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0, +In addition, in order to correctly handle private or deleted default-constructors then +C++11's `deltype` is required. +Currently (May 2015) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0, Intel-11.0, and Codegear have the necessary compiler __intrinsics to ensure that this trait "just works". You may also test to see if the necessary __intrinsics are available by checking to see if the macro `BOOST_HAS_TRIVIAL_CONSTRUCTOR` is defined. diff --git a/doc/has_trivial_copy.qbk b/doc/has_trivial_copy.qbk index 42019e4..084374b 100644 --- a/doc/has_trivial_copy.qbk +++ b/doc/has_trivial_copy.qbk @@ -22,13 +22,12 @@ If a type has a trivial copy-constructor then the constructor has the same effec as copying the bits of one object to the other: calls to the constructor can be safely replaced with a call to `memcpy`. -__compat If the compiler does not support partial-specialization of class -templates, then this template can not be used with function types. - -Without some (as yet unspecified) help from the compiler, +__compat Without some (as yet unspecified) help from the compiler, has_trivial_copy will never report that a user-defined class or struct has a trivial constructor; this is always safe, if possibly sub-optimal. -Currently (May 2011) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0, +In addition, in order to correctly handle deleted or private copy-constructors +then C++11's `dectype` is required. +Currently (May 2015) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0, Intel-11.0, and Codegear have the necessary compiler __intrinsics to ensure that this trait "just works". You may also test to see if the necessary __intrinsics are available by checking to see if the macro `BOOST_HAS_TRIVIAL_COPY` is defined. diff --git a/doc/has_trivial_destructor.qbk b/doc/has_trivial_destructor.qbk index 166c092..051edf3 100644 --- a/doc/has_trivial_destructor.qbk +++ b/doc/has_trivial_destructor.qbk @@ -18,13 +18,12 @@ to omit a call to a single trivial-constructor call is of no benefit whatsoever. However, if loops and/or exception handling code can also be omitted, then some benefit in terms of code size and speed can be obtained. -__compat If the compiler does not support partial-specialization of class -templates, then this template can not be used with function types. - -Without some (as yet unspecified) help from the compiler, +__compat Without some (as yet unspecified) help from the compiler, has_trivial_destructor will never report that a user-defined class or struct has a trivial destructor; this is always safe, if possibly sub-optimal. -Currently (May 2011) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0, +In addition, in order to correctly handle deleted or private destructors then +support for C++11's `decltype` is required. +Currently (June 2015) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0, Intel-11.0, and Codegear have the necessary compiler __intrinsics to ensure that this trait "just works". You may also test to see if the necessary __intrinsics are available by checking to see if the macro `BOOST_HAS_TRIVIAL_DESTRUCTOR` is defined. diff --git a/doc/has_trivial_move_assign.qbk b/doc/has_trivial_move_assign.qbk index 0fe04ce..373d5f0 100644 --- a/doc/has_trivial_move_assign.qbk +++ b/doc/has_trivial_move_assign.qbk @@ -17,14 +17,14 @@ If a type has a trivial move assignment-operator then the operator has the same as copying the bits of one object to the other: calls to the operator can be safely replaced with a call to `memcpy`. -__compat If the compiler does not support partial-specialization of class -templates, then this template can not be used with function types. - -Without some (as yet unspecified) help from the compiler, +__compat Without some (as yet unspecified) help from the compiler, has_trivial_move_assign will never report that a user-defined class or struct has a -trivial constructor; this is always safe, if possibly sub-optimal. -Currently (February 2013) compilers have no necessary __intrinsics to ensure that this -trait "just works". You may also test to see if the necessary __intrinsics are available +trivial move assign; this is always safe, if possibly sub-optimal. +In addition, in order to correctly handle private or deleted move assignment +operators then c++11's `decltype` is required. +Currently (June 2015) compilers that have the necessary __intrinsics to ensure that this +trait "just works" include Clang, GCC-5.1 and MSVC-12.0. +You may also test to see if the necessary __intrinsics are available by checking to see if the macro `BOOST_HAS_TRIVIAL_MOVE_ASSIGN` is defined. diff --git a/doc/has_trivial_move_constructor.qbk b/doc/has_trivial_move_constructor.qbk index 11b22c6..92d6bb7 100644 --- a/doc/has_trivial_move_constructor.qbk +++ b/doc/has_trivial_move_constructor.qbk @@ -18,14 +18,14 @@ If a type has a trivial move-constructor then the constructor has the same effec as copying the bits of one object to the other: calls to the constructor can be safely replaced with a call to `memcpy`. -__compat If the compiler does not support partial-specialization of class -templates, then this template can not be used with function types. - -Without some (as yet unspecified) help from the compiler, +__compat Without some (as yet unspecified) help from the compiler, has_trivial_move_constructor will never report that a user-defined class or struct has a trivial constructor; this is always safe, if possibly sub-optimal. -Currently (February 2013) compilers have no necessary __intrinsics to ensure that this -trait "just works". You may also test to see if the necessary __intrinsics are available +In addition C++11's `decltype` is required to correctly support deleted or private +move constructors. +Currently (June 2015) compilers that have the necessary __intrinsics to ensure that this +trait "just works" include Clang, GCC-5.1, and MSVC-12.0. +You may also test to see if the necessary __intrinsics are available by checking to see if the macro `BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR` is defined. From 24548d6158283723575780245731a84b06d32105 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Thu, 11 Jun 2015 09:58:39 +0100 Subject: [PATCH 10/51] Add missing #includes. --- include/boost/type_traits.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/boost/type_traits.hpp b/include/boost/type_traits.hpp index 77292a4..8658363 100644 --- a/include/boost/type_traits.hpp +++ b/include/boost/type_traits.hpp @@ -52,6 +52,7 @@ #include #include "boost/type_traits/is_compound.hpp" #include "boost/type_traits/is_const.hpp" +#include "boost/type_traits/is_constructible.hpp" #include "boost/type_traits/is_convertible.hpp" #include "boost/type_traits/is_copy_constructible.hpp" #include "boost/type_traits/is_copy_assignable.hpp" From 2d713790742934dd629dc285ee83db795b7f8ee9 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Thu, 11 Jun 2015 10:00:09 +0100 Subject: [PATCH 11/51] Fix has_trivial* traits and improve their tests. --- .../boost/type_traits/has_trivial_assign.hpp | 22 ++++++----- .../type_traits/has_trivial_constructor.hpp | 3 +- .../type_traits/has_trivial_destructor.hpp | 4 ++ .../type_traits/has_trivial_move_assign.hpp | 4 ++ include/boost/type_traits/intrinsics.hpp | 21 ++++++---- .../type_traits/is_default_constructible.hpp | 7 ++-- test/has_trivial_assign_test.cpp | 29 ++++++++++++-- test/has_trivial_constr_test.cpp | 24 +++++++++++- test/has_trivial_copy_test.cpp | 8 ++++ test/has_trivial_destructor_test.cpp | 22 +++++++++++ test/has_trivial_move_assign_test.cpp | 37 ++++++++++++++++++ test/has_trivial_move_constructor_test.cpp | 38 +++++++++++++++++++ 12 files changed, 194 insertions(+), 25 deletions(-) diff --git a/include/boost/type_traits/has_trivial_assign.hpp b/include/boost/type_traits/has_trivial_assign.hpp index b67d009..5217c78 100644 --- a/include/boost/type_traits/has_trivial_assign.hpp +++ b/include/boost/type_traits/has_trivial_assign.hpp @@ -13,29 +13,33 @@ #include #include -#if !defined(BOOST_HAS_TRIVIAL_ASSIGN) || defined(BOOST_MSVC) || defined(__GNUC__) || defined(BOOST_INTEL) || defined(__SUNPRO_CC) +#if !defined(BOOST_HAS_TRIVIAL_ASSIGN) || defined(BOOST_MSVC) || defined(__GNUC__) || defined(BOOST_INTEL) || defined(__SUNPRO_CC) || defined(__clang) #include #include #include +#include #endif namespace boost { -template -struct has_trivial_assign : public integral_constant + struct has_trivial_assign : public integral_constant < bool, #ifdef BOOST_HAS_TRIVIAL_ASSIGN - BOOST_HAS_TRIVIAL_ASSIGN(T) + BOOST_HAS_TRIVIAL_ASSIGN(T) #else - ::boost::is_pod::value && !::boost::is_const::value && !::boost::is_volatile::value + ::boost::is_pod::value && !::boost::is_const::value && !::boost::is_volatile::value #endif > {}; -template<> struct has_trivial_assign : public false_type{}; + template<> struct has_trivial_assign : public false_type{}; #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -template<> struct has_trivial_assign : public false_type{}; -template<> struct has_trivial_assign : public false_type{}; -template<> struct has_trivial_assign : public false_type{}; + template<> struct has_trivial_assign : public false_type{}; + template<> struct has_trivial_assign : public false_type{}; + template<> struct has_trivial_assign : public false_type{}; #endif + // Arrays are not explictly assignable: + template struct has_trivial_assign : public false_type{}; + template struct has_trivial_assign : public false_type{}; } // namespace boost diff --git a/include/boost/type_traits/has_trivial_constructor.hpp b/include/boost/type_traits/has_trivial_constructor.hpp index 24e581d..0f57aae 100644 --- a/include/boost/type_traits/has_trivial_constructor.hpp +++ b/include/boost/type_traits/has_trivial_constructor.hpp @@ -11,6 +11,7 @@ #include #include +#include #ifdef BOOST_HAS_TRIVIAL_CONSTRUCTOR #ifdef BOOST_HAS_SGI_TYPE_TRAITS @@ -27,7 +28,7 @@ namespace boost { template struct has_trivial_constructor #ifdef BOOST_HAS_TRIVIAL_CONSTRUCTOR - : public integral_constant ::value || BOOST_HAS_TRIVIAL_CONSTRUCTOR(T))>{}; + : public integral_constant ::value || BOOST_HAS_TRIVIAL_CONSTRUCTOR(T)) && is_default_constructible::value)>{}; #else : public integral_constant ::value>{}; #endif diff --git a/include/boost/type_traits/has_trivial_destructor.hpp b/include/boost/type_traits/has_trivial_destructor.hpp index dc1b24c..763283d 100644 --- a/include/boost/type_traits/has_trivial_destructor.hpp +++ b/include/boost/type_traits/has_trivial_destructor.hpp @@ -21,6 +21,10 @@ #include #endif +#if defined(__GNUC__) || defined(__clang) || defined(__SUNPRO_CC) +#include +#endif + namespace boost { template struct has_trivial_destructor : public integral_constant{}; diff --git a/include/boost/type_traits/has_trivial_move_assign.hpp b/include/boost/type_traits/has_trivial_move_assign.hpp index f291f6f..9235996 100644 --- a/include/boost/type_traits/has_trivial_move_assign.hpp +++ b/include/boost/type_traits/has_trivial_move_assign.hpp @@ -23,6 +23,10 @@ #endif #endif +#if defined(__GNUC__) || defined(__clang) +#include +#endif + namespace boost { template diff --git a/include/boost/type_traits/intrinsics.hpp b/include/boost/type_traits/intrinsics.hpp index 72095dc..3b4a047 100644 --- a/include/boost/type_traits/intrinsics.hpp +++ b/include/boost/type_traits/intrinsics.hpp @@ -174,10 +174,10 @@ # define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) && !is_reference::value) # endif # if __has_feature(has_trivial_assign) -# define BOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) && !is_volatile::value) +# define BOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) && !is_volatile::value && is_assignable::value) # endif # if __has_feature(has_trivial_destructor) -# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T) +# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) && is_destructible::value) # endif # if __has_feature(has_nothrow_constructor) # define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_constructor(T) && is_default_constructible::value) @@ -210,10 +210,10 @@ # define BOOST_IS_POLYMORPHIC(T) __is_polymorphic(T) # endif # if __has_feature(has_trivial_move_constructor) -# define BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) __has_trivial_move_constructor(T) +# define BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) (__has_trivial_move_constructor(T) && is_constructible::value) # endif # if __has_feature(has_trivial_move_assign) -# define BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) __has_trivial_move_assign(T) +# define BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) (__has_trivial_move_assign(T) && is_assignable::value) # endif # define BOOST_ALIGNMENT_OF(T) __alignof(T) # if __has_feature(is_final) @@ -241,8 +241,8 @@ # define BOOST_IS_EMPTY(T) __is_empty(T) # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) ((__has_trivial_constructor(T) BOOST_INTEL_TT_OPTS) && ! ::boost::is_volatile::value) # define BOOST_HAS_TRIVIAL_COPY(T) ((__has_trivial_copy(T) BOOST_INTEL_TT_OPTS) && !is_reference::value) -# define BOOST_HAS_TRIVIAL_ASSIGN(T) ((__has_trivial_assign(T) BOOST_INTEL_TT_OPTS) && ! ::boost::is_volatile::value && ! ::boost::is_const::value) -# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) BOOST_INTEL_TT_OPTS) +# define BOOST_HAS_TRIVIAL_ASSIGN(T) ((__has_trivial_assign(T) BOOST_INTEL_TT_OPTS) && ! ::boost::is_volatile::value && ! ::boost::is_const::value && is_assignable::value) +# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) BOOST_INTEL_TT_OPTS && is_destructible::value) # define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_constructor(T) && is_default_constructible::value BOOST_INTEL_TT_OPTS) # define BOOST_HAS_NOTHROW_COPY(T) ((__has_nothrow_copy(T) BOOST_INTEL_TT_OPTS) && !is_volatile::value && !is_reference::value && is_constructible::value) # define BOOST_HAS_NOTHROW_ASSIGN(T) ((__has_nothrow_assign(T) BOOST_INTEL_TT_OPTS) && !is_volatile::value && !is_const::value && is_assignable::value) @@ -263,6 +263,11 @@ # define BOOST_IS_FINAL(T) __is_final(T) # endif +# if __GNUC__ >= 5 +# define BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) (__is_trivially_assignable(T&, T&&) && is_assignable::value) +# define BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) (__is_trivially_constructible(T, T&&) && is_constructible::value) +# endif + # define BOOST_HAS_TYPE_TRAITS_INTRINSICS #endif @@ -276,8 +281,8 @@ # define BOOST_IS_EMPTY(T) __oracle_is_empty(T) # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) (__oracle_has_trivial_constructor(T) && ! ::boost::is_volatile::value) # define BOOST_HAS_TRIVIAL_COPY(T) (__oracle_has_trivial_copy(T) && !is_reference::value) -# define BOOST_HAS_TRIVIAL_ASSIGN(T) ((__oracle_has_trivial_assign(T) || __oracle_is_trivial(T)) && ! ::boost::is_volatile::value && ! ::boost::is_const::value) -# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) __oracle_has_trivial_destructor(T) +# define BOOST_HAS_TRIVIAL_ASSIGN(T) ((__oracle_has_trivial_assign(T) || __oracle_is_trivial(T)) && ! ::boost::is_volatile::value && ! ::boost::is_const::value && is_assignable::value) +# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__oracle_has_trivial_destructor(T) && is_destructible::value) # define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) ((__oracle_has_nothrow_constructor(T) || __oracle_has_trivial_constructor(T) || __oracle_is_trivial(T)) && is_default_constructible::value) # define BOOST_HAS_NOTHROW_COPY(T) ((__oracle_has_nothrow_copy(T) || __oracle_has_trivial_copy(T) || __oracle_is_trivial(T)) && !is_volatile::value && !is_reference::value) # define BOOST_HAS_NOTHROW_ASSIGN(T) ((__oracle_has_nothrow_assign(T) || __oracle_has_trivial_assign(T) || __oracle_is_trivial(T)) && !is_volatile::value && !is_const::value) diff --git a/include/boost/type_traits/is_default_constructible.hpp b/include/boost/type_traits/is_default_constructible.hpp index 48ed772..769e360 100644 --- a/include/boost/type_traits/is_default_constructible.hpp +++ b/include/boost/type_traits/is_default_constructible.hpp @@ -43,12 +43,13 @@ namespace boost{ #else -#include +#include namespace boost{ - // We don't know how to implement this: - template struct is_default_constructible : public has_trivial_constructor{}; + // We don't know how to implement this, note we can not use has_trivial_constructor here + // because the correct implementation of that trait requires this one: + template struct is_default_constructible : public is_pod{}; template <> struct is_default_constructible : public integral_constant{}; template <> struct is_default_constructible : public integral_constant{}; template <> struct is_default_constructible : public integral_constant{}; diff --git a/test/has_trivial_assign_test.cpp b/test/has_trivial_assign_test.cpp index cc8ad45..c5e40a3 100644 --- a/test/has_trivial_assign_test.cpp +++ b/test/has_trivial_assign_test.cpp @@ -12,6 +12,23 @@ # include #endif +struct non_assignable +{ + non_assignable(); +private: + non_assignable& operator=(const non_assignable&); +}; + +#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS + +struct non_assignable2 +{ + non_assignable2(); + non_assignable2& operator=(const non_assignable2&) = delete; +}; + +#endif + TT_TEST_BEGIN(has_trivial_assign) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign::value, true); @@ -180,9 +197,10 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign::value, false); #endif BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign::value, false); -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign::value, true); -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign::value, true); -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign::value, true); +// Arrays can not be explicitly assigned: +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign::value, false); @@ -203,6 +221,11 @@ BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_assign::value, false); +#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign::value, false); +#endif +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign::value, false); + TT_TEST_END diff --git a/test/has_trivial_constr_test.cpp b/test/has_trivial_constr_test.cpp index 8db4ede..16a4e8a 100644 --- a/test/has_trivial_constr_test.cpp +++ b/test/has_trivial_constr_test.cpp @@ -27,6 +27,22 @@ public: explicit bug11324_derived(char arg) : data(arg) {} }; +struct private_construct +{ + private_construct(int); +private: + private_construct(); +}; + +#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS + +struct deleted_construct +{ + deleted_construct(int); + deleted_construct() = delete; +}; + +#endif TT_TEST_BEGIN(has_trivial_constructor) @@ -167,7 +183,8 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, t 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); +// Can't construct type void: +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, false); // 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); @@ -187,6 +204,11 @@ BOOST_CHECK_SOFT_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, false); +#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, false); +#endif + TT_TEST_END diff --git a/test/has_trivial_copy_test.cpp b/test/has_trivial_copy_test.cpp index 6a803b8..043f76e 100644 --- a/test/has_trivial_copy_test.cpp +++ b/test/has_trivial_copy_test.cpp @@ -25,6 +25,13 @@ public: #endif +struct private_copy +{ + private_copy(); +private: + private_copy(const private_copy&); +}; + TT_TEST_BEGIN(has_trivial_copy) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy::value, true); @@ -220,6 +227,7 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy::value, false); #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy::value, false); #endif +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy::value, false); TT_TEST_END diff --git a/test/has_trivial_destructor_test.cpp b/test/has_trivial_destructor_test.cpp index 48196b7..3792004 100644 --- a/test/has_trivial_destructor_test.cpp +++ b/test/has_trivial_destructor_test.cpp @@ -12,6 +12,23 @@ # include #endif +#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS + +struct deleted_destruct +{ + deleted_destruct(); + ~deleted_destruct() = delete; +}; + +#endif + +struct private_destruct +{ + private_destruct(); +private: + ~private_destruct(); +}; + TT_TEST_BEGIN(has_trivial_destructor) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); @@ -170,6 +187,11 @@ 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); +#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, false); +#endif + TT_TEST_END diff --git a/test/has_trivial_move_assign_test.cpp b/test/has_trivial_move_assign_test.cpp index d54fcdc..009867f 100644 --- a/test/has_trivial_move_assign_test.cpp +++ b/test/has_trivial_move_assign_test.cpp @@ -13,6 +13,38 @@ # include #endif +#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS + +struct non_copyable_movable +{ + int val; + non_copyable_movable(int); + non_copyable_movable(const non_copyable_movable&) = delete; + non_copyable_movable& operator=(const non_copyable_movable&) = delete; + //non_copyable_movable(non_copyable_movable&&) = default; +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1800) + non_copyable_movable& operator=(non_copyable_movable&& o) + { + val = std::move(o.val); + return *this; + } +#else + non_copyable_movable& operator=(non_copyable_movable&&) = default; +#endif +}; + +struct copyable_non_moveable +{ + int val; + copyable_non_moveable(int); + copyable_non_moveable(const copyable_non_moveable&) = default; + copyable_non_moveable& operator=(const copyable_non_moveable&) = default; + copyable_non_moveable(copyable_non_moveable&&) = delete; + copyable_non_moveable& operator=(copyable_non_moveable&&) = delete; +}; + +#endif + TT_TEST_BEGIN(has_trivial_move_assign) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign::value, true); @@ -204,6 +236,11 @@ BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign::value, false); +#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign::value, true, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign::value, false); +#endif + TT_TEST_END diff --git a/test/has_trivial_move_constructor_test.cpp b/test/has_trivial_move_constructor_test.cpp index 472df99..1071f1b 100644 --- a/test/has_trivial_move_constructor_test.cpp +++ b/test/has_trivial_move_constructor_test.cpp @@ -13,6 +13,39 @@ # include #endif +#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS + +struct non_copyable_movable +{ + int val; + non_copyable_movable(int); + non_copyable_movable(const non_copyable_movable&) = delete; + non_copyable_movable& operator=(const non_copyable_movable&) = delete; +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1800) + non_copyable_movable(non_copyable_movable&& o) : val(o.val){} + non_copyable_movable& operator=(non_copyable_movable&& o) + { + val = std::move(o.val); + return *this; + } +#else + non_copyable_movable(non_copyable_movable&&) = default; + non_copyable_movable& operator=(non_copyable_movable&&) = default; +#endif +}; + +struct copyable_non_moveable +{ + int val; + copyable_non_moveable(int); + copyable_non_moveable(const copyable_non_moveable&) = default; + copyable_non_moveable& operator=(const copyable_non_moveable&) = default; + copyable_non_moveable(copyable_non_moveable&&) = delete; + copyable_non_moveable& operator=(copyable_non_moveable&&) = delete; +}; + +#endif + TT_TEST_BEGIN(has_trivial_move_constructor) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor::value, true); @@ -204,6 +237,11 @@ BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor::value, false); +#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS +BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor::value, true, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor::value, false); +#endif + TT_TEST_END From 434e26e7a3fe223aeae686032edb230b85daba33 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Thu, 11 Jun 2015 10:00:31 +0100 Subject: [PATCH 12/51] Improve is_destructible and add tests. --- include/boost/type_traits/is_destructible.hpp | 7 + test/is_destructible_test.cpp | 177 ++++++++++++++++++ 2 files changed, 184 insertions(+) create mode 100644 test/is_destructible_test.cpp diff --git a/include/boost/type_traits/is_destructible.hpp b/include/boost/type_traits/is_destructible.hpp index fe421d9..7f266a9 100644 --- a/include/boost/type_traits/is_destructible.hpp +++ b/include/boost/type_traits/is_destructible.hpp @@ -32,6 +32,8 @@ namespace boost{ } template struct is_destructible : public integral_constant(0)) == sizeof(boost::type_traits::yes_type)>{}; + template struct is_destructible : public is_destructible{}; + template struct is_destructible : public is_destructible{}; #else @@ -44,6 +46,11 @@ namespace boost{ template struct is_destructible : public integral_constant::value || is_class::value>{}; #endif + template <> struct is_destructible : public false_type{}; + template <> struct is_destructible : public false_type{}; + template <> struct is_destructible : public false_type{}; + template <> struct is_destructible : public false_type{}; + } // namespace boost #endif // BOOST_TT_IS_DESTRUCTIBLE_HPP_INCLUDED diff --git a/test/is_destructible_test.cpp b/test/is_destructible_test.cpp new file mode 100644 index 0000000..a4f58ba --- /dev/null +++ b/test/is_destructible_test.cpp @@ -0,0 +1,177 @@ + +// (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 + +#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) + +struct deleted_destruct +{ + deleted_destruct(); + ~deleted_destruct() = delete; +}; + +#endif + + +TT_TEST_BEGIN(is_destructible) + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); + +#ifdef BOOST_HAS_LONG_LONG + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::ulong_long_type>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::long_long_type>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::ulong_long_type const>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::long_long_type const>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::ulong_long_type volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::long_long_type volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::ulong_long_type const volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::long_long_type const volatile>::value, true); + +#endif + +#ifdef BOOST_HAS_MS_INT64 + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int8>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int8 const>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int8 volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int8 const volatile>::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int16>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int16 const>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int16 volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int16 const volatile>::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int32>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int32 const>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int32 volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int32 const volatile>::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int64>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int64 const>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int64 volatile>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int64 const volatile>::value, true); + +#endif + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); + + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::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::is_destructible::value, false); +//BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, false); + +#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, false); +#endif + +TT_TEST_END + + + From 11cd9e667483e9e612525460db7608ae46da9b38 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Thu, 11 Jun 2015 10:13:30 +0100 Subject: [PATCH 13/51] Improve is_destructible - especially for references. --- include/boost/type_traits/is_destructible.hpp | 8 ++++++-- test/is_destructible_test.cpp | 13 +++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/include/boost/type_traits/is_destructible.hpp b/include/boost/type_traits/is_destructible.hpp index 7f266a9..36fc626 100644 --- a/include/boost/type_traits/is_destructible.hpp +++ b/include/boost/type_traits/is_destructible.hpp @@ -32,8 +32,6 @@ namespace boost{ } template struct is_destructible : public integral_constant(0)) == sizeof(boost::type_traits::yes_type)>{}; - template struct is_destructible : public is_destructible{}; - template struct is_destructible : public is_destructible{}; #else @@ -50,6 +48,12 @@ namespace boost{ template <> struct is_destructible : public false_type{}; template <> struct is_destructible : public false_type{}; template <> struct is_destructible : public false_type{}; + template struct is_destructible : public is_destructible{}; +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + template struct is_destructible : public is_destructible{}; +#endif + template struct is_destructible : public is_destructible{}; + template struct is_destructible : public is_destructible{}; } // namespace boost diff --git a/test/is_destructible_test.cpp b/test/is_destructible_test.cpp index a4f58ba..872f21b 100644 --- a/test/is_destructible_test.cpp +++ b/test/is_destructible_test.cpp @@ -151,6 +151,19 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible::value, true); +#endif // // These are commented out for now because it's not clear what the semantics should be: From e8e7724303a0b80a92a6ed8064401ada28454a0a Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Thu, 11 Jun 2015 10:25:39 +0100 Subject: [PATCH 14/51] Volatile types are not trivially movable. --- include/boost/type_traits/has_trivial_move_assign.hpp | 1 + include/boost/type_traits/intrinsics.hpp | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/boost/type_traits/has_trivial_move_assign.hpp b/include/boost/type_traits/has_trivial_move_assign.hpp index 9235996..94a358d 100644 --- a/include/boost/type_traits/has_trivial_move_assign.hpp +++ b/include/boost/type_traits/has_trivial_move_assign.hpp @@ -25,6 +25,7 @@ #if defined(__GNUC__) || defined(__clang) #include +#include #endif namespace boost { diff --git a/include/boost/type_traits/intrinsics.hpp b/include/boost/type_traits/intrinsics.hpp index 3b4a047..3572617 100644 --- a/include/boost/type_traits/intrinsics.hpp +++ b/include/boost/type_traits/intrinsics.hpp @@ -210,10 +210,10 @@ # define BOOST_IS_POLYMORPHIC(T) __is_polymorphic(T) # endif # if __has_feature(has_trivial_move_constructor) -# define BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) (__has_trivial_move_constructor(T) && is_constructible::value) +# define BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) (__has_trivial_move_constructor(T) && is_constructible::value && !::boost::is_volatile::value) # endif # if __has_feature(has_trivial_move_assign) -# define BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) (__has_trivial_move_assign(T) && is_assignable::value) +# define BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) (__has_trivial_move_assign(T) && is_assignable::value && !::boost::is_volatile::value) # endif # define BOOST_ALIGNMENT_OF(T) __alignof(T) # if __has_feature(is_final) @@ -264,8 +264,8 @@ # endif # if __GNUC__ >= 5 -# define BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) (__is_trivially_assignable(T&, T&&) && is_assignable::value) -# define BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) (__is_trivially_constructible(T, T&&) && is_constructible::value) +# define BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) (__is_trivially_assignable(T&, T&&) && is_assignable::value && !::boost::is_volatile::value) +# define BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) (__is_trivially_constructible(T, T&&) && is_constructible::value && !::boost::is_volatile::values) # endif # define BOOST_HAS_TYPE_TRAITS_INTRINSICS From d44141cf888b718bb1d3f4e622f0ed1920fec95a Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Thu, 11 Jun 2015 10:57:11 +0100 Subject: [PATCH 15/51] Fix behaviour of references and arrays in has_trivial_move_assign. --- include/boost/type_traits/has_trivial_move_assign.hpp | 7 +++++++ test/has_trivial_move_assign_test.cpp | 7 ++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/boost/type_traits/has_trivial_move_assign.hpp b/include/boost/type_traits/has_trivial_move_assign.hpp index 94a358d..7fc7bf9 100644 --- a/include/boost/type_traits/has_trivial_move_assign.hpp +++ b/include/boost/type_traits/has_trivial_move_assign.hpp @@ -45,6 +45,13 @@ template <> struct has_trivial_move_assign : public false_type{}; template <> struct has_trivial_move_assign : public false_type{}; template <> struct has_trivial_move_assign : public false_type{}; #endif +template struct has_trivial_move_assign : public false_type{}; +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES +template struct has_trivial_move_assign : public false_type{}; +#endif +// Array types are not assignable: +template struct has_trivial_move_assign : public false_type{}; +template struct has_trivial_move_assign : public false_type{}; } // namespace boost diff --git a/test/has_trivial_move_assign_test.cpp b/test/has_trivial_move_assign_test.cpp index 009867f..7fe05e3 100644 --- a/test/has_trivial_move_assign_test.cpp +++ b/test/has_trivial_move_assign_test.cpp @@ -213,9 +213,10 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign::value, false) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign::value, false); #endif BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign::value, false); -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign::value, true); -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign::value, true); -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign::value, true); +// array types are not assignable: +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_assign::value, false); From 2fc65e67a8a47b016082f06c4343573aa61c7121 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Thu, 11 Jun 2015 10:58:09 +0100 Subject: [PATCH 16/51] Add missing #include to has_trivial_move_constructor.hpp. --- include/boost/type_traits/has_trivial_move_constructor.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/boost/type_traits/has_trivial_move_constructor.hpp b/include/boost/type_traits/has_trivial_move_constructor.hpp index 2195be8..c3da65b 100644 --- a/include/boost/type_traits/has_trivial_move_constructor.hpp +++ b/include/boost/type_traits/has_trivial_move_constructor.hpp @@ -21,6 +21,11 @@ #include #endif +#if defined(__GNUC__) || defined(__clang) +#include +#endif + + namespace boost { template struct has_trivial_move_constructor : public integral_constant{}; From 229e99880b26c78a07a71f8c76568ea15fa743ea Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Thu, 11 Jun 2015 10:59:52 +0100 Subject: [PATCH 17/51] Add missing #include to has_trivial_move_constructor.hpp --- include/boost/type_traits/has_trivial_move_constructor.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/boost/type_traits/has_trivial_move_constructor.hpp b/include/boost/type_traits/has_trivial_move_constructor.hpp index c3da65b..1a032a9 100644 --- a/include/boost/type_traits/has_trivial_move_constructor.hpp +++ b/include/boost/type_traits/has_trivial_move_constructor.hpp @@ -23,6 +23,7 @@ #if defined(__GNUC__) || defined(__clang) #include +#include #endif From b069b3ce3c3abfc1b7b3e8799726c84cbcc44563 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Thu, 11 Jun 2015 11:01:18 +0100 Subject: [PATCH 18/51] Fix spelling of ::value ! --- include/boost/type_traits/intrinsics.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/type_traits/intrinsics.hpp b/include/boost/type_traits/intrinsics.hpp index 3572617..711d460 100644 --- a/include/boost/type_traits/intrinsics.hpp +++ b/include/boost/type_traits/intrinsics.hpp @@ -265,7 +265,7 @@ # if __GNUC__ >= 5 # define BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) (__is_trivially_assignable(T&, T&&) && is_assignable::value && !::boost::is_volatile::value) -# define BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) (__is_trivially_constructible(T, T&&) && is_constructible::value && !::boost::is_volatile::values) +# define BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) (__is_trivially_constructible(T, T&&) && is_constructible::value && !::boost::is_volatile::value) # endif # define BOOST_HAS_TYPE_TRAITS_INTRINSICS From ae76223babe2e088ef444f8d39494d99e3fa3f28 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Thu, 11 Jun 2015 11:26:33 +0100 Subject: [PATCH 19/51] Move trivial/nothrow construct traits closer into line with the standard. --- .../type_traits/has_trivial_move_constructor.hpp | 8 ++++++++ .../type_traits/is_nothrow_move_constructible.hpp | 13 +++++-------- test/has_trivial_move_constructor_test.cpp | 12 ++++++------ test/is_nothrow_move_constructible_test.cpp | 6 +++--- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/include/boost/type_traits/has_trivial_move_constructor.hpp b/include/boost/type_traits/has_trivial_move_constructor.hpp index 1a032a9..e37dfe3 100644 --- a/include/boost/type_traits/has_trivial_move_constructor.hpp +++ b/include/boost/type_traits/has_trivial_move_constructor.hpp @@ -48,6 +48,14 @@ template <> struct has_trivial_move_constructor : public false_type{ template <> struct has_trivial_move_constructor : public false_type{}; template <> struct has_trivial_move_constructor : public false_type{}; #endif +// What should we do with reference types??? The standard seems to suggest these are trivial, even if the thing they reference is not: +template struct has_trivial_move_constructor : public true_type{}; +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES +template struct has_trivial_move_constructor : public true_type{}; +#endif +// Arrays can not be explicitly copied: +template struct has_trivial_move_constructor : public false_type{}; +template struct has_trivial_move_constructor : public false_type{}; } // namespace boost diff --git a/include/boost/type_traits/is_nothrow_move_constructible.hpp b/include/boost/type_traits/is_nothrow_move_constructible.hpp index 323f443..4b7a71b 100644 --- a/include/boost/type_traits/is_nothrow_move_constructible.hpp +++ b/include/boost/type_traits/is_nothrow_move_constructible.hpp @@ -24,10 +24,6 @@ struct is_nothrow_move_constructible : public integral_constant struct is_nothrow_move_constructible : public ::boost::false_type {}; template struct is_nothrow_move_constructible : public ::boost::false_type{}; -template struct is_nothrow_move_constructible : public ::boost::false_type{}; -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -template struct is_nothrow_move_constructible : public ::boost::false_type{}; -#endif #elif !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR) @@ -53,10 +49,6 @@ template struct is_nothrow_move_constructible template struct is_nothrow_move_constructible : public ::boost::false_type {}; template struct is_nothrow_move_constructible : public ::boost::false_type{}; -template struct is_nothrow_move_constructible : public ::boost::false_type{}; -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -template struct is_nothrow_move_constructible : public ::boost::false_type{}; -#endif #else @@ -80,6 +72,11 @@ template <> struct is_nothrow_move_constructible : false_type{}; template <> struct is_nothrow_move_constructible : false_type{}; template <> struct is_nothrow_move_constructible : false_type{}; #endif +// References are always trivially constructible, even if the thing they reference is not: +template struct is_nothrow_move_constructible : public ::boost::true_type{}; +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES +template struct is_nothrow_move_constructible : public ::boost::true_type{}; +#endif } // namespace boost diff --git a/test/has_trivial_move_constructor_test.cpp b/test/has_trivial_move_constructor_test.cpp index 1071f1b..c34c834 100644 --- a/test/has_trivial_move_constructor_test.cpp +++ b/test/has_trivial_move_constructor_test.cpp @@ -210,14 +210,14 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor::value, tru BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor::value, true); -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor::value, true); #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor::value, true); #endif -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor::value, false); -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor::value, true); -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor::value, true); -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor::value, false); // cases we would like to succeed but can't implement in the language: diff --git a/test/is_nothrow_move_constructible_test.cpp b/test/is_nothrow_move_constructible_test.cpp index a15cacf..7a196ed 100644 --- a/test/is_nothrow_move_constructible_test.cpp +++ b/test/is_nothrow_move_constructible_test.cpp @@ -182,11 +182,11 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, tr BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, true); -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, true); #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, true); #endif -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, false); From cb98a630ffb720e293fe9c91dc4d42d7a4d1ca7f Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Fri, 12 Jun 2015 13:26:27 +0100 Subject: [PATCH 20/51] Change is_copy_constructible to use is_constructible where possible, and fix some MSVC failures. --- .../boost/type_traits/is_constructible.hpp | 16 ++ .../type_traits/is_copy_constructible.hpp | 205 +++++++++++------- test/is_copy_constructible_test.cpp | 20 +- 3 files changed, 155 insertions(+), 86 deletions(-) diff --git a/include/boost/type_traits/is_constructible.hpp b/include/boost/type_traits/is_constructible.hpp index d1accc1..9b7abe8 100644 --- a/include/boost/type_traits/is_constructible.hpp +++ b/include/boost/type_traits/is_constructible.hpp @@ -15,6 +15,7 @@ #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) #include +#include #include #include @@ -47,6 +48,13 @@ namespace boost{ template struct is_constructible : public integral_constant(detail::tt_declval())) == sizeof(boost::type_traits::yes_type)>{}; template struct is_constructible : public integral_constant(detail::tt_declval())) == sizeof(boost::type_traits::yes_type)>{}; + template <> struct is_constructible : public false_type{}; + template <> struct is_constructible : public false_type{}; + template <> struct is_constructible : public false_type{}; + template <> struct is_constructible : public false_type{}; + + template struct is_constructible : public is_default_constructible{}; + #else #include @@ -57,6 +65,14 @@ namespace boost{ // We don't know how to implement this: template struct is_constructible : public is_convertible{}; template struct is_constructible : public is_default_constructible{}; + template <> struct is_constructible : public false_type{}; + template <> struct is_constructible : public false_type{}; + template <> struct is_constructible : public false_type{}; + template <> struct is_constructible : public false_type{}; + template struct is_constructible : public false_type{}; +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + template struct is_constructible : public false_type{}; +#endif #endif } // namespace boost diff --git a/include/boost/type_traits/is_copy_constructible.hpp b/include/boost/type_traits/is_copy_constructible.hpp index 2e80738..03c0460 100644 --- a/include/boost/type_traits/is_copy_constructible.hpp +++ b/include/boost/type_traits/is_copy_constructible.hpp @@ -9,111 +9,170 @@ #ifndef BOOST_TT_IS_COPY_CONSTRUCTIBLE_HPP_INCLUDED #define BOOST_TT_IS_COPY_CONSTRUCTIBLE_HPP_INCLUDED +#include +#include + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) + +#include + +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1800) + +namespace boost { + +template struct is_copy_constructible : public boost::is_constructible{}; + +template <> struct is_copy_constructible : public false_type{}; +template <> struct is_copy_constructible : public false_type{}; +template <> struct is_copy_constructible : public false_type{}; +template <> struct is_copy_constructible : public false_type{}; + +} // namespace boost + +#else +// +// Special version for VC12 which has a problem when a base class (such as non_copyable) has a deleted +// copy constructor. In this case the compiler thinks there really is a copy-constructor and tries to +// instantiate the deleted member. std::is_copy_constructible has the same issue (or at least returns +// an incorrect value, which just defers the issue into the users code) as well. We can at least fix +// boost::non_copyable as a base class as a special case: +// +#include +#include + +namespace boost { + + namespace detail + { + + template struct is_copy_constructible_imp : public boost::is_constructible{}; + template struct is_copy_constructible_imp : public false_type{}; + + } + + template struct is_copy_constructible : public detail::is_copy_constructible_imp::value>{}; + + template <> struct is_copy_constructible : public false_type{}; + template <> struct is_copy_constructible : public false_type{}; + template <> struct is_copy_constructible : public false_type{}; + template <> struct is_copy_constructible : public false_type{}; + +} // namespace boost + +#endif + +#else + #include #include #include #include #include +#include +#include #include namespace boost { -namespace detail{ + namespace detail{ -template -struct is_copy_constructible_impl2 { + template + struct is_copy_constructible_impl2 { -// Intel compiler has problems with SFINAE for copy constructors and deleted functions: -// -// error: function *function_name* cannot be referenced -- it is a deleted function -// static boost::type_traits::yes_type test(T1&, decltype(T1(boost::declval()))* = 0); -// ^ -// -// MSVC 12.0 (Visual 2013) has problems when the copy constructor has been deleted. See: -// https://connect.microsoft.com/VisualStudio/feedback/details/800328/std-is-copy-constructible-is-broken + // Intel compiler has problems with SFINAE for copy constructors and deleted functions: + // + // error: function *function_name* cannot be referenced -- it is a deleted function + // static boost::type_traits::yes_type test(T1&, decltype(T1(boost::declval()))* = 0); + // ^ + // + // MSVC 12.0 (Visual 2013) has problems when the copy constructor has been deleted. See: + // https://connect.microsoft.com/VisualStudio/feedback/details/800328/std-is-copy-constructible-is-broken #if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) && !defined(BOOST_INTEL_CXX_VERSION) && !(defined(BOOST_MSVC) && _MSC_VER == 1800) #ifdef BOOST_NO_CXX11_DECLTYPE - template - static boost::type_traits::yes_type test(T1&, boost::mpl::int_()))>* = 0); + template + static boost::type_traits::yes_type test(const T1&, boost::mpl::int_()))>* = 0); #else - template - static boost::type_traits::yes_type test(T1&, decltype(T1(boost::declval()))* = 0); + template + static boost::type_traits::yes_type test(const T1&, decltype(T1(boost::declval()))* = 0); #endif - static boost::type_traits::no_type test(...); + static boost::type_traits::no_type test(...); #else - template - static boost::type_traits::no_type test(T1&, typename T1::boost_move_no_copy_constructor_or_assign* = 0); - static boost::type_traits::yes_type test(...); + template + static boost::type_traits::no_type test(const T1&, typename T1::boost_move_no_copy_constructor_or_assign* = 0); + static boost::type_traits::yes_type test(...); #endif - // If you see errors like this: - // - // `'T::T(const T&)' is private` - // `boost/type_traits/is_copy_constructible.hpp:68:5: error: within this context` - // - // then you are trying to call that macro for a structure defined like that: - // - // struct T { - // ... - // private: - // T(const T &); - // ... - // }; - // - // To fix that you must modify your structure: - // - // // C++03 and C++11 version - // struct T: private boost::noncopyable { - // ... - // private: - // T(const T &); - // ... - // }; - // - // // C++11 version - // struct T { - // ... - // private: - // T(const T &) = delete; - // ... - // }; - BOOST_STATIC_CONSTANT(bool, value = ( + // If you see errors like this: + // + // `'T::T(const T&)' is private` + // `boost/type_traits/is_copy_constructible.hpp:68:5: error: within this context` + // + // then you are trying to call that macro for a structure defined like that: + // + // struct T { + // ... + // private: + // T(const T &); + // ... + // }; + // + // To fix that you must modify your structure: + // + // // C++03 and C++11 version + // struct T: private boost::noncopyable { + // ... + // private: + // T(const T &); + // ... + // }; + // + // // C++11 version + // struct T { + // ... + // private: + // T(const T &) = delete; + // ... + // }; + BOOST_STATIC_CONSTANT(bool, value = ( sizeof(test( - boost::declval::type>() + tt_declval::type*/ const T&>() )) == sizeof(boost::type_traits::yes_type) - || - boost::is_rvalue_reference::value - )); -}; + && + !boost::is_rvalue_reference::value + && !boost::is_array::value + )); + }; -template -struct is_copy_constructible_impl2 { - BOOST_STATIC_CONSTANT(bool, value = false); -}; + template + struct is_copy_constructible_impl2 { + BOOST_STATIC_CONSTANT(bool, value = false); + }; -template -struct is_copy_constructible_impl { + template + struct is_copy_constructible_impl { - BOOST_STATIC_CONSTANT(bool, value = ( - boost::detail::is_copy_constructible_impl2< + BOOST_STATIC_CONSTANT(bool, value = ( + boost::detail::is_copy_constructible_impl2< boost::is_base_and_derived::value, T - >::value - )); -}; + >::value + )); + }; -} // namespace detail + } // namespace detail -template struct is_copy_constructible : public integral_constant::value>{}; -template <> struct is_copy_constructible : public false_type{}; + template struct is_copy_constructible : public integral_constant::value>{}; + template <> struct is_copy_constructible : public false_type{}; #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -template <> struct is_copy_constructible : public false_type{}; -template <> struct is_copy_constructible : public false_type{}; -template <> struct is_copy_constructible : public false_type{}; + template <> struct is_copy_constructible : public false_type{}; + template <> struct is_copy_constructible : public false_type{}; + template <> struct is_copy_constructible : public false_type{}; #endif } // namespace boost +#endif + #endif // BOOST_TT_IS_COPY_CONSTRUCTIBLE_HPP_INCLUDED diff --git a/test/is_copy_constructible_test.cpp b/test/is_copy_constructible_test.cpp index cbc4030..844f479 100644 --- a/test/is_copy_constructible_test.cpp +++ b/test/is_copy_constructible_test.cpp @@ -80,7 +80,10 @@ TT_TEST_BEGIN(is_copy_constructible) // Main part of the test BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible::value, true); -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible::value, true); +// Only constructible from has3& not from const-reference, this only works if we have decltype: +#if !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible::value, false); +#endif BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible::value, false); #if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) && !defined(BOOST_INTEL_CXX_VERSION) @@ -260,18 +263,9 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible::value, true BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible::value, true); #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -// Code like `int&& a = 10;` or -// struct nonc { -// nonc() = default; -// nonc(const nonc&) = delete; -// nonc(nonc&&) = delete; -// nonc& operator=(const nonc&) = delete; -// nonc& operator=(nonc&&) = delete; -// }; -// -// nonc && a = nonc(); -// is legal in C++11. so this trait MUST return true. -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible::value, true); +// This is debatable, we used to insist this was true, but copy-constructibility +// implies copying a constant-object, and that isn't the case here: +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible::value, false); #endif BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible::value, true); From 1c91d631971a6ae892c7ae7e7cfa29678c820ba4 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Fri, 12 Jun 2015 17:57:56 +0100 Subject: [PATCH 21/51] Looks like some intrinsics are only available in C++11 mode. --- include/boost/type_traits/intrinsics.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/type_traits/intrinsics.hpp b/include/boost/type_traits/intrinsics.hpp index 711d460..b78e1eb 100644 --- a/include/boost/type_traits/intrinsics.hpp +++ b/include/boost/type_traits/intrinsics.hpp @@ -263,7 +263,7 @@ # define BOOST_IS_FINAL(T) __is_final(T) # endif -# if __GNUC__ >= 5 +# if (__GNUC__ >= 5) && (__cplusplus >= 201103) # define BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) (__is_trivially_assignable(T&, T&&) && is_assignable::value && !::boost::is_volatile::value) # define BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) (__is_trivially_constructible(T, T&&) && is_constructible::value && !::boost::is_volatile::value) # endif From 587298b93a377ebf1394e924624974b7a18a7a5c Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Fri, 12 Jun 2015 18:44:01 +0100 Subject: [PATCH 22/51] Update compiler compatibility notes. --- doc/has_virtual_destructor.qbk | 9 ++++----- doc/integral_constant.qbk | 1 + doc/is_array.qbk | 4 +--- doc/is_base_of.qbk | 6 +----- doc/is_class.qbk | 10 +++------- doc/is_complex.qbk | 2 ++ doc/is_compound.qbk | 2 ++ doc/is_const.qbk | 2 ++ doc/is_convertible.qbk | 5 +---- doc/is_copy_assignable.qbk | 3 +-- doc/is_copy_constructible.qbk | 5 ++--- doc/is_empty.qbk | 5 ----- doc/is_enum.qbk | 5 +---- doc/is_final.qbk | 2 +- doc/is_floating_point.qbk | 2 ++ doc/is_function.qbk | 2 ++ doc/is_fundamental.qbk | 2 ++ doc/is_integral.qbk | 2 ++ doc/is_lvalue_reference.qbk | 5 +---- doc/is_member_function_pointer.qbk | 2 ++ doc/is_member_object_pointer.qbk | 2 ++ doc/is_member_pointer.qbk | 2 ++ doc/type_traits.qbk | 2 +- 23 files changed, 38 insertions(+), 44 deletions(-) diff --git a/doc/has_virtual_destructor.qbk b/doc/has_virtual_destructor.qbk index 5bc3e65..d7fb8bf 100644 --- a/doc/has_virtual_destructor.qbk +++ b/doc/has_virtual_destructor.qbk @@ -12,14 +12,13 @@ __inherit If T is a (possibly cv-qualified) type with a virtual destructor then inherits from __true_type, otherwise inherits from __false_type. -__compat This trait is provided for completeness, since it's part of the -Technical Report on C++ Library Extensions. However, there is currently no -way to portably implement this trait. The default version provided +__compat There is currently no +way to portably implement this trait: the default version always inherits from __false_type, and has to be explicitly specialized for types with virtual destructors unless the compiler used has compiler __intrinsics that enable the trait to do the right thing: -Currently (May 2011) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0, -Intel-11.0, and Codegear have the necessary compiler __intrinsics to ensure that this +Currently (June 2015) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0, +Intel-11.0, plus Codegear and Clang have the necessary compiler __intrinsics to ensure that this trait "just works". You may also test to see if the necessary __intrinsics are available by checking to see if the macro `BOOST_HAS_VIRTUAL_DESTRUCTOR` is defined. diff --git a/doc/integral_constant.qbk b/doc/integral_constant.qbk index 58403cf..663ff08 100644 --- a/doc/integral_constant.qbk +++ b/doc/integral_constant.qbk @@ -12,6 +12,7 @@ typedef integral_constant type; typedef T value_type; static const T value = val; + constexpr operator T()const; }; typedef integral_constant true_type; diff --git a/doc/is_array.qbk b/doc/is_array.qbk index be384f3..c8a4543 100644 --- a/doc/is_array.qbk +++ b/doc/is_array.qbk @@ -16,9 +16,7 @@ __std_ref 3.9.2 and 8.3.4. __header ` #include ` or ` #include ` -__compat If the compiler does not support -partial-specialization of class templates, then this template -can give the wrong result with function types. +[all_compilers] __examples diff --git a/doc/is_base_of.qbk b/doc/is_base_of.qbk index 78712b3..c65eb9a 100644 --- a/doc/is_base_of.qbk +++ b/doc/is_base_of.qbk @@ -28,11 +28,7 @@ __std_ref 10. __header ` #include ` or ` #include ` -__compat If the compiler does not support partial-specialization of class templates, -then this template can not be used with function types. There are some older compilers -which will produce compiler errors if `Base` is a private base class of `Derived`, or if -`Base` is an ambiguous base of `Derived`. These compilers include Borland C++, older -versions of Sun Forte C++, Digital Mars C++, and older versions of EDG based compilers. +[all_compilers] __examples diff --git a/doc/is_class.qbk b/doc/is_class.qbk index 1e7879e..f5d56cb 100644 --- a/doc/is_class.qbk +++ b/doc/is_class.qbk @@ -16,13 +16,9 @@ __std_ref 3.9.2 and 9.2. __header ` #include ` or ` #include ` -__compat Without (some as yet unspecified) help from the compiler, -we cannot distinguish between union and class types, as a result this type -will erroneously inherit from __true_type for union types. See also __is_union. -Currently (May 2011) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0, -Intel-11.0, and Codegear have the necessary compiler __intrinsics to ensure that this -trait "just works". You may also test to see if the necessary __intrinsics are available -by checking to see if the macro `BOOST_IS_CLASS` is defined. +__compat This trait works correctly for almost all current compilers (as of June 2015), with just a minority +of older compilers not correctly detecting all the corner cases. You can check the macro `BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION` +which is defined to 1 when the class works correctly in all cases. __examples diff --git a/doc/is_complex.qbk b/doc/is_complex.qbk index 0c4f981..5646910 100644 --- a/doc/is_complex.qbk +++ b/doc/is_complex.qbk @@ -15,6 +15,8 @@ some type `U`), otherwise false. __std_ref 26.2. +[all_compilers] + __header ` #include ` or ` #include ` [endsect] diff --git a/doc/is_compound.qbk b/doc/is_compound.qbk index 392efd5..80e9f27 100644 --- a/doc/is_compound.qbk +++ b/doc/is_compound.qbk @@ -15,6 +15,8 @@ a compound type (see also __is_fundamental). __std_ref 3.9.2. +[all_compilers] + __header ` #include ` or ` #include ` __examples diff --git a/doc/is_const.qbk b/doc/is_const.qbk index ed3acaa..5853274 100644 --- a/doc/is_const.qbk +++ b/doc/is_const.qbk @@ -17,6 +17,8 @@ __std_ref 3.9.3. __header ` #include ` or ` #include ` +[all_compilers] + __examples [:`is_const` inherits from `__true_type`.] diff --git a/doc/is_convertible.qbk b/doc/is_convertible.qbk index cbaf2fb..63305cb 100644 --- a/doc/is_convertible.qbk +++ b/doc/is_convertible.qbk @@ -35,10 +35,7 @@ for example: __std_ref 4 and 8.5. -__compat This template is currently broken with Borland C++ Builder 5 (and earlier), -for constructor-based conversions, and for the Metrowerks 7 (and earlier) -compiler in all cases. If the compiler does not support `__is_abstract`, then the -template parameter `To` must not be an abstract type. +[all_compilers] __header ` #include ` or ` #include ` diff --git a/doc/is_copy_assignable.qbk b/doc/is_copy_assignable.qbk index e1de31a..5555441 100644 --- a/doc/is_copy_assignable.qbk +++ b/doc/is_copy_assignable.qbk @@ -19,8 +19,7 @@ In other words, inherits from __true_type only if copy assignment of `T` from `c marked with `= delete`, `T` does not derives from `boost::noncopyable` and is not marked with `BOOST_MOVABLE_BUT_NOT_COPYABLE(T)`. -__compat If the compiler does not support partial-specialization of class -templates, then this template can not be used. +__compat Requires the C++11 features `decltype` and SFINAE-expressions for full support. If your compiler does not support C++11 deleted functions (`= delete`) or does not support SFINAE for the deleted assignments, then derive your classes from `boost::noncopyable` or diff --git a/doc/is_copy_constructible.qbk b/doc/is_copy_constructible.qbk index 0168f27..12a7d6d 100644 --- a/doc/is_copy_constructible.qbk +++ b/doc/is_copy_constructible.qbk @@ -19,14 +19,13 @@ In other words, inherits from __true_type only if copy constructor of `T` not marked with `= delete`, `T` does not derives from `boost::noncopyable` and does not marked with `BOOST_MOVABLE_BUT_NOT_COPYABLE(T)`. -__compat If the compiler does not support partial-specialization of class -templates, then this template can not be used. +__compat This trait requires the C++11 features `decltype` and SFINAE-expression support for full support. If your compiler does not support C++11 deleted functions (`= delete`) or does not support SFINAE for the deleted constructors, then derive your classes from `boost::noncopyable` or mark them with `BOOST_MOVABLE_BUT_NOT_COPYABLE(T)` to show that class is noncopyable. -Trait does not care about access modifiers, so if you see errors like this: +The trait does not care about access modifiers, so if you see errors like this: 'T::T(const T&)' is private boost/type_traits/is_copy_constructible.hpp:68:5: error: within this context diff --git a/doc/is_empty.qbk b/doc/is_empty.qbk index e89e9a4..029a300 100644 --- a/doc/is_empty.qbk +++ b/doc/is_empty.qbk @@ -24,11 +24,6 @@ by checking to see if the macro BOOST_IS_EMPTY is defined. Can not be used with incomplete types. -Can not be used with union types, until is_union can be made to work. - -If the compiler does not support partial-specialization of class templates, -then this template can not be used with abstract types. - __examples [:Given: `struct empty_class {};` ] diff --git a/doc/is_enum.qbk b/doc/is_enum.qbk index d937fa6..f31617d 100644 --- a/doc/is_enum.qbk +++ b/doc/is_enum.qbk @@ -16,10 +16,7 @@ __std_ref 3.9.2 and 7.2. __header ` #include ` or ` #include ` -__compat Requires a correctly functioning __is_convertible template; - this means that is_enum is currently broken under Borland C++ Builder 5, - and for the Metrowerks compiler prior to version 8, other compilers - should handle this template just fine. +[all_compilers] __examples diff --git a/doc/is_final.qbk b/doc/is_final.qbk index 6f3e326..e0b5f65 100644 --- a/doc/is_final.qbk +++ b/doc/is_final.qbk @@ -20,7 +20,7 @@ class types declared with the final specifier using only standard C++, as a result this type will never inherit from __true_type, unless the user explicitly specializes the template for their user-defined final class types, or unless the compiler supplies some unspecified intrinsic that implements this functionality. -Currently (Aug 2014) compilers more recent than GCC-4.7, and Clang +Currently (June 2015) compilers more recent than GCC-4.7, Oracle-12.4, and Clang have the necessary compiler __intrinsics to ensure that this trait "just works". You may also test to see if the necessary __intrinsics are available by checking to see if the macro `BOOST_IS_FINAL` is defined. diff --git a/doc/is_floating_point.qbk b/doc/is_floating_point.qbk index 43f043b..22d4b0b 100644 --- a/doc/is_floating_point.qbk +++ b/doc/is_floating_point.qbk @@ -14,6 +14,8 @@ otherwise inherits from __false_type. __std_ref 3.9.1p8. +[all_compilers] + __header ` #include ` or ` #include ` __examples diff --git a/doc/is_function.qbk b/doc/is_function.qbk index c9cbae1..9c3c91e 100644 --- a/doc/is_function.qbk +++ b/doc/is_function.qbk @@ -21,6 +21,8 @@ __is_reference respectively: __std_ref 3.9.2p1 and 8.3.5. +[all_compilers] + __header ` #include ` or ` #include ` __examples diff --git a/doc/is_fundamental.qbk b/doc/is_fundamental.qbk index 8e4b4b0..da71a8c 100644 --- a/doc/is_fundamental.qbk +++ b/doc/is_fundamental.qbk @@ -15,6 +15,8 @@ point and void types (see also __is_integral, __is_floating_point and __is_void) __std_ref 3.9.1. +[all_compilers] + __header ` #include ` or ` #include ` __examples diff --git a/doc/is_integral.qbk b/doc/is_integral.qbk index 5d4add2..b26275b 100644 --- a/doc/is_integral.qbk +++ b/doc/is_integral.qbk @@ -14,6 +14,8 @@ otherwise inherits from __false_type. __std_ref 3.9.1p7. +[all_compilers] + __header ` #include ` or ` #include ` __examples diff --git a/doc/is_lvalue_reference.qbk b/doc/is_lvalue_reference.qbk index bd5349c..7e3390e 100644 --- a/doc/is_lvalue_reference.qbk +++ b/doc/is_lvalue_reference.qbk @@ -15,10 +15,7 @@ otherwise inherits from __false_type. __std_ref 3.9.2 and 8.3.2. -__compat If the compiler does not -support partial-specialization of class templates, -then this template may report the wrong result for function types, -and for types that are both const and volatile qualified. +[all_compilers] __header ` #include ` or ` #include ` diff --git a/doc/is_member_function_pointer.qbk b/doc/is_member_function_pointer.qbk index 673b306..5f485ea 100644 --- a/doc/is_member_function_pointer.qbk +++ b/doc/is_member_function_pointer.qbk @@ -15,6 +15,8 @@ otherwise inherits from __false_type. __std_ref 3.9.2 and 8.3.3. +[all_compilers] + __header ` #include ` or ` #include ` __examples diff --git a/doc/is_member_object_pointer.qbk b/doc/is_member_object_pointer.qbk index 87510a9..75a8fbd 100644 --- a/doc/is_member_object_pointer.qbk +++ b/doc/is_member_object_pointer.qbk @@ -15,6 +15,8 @@ otherwise inherits from __false_type. __std_ref 3.9.2 and 8.3.3. +[all_compilers] + __header ` #include ` or ` #include ` __examples diff --git a/doc/is_member_pointer.qbk b/doc/is_member_pointer.qbk index f45372f..3122e7f 100644 --- a/doc/is_member_pointer.qbk +++ b/doc/is_member_pointer.qbk @@ -16,6 +16,8 @@ otherwise inherits from __false_type. __std_ref 3.9.2 and 8.3.3. +[all_compilers] + __header ` #include ` or ` #include ` __examples diff --git a/doc/type_traits.qbk b/doc/type_traits.qbk index 3c3a28d..9b0f68c 100644 --- a/doc/type_traits.qbk +++ b/doc/type_traits.qbk @@ -275,8 +275,8 @@ See __has_trivial_constructor. [include is_compound.qbk] [include is_const.qbk] [include is_convertible.qbk] -[include is_copy_constructible.qbk] [include is_copy_assignable.qbk] +[include is_copy_constructible.qbk] [include is_empty.qbk] [include is_enum.qbk] [include is_final.qbk] From 68413905af27ace9c78bd55bca87ae22111513c2 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Fri, 12 Jun 2015 19:37:19 +0100 Subject: [PATCH 23/51] Update more compiler requirements. --- doc/is_nothrow_move_assignable.qbk | 2 +- doc/is_nothrow_move_constructible.qbk | 7 +--- doc/is_object.qbk | 2 + doc/is_pod.qbk | 7 +--- doc/is_pointer.qbk | 2 + doc/is_reference.qbk | 5 +-- doc/is_rvalue_reference.qbk | 5 +-- doc/is_same.qbk | 4 +- doc/is_scalar.qbk | 3 +- doc/is_signed.qbk | 2 + doc/is_stateless.qbk | 7 +--- doc/is_union.qbk | 2 +- doc/is_unsigned.qbk | 2 + doc/is_virtual_base_of.qbk | 7 ++-- doc/is_void.qbk | 2 + doc/is_volatile.qbk | 2 + doc/make_signed.qbk | 2 + doc/make_unsigned.qbk | 2 + doc/promote.qbk | 2 + doc/rank.qbk | 2 + doc/remove_all_extents.qbk | 4 +- doc/remove_const.qbk | 4 +- doc/remove_cv.qbk | 4 +- doc/remove_extent.qbk | 4 +- doc/remove_pointer.qbk | 4 +- doc/remove_reference.qbk | 4 +- doc/remove_volatile.qbk | 4 +- test/Jamfile.v2 | 2 +- test/has_nothrow_copy_test.cpp | 2 +- test/is_nothrow_move_assignable_test.cpp | 35 ++++++++++++++++ test/is_nothrow_move_constructible_test.cpp | 45 +++++++++++++++++++++ 31 files changed, 126 insertions(+), 55 deletions(-) diff --git a/doc/is_nothrow_move_assignable.qbk b/doc/is_nothrow_move_assignable.qbk index 5e0edb9..782f2c4 100644 --- a/doc/is_nothrow_move_assignable.qbk +++ b/doc/is_nothrow_move_assignable.qbk @@ -25,7 +25,7 @@ templates, then this template can not be used with function types. Without some (C++11 noexcept shall work correctly) help from the compiler, `is_nothrow_move_assignable` will never report that a class or struct has a non-throwing assignment-operator; this is always safe, if possibly sub-optimal. -Currently (February 2013) Clang and GCC 4.7 have the necessary compiler support to ensure that this +Currently (June 2015) MSVC-12.0, Clang and GCC 4.7 have the necessary compiler support to ensure that this trait "just works". __header ` #include ` or ` #include ` diff --git a/doc/is_nothrow_move_constructible.qbk b/doc/is_nothrow_move_constructible.qbk index 863054b..533f4fc 100644 --- a/doc/is_nothrow_move_constructible.qbk +++ b/doc/is_nothrow_move_constructible.qbk @@ -19,13 +19,10 @@ must be a complete type. In other words, inherits from __true_type only if expression `T(std::move(variable1))` won't throw (`variable1` is a variable of type `T`). -__compat If the compiler does not support partial-specialization of class -templates, then this template can not be used with function types. - -Without some (C++11 noexcept shall work correctly) help from the compiler, +__compat Without some (C++11 noexcept shall work correctly) help from the compiler, `is_nothrow_move_constructible` will never report that a class or struct has a non-throwing copy-constructor; this is always safe, if possibly sub-optimal. -Currently (February 2013) Clang and GCC 4.7 have the necessary compiler support to ensure that this +Currently (February 2013) MSVC-12.0, Clang and GCC 4.7 have the necessary compiler support to ensure that this trait "just works". __header ` #include ` or ` #include ` diff --git a/doc/is_object.qbk b/doc/is_object.qbk index 4f14c44..8d9e85c 100644 --- a/doc/is_object.qbk +++ b/doc/is_object.qbk @@ -16,6 +16,8 @@ references, void, and function types. __std_ref 3.9p9. +[all_compilers] + __header ` #include ` or ` #include ` __examples diff --git a/doc/is_pod.qbk b/doc/is_pod.qbk index 1c36dc7..43aff17 100644 --- a/doc/is_pod.qbk +++ b/doc/is_pod.qbk @@ -23,13 +23,10 @@ still a POD, as is an array of PODs. __std_ref 3.9p10 and 9p4 (Note that POD's are also aggregates, see 8.5.1). -__compat If the compiler does not support partial-specialization -of class templates, then this template can not be used with function types. - -Without some (as yet unspecified) help from the compiler, is_pod will +__compat Without some (as yet unspecified) help from the compiler, is_pod will never report that a class or struct is a POD; this is always safe, if possibly sub-optimal. -Currently (May 2011) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0, +Currently (June 2015) compilers more recent than Visual C++ 8, Clang-3, GCC-4.3, Greenhills 6.0, Intel-11.0, and Codegear have the necessary compiler __intrinsics to ensure that this trait "just works". You may also test to see if the necessary __intrinsics are available by checking to see if the macro `BOOST_IS_POD` is defined. diff --git a/doc/is_pointer.qbk b/doc/is_pointer.qbk index da57229..2afa4c3 100644 --- a/doc/is_pointer.qbk +++ b/doc/is_pointer.qbk @@ -17,6 +17,8 @@ __std_ref 3.9.2p2 and 8.3.1. __header ` #include ` or ` #include ` +[all_compilers] + __examples [:`is_pointer` inherits from `__true_type`.] diff --git a/doc/is_reference.qbk b/doc/is_reference.qbk index baf6bf4..253846b 100644 --- a/doc/is_reference.qbk +++ b/doc/is_reference.qbk @@ -15,10 +15,7 @@ otherwise inherits from __false_type. __std_ref 3.9.2 and 8.3.2. -__compat If the compiler does not -support partial-specialization of class templates, -then this template may report the wrong result for function types, -and for types that are both const and volatile qualified. +[all_compilers] __header ` #include ` or ` #include ` diff --git a/doc/is_rvalue_reference.qbk b/doc/is_rvalue_reference.qbk index edf0964..975e156 100644 --- a/doc/is_rvalue_reference.qbk +++ b/doc/is_rvalue_reference.qbk @@ -15,10 +15,7 @@ otherwise inherits from __false_type. __std_ref 3.9.2 and 8.3.2. -__compat If the compiler does not -support partial-specialization of class templates, -then this template may report the wrong result for function types, -and for types that are both const and volatile qualified. +[all_compilers] __header ` #include ` or ` #include ` diff --git a/doc/is_same.qbk b/doc/is_same.qbk index d054988..ed931c1 100644 --- a/doc/is_same.qbk +++ b/doc/is_same.qbk @@ -14,8 +14,8 @@ __true_type, otherwise inherits from __false_type. __header ` #include ` or ` #include ` -__compat If the compiler does not support partial-specialization of class templates, -then this template can not be used with abstract, incomplete or function types. +[all_compilers] + __examples diff --git a/doc/is_scalar.qbk b/doc/is_scalar.qbk index 4ec966c..745f483 100644 --- a/doc/is_scalar.qbk +++ b/doc/is_scalar.qbk @@ -17,8 +17,7 @@ __std_ref 3.9p10. __header ` #include ` or ` #include ` -__compat If the compiler does not support partial-specialization of class templates, -then this template can not be used with function types. +[all_compilers] __examples diff --git a/doc/is_signed.qbk b/doc/is_signed.qbk index 8d43c91..64d7184 100644 --- a/doc/is_signed.qbk +++ b/doc/is_signed.qbk @@ -16,6 +16,8 @@ otherwise inherits from __false_type. __std_ref 3.9.1, 7.2. +[all_compilers] + __header ` #include ` or ` #include ` __examples diff --git a/doc/is_stateless.qbk b/doc/is_stateless.qbk index d2de82f..58f460d 100644 --- a/doc/is_stateless.qbk +++ b/doc/is_stateless.qbk @@ -28,13 +28,10 @@ __std_ref 3.9p10. __header ` #include ` or ` #include ` -__compat If the compiler does not support partial-specialization of class templates, -then this template can not be used with function types. - -Without some (as yet unspecified) help from the compiler, is_stateless will never +__compat Without some (as yet unspecified) help from the compiler, is_stateless will never report that a class or struct is stateless; this is always safe, if possibly sub-optimal. -Currently (May 2011) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0, +Currently (June 2015) compilers more recent than Visual C++ 8, Clang, GCC-4.3, Greenhills 6.0, Intel-11.0, and Codegear have the necessary compiler __intrinsics to ensure that this trait "just works". diff --git a/doc/is_union.qbk b/doc/is_union.qbk index e8203b7..c21ca22 100644 --- a/doc/is_union.qbk +++ b/doc/is_union.qbk @@ -20,7 +20,7 @@ compiler, we cannot distinguish between union and class types using only standar as a result this type will never inherit from __true_type, unless the user explicitly specializes the template for their user-defined union types, or unless the compiler supplies some unspecified intrinsic that implements this functionality. -Currently (May 2011) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0, +Currently (June 2015) compilers more recent than Visual C++ 8, clang, GCC-4.3, Greenhills 6.0, Intel-11.0, and Codegear have the necessary compiler __intrinsics to ensure that this trait "just works". You may also test to see if the necessary __intrinsics are available by checking to see if the macro `BOOST_IS_UNION` is defined. diff --git a/doc/is_unsigned.qbk b/doc/is_unsigned.qbk index adf1926..a6366ae 100644 --- a/doc/is_unsigned.qbk +++ b/doc/is_unsigned.qbk @@ -16,6 +16,8 @@ otherwise inherits from __false_type. __std_ref 3.9.1, 7.2. +[all_compilers] + __header ` #include ` or ` #include ` __examples diff --git a/doc/is_virtual_base_of.qbk b/doc/is_virtual_base_of.qbk index e229bc5..0c52d57 100644 --- a/doc/is_virtual_base_of.qbk +++ b/doc/is_virtual_base_of.qbk @@ -18,12 +18,13 @@ __std_ref 10. __header ` #include ` or ` #include ` -__compat this trait also requires a working __is_base_of trait. +[all_compilers] [note There are a small number of cases where it's simply not possible for this trait to work, and -where attempting to instantiate the trait will cause compiler errors (see bug report -[@https://svn.boost.org/trac/boost/ticket/3730 #3730]). Further more the issues may well +where attempting to instantiate the trait will cause compiler errors (see bug reports +[@https://svn.boost.org/trac/boost/ticket/3730 #3730] and [@https://svn.boost.org/trac/boost/ticket/11323 11323]). +Further more the issues may well be compiler specific. In this situation the user should supply a full specialization of the trait to work around the problem.] diff --git a/doc/is_void.qbk b/doc/is_void.qbk index b99e586..7415371 100644 --- a/doc/is_void.qbk +++ b/doc/is_void.qbk @@ -14,6 +14,8 @@ otherwise inherits from __false_type. __std_ref 3.9.1p9. +[all_compilers] + __header ` #include ` or ` #include ` __examples diff --git a/doc/is_volatile.qbk b/doc/is_volatile.qbk index 4ce311a..f835100 100644 --- a/doc/is_volatile.qbk +++ b/doc/is_volatile.qbk @@ -14,6 +14,8 @@ otherwise inherits from __false_type. __std_ref 3.9.3. +[all_compilers] + __header ` #include ` or ` #include ` __examples diff --git a/doc/make_signed.qbk b/doc/make_signed.qbk index 87fa3ac..cba7b19 100644 --- a/doc/make_signed.qbk +++ b/doc/make_signed.qbk @@ -26,6 +26,8 @@ bool. __std_ref 3.9.1. +[all_compilers] + __header ` #include ` or ` #include ` [table Examples diff --git a/doc/make_unsigned.qbk b/doc/make_unsigned.qbk index cd9bd76..2e6cb41 100644 --- a/doc/make_unsigned.qbk +++ b/doc/make_unsigned.qbk @@ -26,6 +26,8 @@ bool. __std_ref 3.9.1. +[all_compilers] + __header ` #include ` or ` #include ` [table Examples diff --git a/doc/promote.qbk b/doc/promote.qbk index 3ed5c6f..0ce8370 100644 --- a/doc/promote.qbk +++ b/doc/promote.qbk @@ -20,6 +20,8 @@ __integral_promotion and __floating_point_promotion. __std_ref 4.5 except 4.5/3 (integral bit-field) and 4.6. +[all_compilers] + __header ` #include ` or ` #include ` [table Examples diff --git a/doc/rank.qbk b/doc/rank.qbk index 984a604..4268635 100644 --- a/doc/rank.qbk +++ b/doc/rank.qbk @@ -14,6 +14,8 @@ where `RANK(T)` is the number of array dimensions in type `T`. If `T` is not a (built-in) array type, then `RANK(T)` is zero. +[all_compilers] + __header ` #include ` or ` #include ` __examples diff --git a/doc/remove_all_extents.qbk b/doc/remove_all_extents.qbk index 3ab9899..be9d309 100644 --- a/doc/remove_all_extents.qbk +++ b/doc/remove_all_extents.qbk @@ -18,9 +18,7 @@ leaves `T` unchanged. __std_ref 8.3.4. -__compat If the compiler does not support partial specialization of class-templates -then this template will compile, but the member `type` will always be the same as -type `T` except where __transform_workaround have been applied. +[all_compilers] __header ` #include ` or ` #include ` diff --git a/doc/remove_const.qbk b/doc/remove_const.qbk index 9e24aa5..ea3b7e1 100644 --- a/doc/remove_const.qbk +++ b/doc/remove_const.qbk @@ -17,9 +17,7 @@ __type The same type as `T`, but with any /top level/ const-qualifier removed. __std_ref 3.9.3. -__compat If the compiler does not support partial specialization of class-templates -then this template will compile, but the member `type` will always be the same as -type `T` except where __transform_workaround have been applied. +[all_compilers] __header ` #include ` or ` #include ` diff --git a/doc/remove_cv.qbk b/doc/remove_cv.qbk index 23c342c..c7a296b 100644 --- a/doc/remove_cv.qbk +++ b/doc/remove_cv.qbk @@ -17,9 +17,7 @@ __type The same type as `T`, but with any /top level/ cv-qualifiers removed. __std_ref 3.9.3. -__compat If the compiler does not support partial specialization of class-templates -then this template will compile, but the member `type` will always be the same as -type `T` except where __transform_workaround have been applied. +[all_compilers] __header ` #include ` or ` #include ` diff --git a/doc/remove_extent.qbk b/doc/remove_extent.qbk index 445af02..fe5f3f1 100644 --- a/doc/remove_extent.qbk +++ b/doc/remove_extent.qbk @@ -18,9 +18,7 @@ otherwise leaves `T` unchanged. __std_ref 8.3.4. -__compat If the compiler does not support partial specialization of class-templates -then this template will compile, but the member `type` will always be the same as -type `T` except where __transform_workaround have been applied. +[all_compilers] __header ` #include ` or ` #include ` diff --git a/doc/remove_pointer.qbk b/doc/remove_pointer.qbk index 0504252..7f0af89 100644 --- a/doc/remove_pointer.qbk +++ b/doc/remove_pointer.qbk @@ -18,9 +18,7 @@ removing the pointer decoration would result in an invalid type. __std_ref 8.3.1. -__compat If the compiler does not support partial specialization of class-templates -then this template will compile, but the member `type` will always be the same as -type `T` except where __transform_workaround have been applied. +[all_compilers] __header ` #include ` or ` #include ` diff --git a/doc/remove_reference.qbk b/doc/remove_reference.qbk index 1ed0b96..a8af148 100644 --- a/doc/remove_reference.qbk +++ b/doc/remove_reference.qbk @@ -17,9 +17,7 @@ __type The same type as `T`, but with any reference modifier removed. __std_ref 8.3.2. -__compat If the compiler does not support partial specialization of class-templates -then this template will compile, but the member `type` will always be the same as -type `T` except where __transform_workaround have been applied. +[all_compilers] __header ` #include ` or ` #include ` diff --git a/doc/remove_volatile.qbk b/doc/remove_volatile.qbk index e63beb6..822661e 100644 --- a/doc/remove_volatile.qbk +++ b/doc/remove_volatile.qbk @@ -17,9 +17,7 @@ __type The same type as `T`, but with any /top level/ volatile-qualifier removed __std_ref 3.9.3. -__compat If the compiler does not support partial specialization of class-templates -then this template will compile, but the member `type` will always be the same as -type `T` except where __transform_workaround have been applied. +[all_compilers] __header ` #include ` or ` #include ` diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 2b6928e..8dd1891 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -29,7 +29,7 @@ rule all-tests { { result += [ run $(source) ] ; } - for local source in has_nothrow_assign_test has_nothrow_constr_test has_nothrow_copy_test + for local source in has_nothrow_assign_test has_nothrow_constr_test has_nothrow_copy_test is_nothrow_move_assignable_test is_nothrow_move_constructible_test { result += [ run $(source).cpp : : : BOOST_TT_DISABLE_INTRINSICS : $(source)_no_intrinsics ] ; } diff --git a/test/has_nothrow_copy_test.cpp b/test/has_nothrow_copy_test.cpp index a389abd..034cb65 100644 --- a/test/has_nothrow_copy_test.cpp +++ b/test/has_nothrow_copy_test.cpp @@ -34,7 +34,7 @@ struct delete_copy struct noexcept_copy { noexcept_copy(); - noexcept_copy& operator=(const non_copy&)noexcept; + noexcept_copy& operator=(const noexcept_copy&)noexcept; }; #endif diff --git a/test/is_nothrow_move_assignable_test.cpp b/test/is_nothrow_move_assignable_test.cpp index 9240a0e..ada0484 100644 --- a/test/is_nothrow_move_assignable_test.cpp +++ b/test/is_nothrow_move_assignable_test.cpp @@ -13,6 +13,33 @@ # include #endif +#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS + +struct non_assignable +{ + non_assignable(); + non_assignable& operator=(const non_assignable&) = delete; +}; + +#endif + +#ifndef BOOST_NO_CXX11_NOEXCEPT + +struct noexcept_assignable +{ + noexcept_assignable(); + noexcept_assignable& operator=(const non_assignable&)noexcept; +}; + +struct noexcept_move_assignable +{ + noexcept_move_assignable(); + noexcept_move_assignable& operator=(const noexcept_move_assignable&); + noexcept_move_assignable& operator=(noexcept_move_assignable&&)noexcept; +}; + +#endif + TT_TEST_BEGIN(is_nothrow_move_assignable) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_assignable::value, true); @@ -214,6 +241,14 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_assignable BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_assignable::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_assignable::value, false); +#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_assignable::value, false); +#endif +#ifndef BOOST_NO_CXX11_NOEXCEPT +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_assignable::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_assignable::value, true); +#endif + TT_TEST_END diff --git a/test/is_nothrow_move_constructible_test.cpp b/test/is_nothrow_move_constructible_test.cpp index 7a196ed..d756edc 100644 --- a/test/is_nothrow_move_constructible_test.cpp +++ b/test/is_nothrow_move_constructible_test.cpp @@ -14,6 +14,40 @@ # include #endif +struct non_copy +{ + non_copy(); +private: + non_copy(const non_copy&); +}; + +#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS + +struct delete_copy +{ + delete_copy(); + delete_copy(const delete_copy&) = delete; +}; + +#endif + +#ifndef BOOST_NO_CXX11_NOEXCEPT + +struct noexcept_copy +{ + noexcept_copy(); + noexcept_copy(const noexcept_copy&)noexcept; +}; + +struct noexcept_move +{ + noexcept_move(); + noexcept_move(const noexcept_move&); + noexcept_move(noexcept_move&&)noexcept; +}; + +#endif + TT_TEST_BEGIN(is_nothrow_move_constructible) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, true); @@ -211,6 +245,17 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, false); + +#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, false); +#endif + +#ifndef BOOST_NO_CXX11_NOEXCEPT +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, true); +#endif + TT_TEST_END From 739956e5614a9e81c838c4c57d40d1c6a91aaffe Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sat, 13 Jun 2015 13:09:04 +0100 Subject: [PATCH 24/51] Update type_traits.hpp to include lots of otherwise missing stuff. --- include/boost/type_traits.hpp | 66 +++++++++++++++++++++++++++++------ 1 file changed, 55 insertions(+), 11 deletions(-) diff --git a/include/boost/type_traits.hpp b/include/boost/type_traits.hpp index 8658363..57680f8 100644 --- a/include/boost/type_traits.hpp +++ b/include/boost/type_traits.hpp @@ -27,38 +27,81 @@ #include "boost/type_traits/extent.hpp" #include "boost/type_traits/floating_point_promotion.hpp" #include "boost/type_traits/function_traits.hpp" + +#include "boost/type_traits/has_bit_and.hpp" +#include "boost/type_traits/has_bit_and_assign.hpp" +#include "boost/type_traits/has_bit_or.hpp" +#include "boost/type_traits/has_bit_or_assign.hpp" +#include "boost/type_traits/has_bit_xor.hpp" +#include "boost/type_traits/has_bit_xor_assign.hpp" +#include "boost/type_traits/has_complement.hpp" +#include "boost/type_traits/has_dereference.hpp" +#include "boost/type_traits/has_divides.hpp" +#include "boost/type_traits/has_divides_assign.hpp" +#include "boost/type_traits/has_equal_to.hpp" +#include "boost/type_traits/has_greater.hpp" +#include "boost/type_traits/has_greater_equal.hpp" +#include "boost/type_traits/has_left_shift.hpp" +#include "boost/type_traits/has_left_shift_assign.hpp" +#include "boost/type_traits/has_less.hpp" +#include "boost/type_traits/has_less_equal.hpp" +#include "boost/type_traits/has_logical_and.hpp" +#include "boost/type_traits/has_logical_not.hpp" +#include "boost/type_traits/has_logical_or.hpp" +#include "boost/type_traits/has_minus.hpp" +#include "boost/type_traits/has_minus_assign.hpp" +#include "boost/type_traits/has_modulus.hpp" +#include "boost/type_traits/has_modulus_assign.hpp" +#include "boost/type_traits/has_multiplies.hpp" +#include "boost/type_traits/has_multiplies_assign.hpp" +#include "boost/type_traits/has_negate.hpp" #if !defined(__BORLANDC__) && !defined(__CUDACC__) #include "boost/type_traits/has_new_operator.hpp" #endif +#include "boost/type_traits/has_not_equal_to.hpp" #include "boost/type_traits/has_nothrow_assign.hpp" #include "boost/type_traits/has_nothrow_constructor.hpp" #include "boost/type_traits/has_nothrow_copy.hpp" #include "boost/type_traits/has_nothrow_destructor.hpp" -#include +#include "boost/type_traits/has_plus.hpp" +#include "boost/type_traits/has_plus_assign.hpp" +#include "boost/type_traits/has_post_decrement.hpp" +#include "boost/type_traits/has_post_increment.hpp" +#include "boost/type_traits/has_pre_decrement.hpp" +#include "boost/type_traits/has_pre_increment.hpp" +#include "boost/type_traits/has_right_shift.hpp" +#include "boost/type_traits/has_right_shift_assign.hpp" #include "boost/type_traits/has_trivial_assign.hpp" #include "boost/type_traits/has_trivial_constructor.hpp" #include "boost/type_traits/has_trivial_copy.hpp" #include "boost/type_traits/has_trivial_destructor.hpp" #include "boost/type_traits/has_trivial_move_assign.hpp" #include "boost/type_traits/has_trivial_move_constructor.hpp" +#include "boost/type_traits/has_unary_minus.hpp" +#include "boost/type_traits/has_unary_plus.hpp" #include "boost/type_traits/has_virtual_destructor.hpp" + +#include "boost/type_traits/integral_constant.hpp" + #include "boost/type_traits/is_abstract.hpp" -#include "boost/type_traits/is_assignable.hpp" #include "boost/type_traits/is_arithmetic.hpp" #include "boost/type_traits/is_array.hpp" +#include "boost/type_traits/is_assignable.hpp" #include "boost/type_traits/is_base_and_derived.hpp" #include "boost/type_traits/is_base_of.hpp" #include "boost/type_traits/is_class.hpp" -#include +#include "boost/type_traits/is_complex.hpp" #include "boost/type_traits/is_compound.hpp" #include "boost/type_traits/is_const.hpp" #include "boost/type_traits/is_constructible.hpp" #include "boost/type_traits/is_convertible.hpp" -#include "boost/type_traits/is_copy_constructible.hpp" #include "boost/type_traits/is_copy_assignable.hpp" +#include "boost/type_traits/is_copy_constructible.hpp" #include "boost/type_traits/is_default_constructible.hpp" +#include "boost/type_traits/is_destructible.hpp" #include "boost/type_traits/is_empty.hpp" #include "boost/type_traits/is_enum.hpp" +#include "boost/type_traits/is_final.hpp" #include "boost/type_traits/is_float.hpp" #include "boost/type_traits/is_floating_point.hpp" #include "boost/type_traits/is_function.hpp" @@ -72,32 +115,33 @@ #include "boost/type_traits/is_nothrow_move_constructible.hpp" #include "boost/type_traits/is_object.hpp" #include "boost/type_traits/is_pod.hpp" -#include "boost/type_traits/is_polymorphic.hpp" #include "boost/type_traits/is_pointer.hpp" +#include "boost/type_traits/is_polymorphic.hpp" #include "boost/type_traits/is_reference.hpp" #include "boost/type_traits/is_rvalue_reference.hpp" -#include "boost/type_traits/is_signed.hpp" #include "boost/type_traits/is_same.hpp" #include "boost/type_traits/is_scalar.hpp" +#include "boost/type_traits/is_signed.hpp" #include "boost/type_traits/is_stateless.hpp" #include "boost/type_traits/is_union.hpp" #include "boost/type_traits/is_unsigned.hpp" -#include "boost/type_traits/is_void.hpp" #include "boost/type_traits/is_virtual_base_of.hpp" +#include "boost/type_traits/is_void.hpp" #include "boost/type_traits/is_volatile.hpp" -#include -#include +#include "boost/type_traits/make_signed.hpp" +#include "boost/type_traits/make_unsigned.hpp" #include "boost/type_traits/rank.hpp" -#include "boost/type_traits/remove_bounds.hpp" -#include "boost/type_traits/remove_extent.hpp" #include "boost/type_traits/remove_all_extents.hpp" +#include "boost/type_traits/remove_bounds.hpp" #include "boost/type_traits/remove_const.hpp" #include "boost/type_traits/remove_cv.hpp" +#include "boost/type_traits/remove_extent.hpp" #include "boost/type_traits/remove_pointer.hpp" #include "boost/type_traits/remove_reference.hpp" #include "boost/type_traits/remove_volatile.hpp" #include "boost/type_traits/type_identity.hpp" #include "boost/type_traits/type_with_alignment.hpp" + #if !(defined(__sgi) && defined(__EDG_VERSION__) && (__EDG_VERSION__ == 238)) #include "boost/type_traits/integral_promotion.hpp" #include "boost/type_traits/promote.hpp" From e68fddd99246c9bff4dc8198b0b4e21b7db4f93a Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sat, 13 Jun 2015 19:19:22 +0100 Subject: [PATCH 25/51] Document new traits classes. --- doc/history.qbk | 2 + doc/is_assignable.qbk | 40 +++++++++++++++++ doc/is_constructible.qbk | 44 +++++++++++++++++++ doc/is_default_constructible.qbk | 23 ++++++++++ doc/is_destructible.qbk | 23 ++++++++++ doc/type_traits.qbk | 8 ++++ doc/value_traits.qbk | 21 +++++++++ .../boost/type_traits/has_nothrow_assign.hpp | 4 +- 8 files changed, 163 insertions(+), 2 deletions(-) create mode 100644 doc/is_assignable.qbk create mode 100644 doc/is_constructible.qbk create mode 100644 doc/is_default_constructible.qbk create mode 100644 doc/is_destructible.qbk diff --git a/doc/history.qbk b/doc/history.qbk index 21b7011..45abeef 100644 --- a/doc/history.qbk +++ b/doc/history.qbk @@ -11,6 +11,8 @@ * Refactored traits to depend only on Boost.Config. Greatly simplified code to improve readability and remove workarounds for old compilers no longer supported. * Fix __decay to follow C++11 semantics, see [@https://svn.boost.org/trac/boost/ticket/7760 #7760]. +* Added a number of new traits __is_assignable, __is_default_constructible, __is_constructible and __is_destructible required to fix bugs in a number of other traits, +see for example [@https://svn.boost.org/trac/boost/ticket/7760 #11324]. [h4 Boost 1.58.0] diff --git a/doc/is_assignable.qbk b/doc/is_assignable.qbk new file mode 100644 index 0000000..fe4089e --- /dev/null +++ b/doc/is_assignable.qbk @@ -0,0 +1,40 @@ +[/ + Copyright 2015 John Maddock. + Distributed under 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). +] + +[section:is_assignable is_assignable] + + template + struct is_assignable : public __tof {}; + +__inherit If `std::declval() = std::declval()` then inherits from __true_type, +otherwise from __flase_type. Type `T` must be a complete type. + +Note that this trait is somewhat tricky to use correctly: for example: + + is_assignable::value + +is `false` since `std::declval()` is an ['xvalue] which can not be assigned to! + +If you're intention is to check for copy-assignment from some type U then use: + + is_assignable::value + +If you're intention is to check for move-assignment then use: + + is_assignable::value + +or simply: + + is_assignable::value + + +__compat Requires the C++11 features `decltype` and SFINAE-expressions for full support. + +__header ` #include ` or ` #include ` + +[endsect] + diff --git a/doc/is_constructible.qbk b/doc/is_constructible.qbk new file mode 100644 index 0000000..b301a25 --- /dev/null +++ b/doc/is_constructible.qbk @@ -0,0 +1,44 @@ +[/ + Copyright 2015 John Maddock. + Distributed under 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). +] + +[section:is_constructible is_constructible] + + template + struct is_constructible : public __tof {}; + +__inherit If `T` can be constructed from `Args`, +then inherits from __true_type, otherwise inherits from __false_type. Type `T` +must be a complete type. + +Formally the trait answers the question, is the expression: + + T t(std::declval()...); + +valid? + +There are a number of important special cases for this trait: + + is_constructible::value + +Indicates whether `T` is default constructible, while: + + is_constructible::value + +Indicates whether `T` is copy-constructible, and: + + is_constructible::value + +Indicates whether `T` is move-constructible. + + +__compat This trait requires the C++11 features `decltype` variadic templates and SFINAE-expression support for full support. +While there is some fallback code for cases where this is not the case, the trait should really be considered broken in that case. + +__header ` #include ` or ` #include ` + +[endsect] + diff --git a/doc/is_default_constructible.qbk b/doc/is_default_constructible.qbk new file mode 100644 index 0000000..94caf25 --- /dev/null +++ b/doc/is_default_constructible.qbk @@ -0,0 +1,23 @@ +[/ + Copyright 2015 John Maddock. + Distributed under 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). +] + +[section:is_default_constructible is_default_constructible] + + template + struct is_default_constructible : public __tof {}; + +__inherit If `T` can be default-constructed +then inherits from __true_type, otherwise inherits from __false_type. Type `T` +must be a complete type. + +__compat This trait requires the C++11 feature `decltype` support for full support. +While there is some fallback code for cases where this is not the case, the trait should really be considered broken in that case. + +__header ` #include ` or ` #include ` + +[endsect] + diff --git a/doc/is_destructible.qbk b/doc/is_destructible.qbk new file mode 100644 index 0000000..335b245 --- /dev/null +++ b/doc/is_destructible.qbk @@ -0,0 +1,23 @@ +[/ + Copyright 2015 John Maddock. + Distributed under 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). +] + +[section:is_destructible is_destructible] + + template + struct is_destructible : public __tof {}; + +__inherit If `T` does not have its destructor deleted +then inherits from __true_type, otherwise inherits from __false_type. Type `T` +must be a complete type. + +__compat This trait requires the C++11 features `decltype` and SFINAE-expression support for full support. +While there is some fallback code for cases where this is not the case, the trait should really be considered broken in that case. + +__header ` #include ` or ` #include ` + +[endsect] + diff --git a/doc/type_traits.qbk b/doc/type_traits.qbk index 9b0f68c..8a914a4 100644 --- a/doc/type_traits.qbk +++ b/doc/type_traits.qbk @@ -68,8 +68,12 @@ [def __extent [link boost_typetraits.reference.extent extent]] [def __is_empty [link boost_typetraits.reference.is_empty is_empty]] [def __is_const [link boost_typetraits.reference.is_const is_const]] +[def __is_assignable [link boost_typetraits.reference.is_assignable is_assignable]] [def __is_copy_constructible [link boost_typetraits.reference.is_copy_constructible is_copy_constructible]] [def __is_copy_assignable [link boost_typetraits.reference.is_copy_assignable is_copy_assignable]] +[def __is_constructible [link boost_typetraits.reference.is_constructible is_constructible]] +[def __is_default_constructible [link boost_typetraits.reference.is_default_constructible is_default_constructible]] +[def __is_destructible [link boost_typetraits.reference.is_destructible is_destructible]] [def __is_volatile [link boost_typetraits.reference.is_volatile is_volatile]] [def __is_abstract [link boost_typetraits.reference.is_abstract is_abstract]] [def __is_polymorphic [link boost_typetraits.reference.is_polymorphic is_polymorphic]] @@ -269,14 +273,18 @@ See __has_trivial_constructor. [include is_abstract.qbk] [include is_arithmetic.qbk] [include is_array.qbk] +[include is_assignable.qbk] [include is_base_of.qbk] [include is_class.qbk] [include is_complex.qbk] [include is_compound.qbk] [include is_const.qbk] +[include is_constructible.qbk] [include is_convertible.qbk] [include is_copy_assignable.qbk] [include is_copy_constructible.qbk] +[include is_default_constructible.qbk] +[include is_destructible.qbk] [include is_empty.qbk] [include is_enum.qbk] [include is_final.qbk] diff --git a/doc/value_traits.qbk b/doc/value_traits.qbk index c782cdd..5f667aa 100644 --- a/doc/value_traits.qbk +++ b/doc/value_traits.qbk @@ -153,12 +153,33 @@ The following templates describe the general properties of a type. template struct __is_abstract; + template + struct __is_assignable; + + template + struct __is_copy_constructible; + + template + struct __is_copy_assignable; + + template + struct __is_constructible; + + template + struct __is_default_constructible; + + template + struct __is_destructible; + template struct __is_const; template struct __is_empty; + template + struct __is_final; + template struct __is_stateless; diff --git a/include/boost/type_traits/has_nothrow_assign.hpp b/include/boost/type_traits/has_nothrow_assign.hpp index c864eef..0be0b2f 100644 --- a/include/boost/type_traits/has_nothrow_assign.hpp +++ b/include/boost/type_traits/has_nothrow_assign.hpp @@ -15,7 +15,7 @@ #if !defined(BOOST_HAS_NOTHROW_ASSIGN) || defined(BOOST_MSVC) || defined(BOOST_INTEL) #include #if !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) -#include +#include #include #include #include @@ -39,7 +39,7 @@ namespace boost { namespace detail { template struct has_nothrow_assign_imp{ static const bool value = false; }; - template struct has_nothrow_assign_imp{ static const bool value = noexcept(detail::tt_decl_ref() = detail::tt_decl_const_ref()); }; + template struct has_nothrow_assign_imp{ static const bool value = noexcept(boost::declval::type>() = boost::declval::type>()); }; template struct has_nothrow_assign_imp{ static const bool value = has_nothrow_assign_imp::value; }; template struct has_nothrow_assign_imp{ static const bool value = has_nothrow_assign_imp::value; }; } From 2f2ca65e484199b982a629429af8d94b179de84f Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sun, 14 Jun 2015 09:30:46 +0100 Subject: [PATCH 26/51] Switch to using boost::declval. Change has_nothrow_copy to use is_copy_constructible as it has better broken-compiler workarounds than is_constructible. --- include/boost/type_traits/has_nothrow_assign.hpp | 3 ++- include/boost/type_traits/has_nothrow_copy.hpp | 10 +++++----- include/boost/type_traits/has_nothrow_destructor.hpp | 4 ++-- include/boost/type_traits/intrinsics.hpp | 2 +- include/boost/type_traits/is_assignable.hpp | 4 ++-- include/boost/type_traits/is_constructible.hpp | 10 +++++----- include/boost/type_traits/is_copy_constructible.hpp | 4 ++-- include/boost/type_traits/is_destructible.hpp | 4 ++-- test/Jamfile.v2 | 3 +++ 9 files changed, 24 insertions(+), 20 deletions(-) diff --git a/include/boost/type_traits/has_nothrow_assign.hpp b/include/boost/type_traits/has_nothrow_assign.hpp index 0be0b2f..9458ef3 100644 --- a/include/boost/type_traits/has_nothrow_assign.hpp +++ b/include/boost/type_traits/has_nothrow_assign.hpp @@ -15,12 +15,13 @@ #if !defined(BOOST_HAS_NOTHROW_ASSIGN) || defined(BOOST_MSVC) || defined(BOOST_INTEL) #include #if !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) -#include +#include #include #include #include #include #include +#include #endif #endif #if defined(__GNUC__) || defined(__SUNPRO_CC) diff --git a/include/boost/type_traits/has_nothrow_copy.hpp b/include/boost/type_traits/has_nothrow_copy.hpp index 1d4ae0e..a62476c 100644 --- a/include/boost/type_traits/has_nothrow_copy.hpp +++ b/include/boost/type_traits/has_nothrow_copy.hpp @@ -16,7 +16,7 @@ #if defined(BOOST_CLANG) || defined(__GNUC__) || defined(__ghs__) || defined(__CODEGEARC__) #include -#include +#include #include #ifdef BOOST_INTEL #include @@ -32,8 +32,8 @@ template struct has_nothrow_copy_constructor : public integral_constan #elif !defined(BOOST_NO_CXX11_NOEXCEPT) -#include -#include +#include +#include namespace boost{ @@ -42,11 +42,11 @@ namespace detail{ template struct has_nothrow_copy_constructor_imp : public boost::integral_constant{}; template -struct has_nothrow_copy_constructor_imp : public boost::integral_constant()))>{}; +struct has_nothrow_copy_constructor_imp : public boost::integral_constant()))>{}; } -template struct has_nothrow_copy_constructor : public detail::has_nothrow_copy_constructor_imp::value>{}; +template struct has_nothrow_copy_constructor : public detail::has_nothrow_copy_constructor_imp::value>{}; template struct has_nothrow_copy_constructor : public integral_constant{}; template struct has_nothrow_copy_constructor : public integral_constant{}; template struct has_nothrow_copy_constructor : public integral_constant{}; diff --git a/include/boost/type_traits/has_nothrow_destructor.hpp b/include/boost/type_traits/has_nothrow_destructor.hpp index a3cf832..7132a6b 100644 --- a/include/boost/type_traits/has_nothrow_destructor.hpp +++ b/include/boost/type_traits/has_nothrow_destructor.hpp @@ -13,7 +13,7 @@ #if !defined(BOOST_NO_CXX11_NOEXCEPT) -#include +#include #include namespace boost{ @@ -23,7 +23,7 @@ namespace boost{ template struct has_nothrow_destructor_imp : public boost::integral_constant{}; template - struct has_nothrow_destructor_imp : public boost::integral_constant()->~T())>{}; + struct has_nothrow_destructor_imp : public boost::integral_constant()->~T())>{}; } diff --git a/include/boost/type_traits/intrinsics.hpp b/include/boost/type_traits/intrinsics.hpp index b78e1eb..04d7ef7 100644 --- a/include/boost/type_traits/intrinsics.hpp +++ b/include/boost/type_traits/intrinsics.hpp @@ -244,7 +244,7 @@ # define BOOST_HAS_TRIVIAL_ASSIGN(T) ((__has_trivial_assign(T) BOOST_INTEL_TT_OPTS) && ! ::boost::is_volatile::value && ! ::boost::is_const::value && is_assignable::value) # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) BOOST_INTEL_TT_OPTS && is_destructible::value) # define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_constructor(T) && is_default_constructible::value BOOST_INTEL_TT_OPTS) -# define BOOST_HAS_NOTHROW_COPY(T) ((__has_nothrow_copy(T) BOOST_INTEL_TT_OPTS) && !is_volatile::value && !is_reference::value && is_constructible::value) +# define BOOST_HAS_NOTHROW_COPY(T) ((__has_nothrow_copy(T) BOOST_INTEL_TT_OPTS) && !is_volatile::value && !is_reference::value && is_copy_constructible::value) # define BOOST_HAS_NOTHROW_ASSIGN(T) ((__has_nothrow_assign(T) BOOST_INTEL_TT_OPTS) && !is_volatile::value && !is_const::value && is_assignable::value) # define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T) diff --git a/include/boost/type_traits/is_assignable.hpp b/include/boost/type_traits/is_assignable.hpp index 1095f80..9cf681d 100644 --- a/include/boost/type_traits/is_assignable.hpp +++ b/include/boost/type_traits/is_assignable.hpp @@ -21,7 +21,7 @@ namespace boost{ #if !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) #include -#include +#include namespace boost{ @@ -29,7 +29,7 @@ namespace boost{ struct is_assignable_imp { - template() = tt_declval())> + template() = boost::declval())> static boost::type_traits::yes_type test(int); template diff --git a/include/boost/type_traits/is_constructible.hpp b/include/boost/type_traits/is_constructible.hpp index 9b7abe8..e3dc31b 100644 --- a/include/boost/type_traits/is_constructible.hpp +++ b/include/boost/type_traits/is_constructible.hpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include namespace boost{ @@ -25,12 +25,12 @@ namespace boost{ struct is_constructible_imp { - template()...))> + template()...))> static boost::type_traits::yes_type test(int); template static boost::type_traits::no_type test(...); - template()))> + template()))> static boost::type_traits::yes_type test1(int); template static boost::type_traits::no_type test1(...); @@ -45,8 +45,8 @@ namespace boost{ template struct is_constructible : public integral_constant(0)) == sizeof(boost::type_traits::yes_type)>{}; template struct is_constructible : public integral_constant::value && sizeof(detail::is_constructible_imp::test1(0)) == sizeof(boost::type_traits::yes_type)>{}; - template struct is_constructible : public integral_constant(detail::tt_declval())) == sizeof(boost::type_traits::yes_type)>{}; - template struct is_constructible : public integral_constant(detail::tt_declval())) == sizeof(boost::type_traits::yes_type)>{}; + template struct is_constructible : public integral_constant(boost::declval())) == sizeof(boost::type_traits::yes_type)>{}; + template struct is_constructible : public integral_constant(boost::declval())) == sizeof(boost::type_traits::yes_type)>{}; template <> struct is_constructible : public false_type{}; template <> struct is_constructible : public false_type{}; diff --git a/include/boost/type_traits/is_copy_constructible.hpp b/include/boost/type_traits/is_copy_constructible.hpp index 03c0460..fc95cf0 100644 --- a/include/boost/type_traits/is_copy_constructible.hpp +++ b/include/boost/type_traits/is_copy_constructible.hpp @@ -69,7 +69,7 @@ namespace boost { #include #include #include -#include +#include #include namespace boost { @@ -137,7 +137,7 @@ namespace boost { // }; BOOST_STATIC_CONSTANT(bool, value = ( sizeof(test( - tt_declval::type*/ const T&>() + boost::declval::type*/ const T&>() )) == sizeof(boost::type_traits::yes_type) && !boost::is_rvalue_reference::value diff --git a/include/boost/type_traits/is_destructible.hpp b/include/boost/type_traits/is_destructible.hpp index 36fc626..9f1e5d9 100644 --- a/include/boost/type_traits/is_destructible.hpp +++ b/include/boost/type_traits/is_destructible.hpp @@ -15,7 +15,7 @@ #if !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) #include -#include +#include namespace boost{ @@ -23,7 +23,7 @@ namespace boost{ struct is_destructible_imp { - template().~T())> + template().~T())> static boost::type_traits::yes_type test(int); template static boost::type_traits::no_type test(...); diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 8dd1891..c799160 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -29,6 +29,9 @@ rule all-tests { { result += [ run $(source) ] ; } + # + # These traits have both intrinsic support, and a std conforming version, test a version with intrinsics disabled for better code coverage: + # for local source in has_nothrow_assign_test has_nothrow_constr_test has_nothrow_copy_test is_nothrow_move_assignable_test is_nothrow_move_constructible_test { result += [ run $(source).cpp : : : BOOST_TT_DISABLE_INTRINSICS : $(source)_no_intrinsics ] ; From 979fc5b293db6fd283ea38cdc1c78aa95a8c5609 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sun, 14 Jun 2015 09:31:45 +0100 Subject: [PATCH 27/51] Delete dead file. --- include/boost/type_traits/detail/decl.hpp | 29 ----------------------- 1 file changed, 29 deletions(-) delete mode 100644 include/boost/type_traits/detail/decl.hpp diff --git a/include/boost/type_traits/detail/decl.hpp b/include/boost/type_traits/detail/decl.hpp deleted file mode 100644 index a8953c6..0000000 --- a/include/boost/type_traits/detail/decl.hpp +++ /dev/null @@ -1,29 +0,0 @@ - -// (C) Copyright John Maddock 2015. -// 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_DECL_HEADER -#define BOOST_TT_DETAIL_DECL_HEADER - -#include -#include -#include -#include - -namespace boost { namespace detail{ - -template -typename add_rvalue_reference::type tt_declval() BOOST_NOEXCEPT; // as unevaluated operand -template -typename add_lvalue_reference::type const>::type tt_decl_const_ref() BOOST_NOEXCEPT; // as unevaluated operand -template -typename add_lvalue_reference::type>::type tt_decl_ref() BOOST_NOEXCEPT; // as unevaluated operand - - -}} // namespace boost - -#endif // BOOST_TT_DETAIL_DECL_HEADER From c4243e2914d90700f852e1475cdaf5f722901fea Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sun, 14 Jun 2015 12:43:27 +0100 Subject: [PATCH 28/51] Ooops, revert to using add_reference for C++98 compilers. --- include/boost/type_traits/is_copy_constructible.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/type_traits/is_copy_constructible.hpp b/include/boost/type_traits/is_copy_constructible.hpp index fc95cf0..1d950d0 100644 --- a/include/boost/type_traits/is_copy_constructible.hpp +++ b/include/boost/type_traits/is_copy_constructible.hpp @@ -137,7 +137,7 @@ namespace boost { // }; BOOST_STATIC_CONSTANT(bool, value = ( sizeof(test( - boost::declval::type*/ const T&>() + boost::declval::type>() )) == sizeof(boost::type_traits::yes_type) && !boost::is_rvalue_reference::value From 693c7a9ca673831e135c4ff529883569ab0ebca8 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sun, 14 Jun 2015 12:47:31 +0100 Subject: [PATCH 29/51] Fix for copy-constructibility with Oracle compiler. --- include/boost/type_traits/intrinsics.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/type_traits/intrinsics.hpp b/include/boost/type_traits/intrinsics.hpp index 04d7ef7..9b9d2d9 100644 --- a/include/boost/type_traits/intrinsics.hpp +++ b/include/boost/type_traits/intrinsics.hpp @@ -284,7 +284,7 @@ # define BOOST_HAS_TRIVIAL_ASSIGN(T) ((__oracle_has_trivial_assign(T) || __oracle_is_trivial(T)) && ! ::boost::is_volatile::value && ! ::boost::is_const::value && is_assignable::value) # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__oracle_has_trivial_destructor(T) && is_destructible::value) # define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) ((__oracle_has_nothrow_constructor(T) || __oracle_has_trivial_constructor(T) || __oracle_is_trivial(T)) && is_default_constructible::value) -# define BOOST_HAS_NOTHROW_COPY(T) ((__oracle_has_nothrow_copy(T) || __oracle_has_trivial_copy(T) || __oracle_is_trivial(T)) && !is_volatile::value && !is_reference::value) +# define BOOST_HAS_NOTHROW_COPY(T) ((__oracle_has_nothrow_copy(T) || __oracle_has_trivial_copy(T) || __oracle_is_trivial(T)) && !is_volatile::value && !is_reference::value && is_copy_constructible::value) # define BOOST_HAS_NOTHROW_ASSIGN(T) ((__oracle_has_nothrow_assign(T) || __oracle_has_trivial_assign(T) || __oracle_is_trivial(T)) && !is_volatile::value && !is_const::value) # define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __oracle_has_virtual_destructor(T) From 17985daa3c4e56aa30e22db6a02d2a694f0657e0 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sun, 14 Jun 2015 12:49:59 +0100 Subject: [PATCH 30/51] Add Oracle compiler to the list that needs extra includes. --- include/boost/type_traits/has_nothrow_copy.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/type_traits/has_nothrow_copy.hpp b/include/boost/type_traits/has_nothrow_copy.hpp index a62476c..61d52b9 100644 --- a/include/boost/type_traits/has_nothrow_copy.hpp +++ b/include/boost/type_traits/has_nothrow_copy.hpp @@ -14,7 +14,7 @@ #ifdef BOOST_HAS_NOTHROW_COPY -#if defined(BOOST_CLANG) || defined(__GNUC__) || defined(__ghs__) || defined(__CODEGEARC__) +#if defined(BOOST_CLANG) || defined(__GNUC__) || defined(__ghs__) || defined(__CODEGEARC__) || defined(__SUNPRO_CC) #include #include #include From 6f5f212fa0b96c54f4ad5dbe0b9eefbf4101583e Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sun, 14 Jun 2015 13:06:23 +0100 Subject: [PATCH 31/51] Function types need to be screened out of is_pod on Oracle. --- include/boost/type_traits/intrinsics.hpp | 2 +- include/boost/type_traits/is_pod.hpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/boost/type_traits/intrinsics.hpp b/include/boost/type_traits/intrinsics.hpp index 9b9d2d9..c04f4ab 100644 --- a/include/boost/type_traits/intrinsics.hpp +++ b/include/boost/type_traits/intrinsics.hpp @@ -277,7 +277,7 @@ # include # define BOOST_IS_UNION(T) __oracle_is_union(T) -# define BOOST_IS_POD(T) __oracle_is_pod(T) +# define BOOST_IS_POD(T) (__oracle_is_pod(T) && !is_function::value) # define BOOST_IS_EMPTY(T) __oracle_is_empty(T) # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) (__oracle_has_trivial_constructor(T) && ! ::boost::is_volatile::value) # define BOOST_HAS_TRIVIAL_COPY(T) (__oracle_has_trivial_copy(T) && !is_reference::value) diff --git a/include/boost/type_traits/is_pod.hpp b/include/boost/type_traits/is_pod.hpp index 9764a2c..9204c93 100644 --- a/include/boost/type_traits/is_pod.hpp +++ b/include/boost/type_traits/is_pod.hpp @@ -14,6 +14,10 @@ #include #include +#ifdef __SUNPRO_CC +#include +#endif + #include #ifndef BOOST_IS_POD From 4da98d4e8ca148b61e6b01811d1e02ce0ea01eb7 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sun, 14 Jun 2015 13:20:18 +0100 Subject: [PATCH 32/51] Disable use of __oracle_has_nothrow_copy which appears not to do the right thing. --- include/boost/type_traits/intrinsics.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/boost/type_traits/intrinsics.hpp b/include/boost/type_traits/intrinsics.hpp index c04f4ab..fff1079 100644 --- a/include/boost/type_traits/intrinsics.hpp +++ b/include/boost/type_traits/intrinsics.hpp @@ -284,7 +284,8 @@ # define BOOST_HAS_TRIVIAL_ASSIGN(T) ((__oracle_has_trivial_assign(T) || __oracle_is_trivial(T)) && ! ::boost::is_volatile::value && ! ::boost::is_const::value && is_assignable::value) # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__oracle_has_trivial_destructor(T) && is_destructible::value) # define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) ((__oracle_has_nothrow_constructor(T) || __oracle_has_trivial_constructor(T) || __oracle_is_trivial(T)) && is_default_constructible::value) -# define BOOST_HAS_NOTHROW_COPY(T) ((__oracle_has_nothrow_copy(T) || __oracle_has_trivial_copy(T) || __oracle_is_trivial(T)) && !is_volatile::value && !is_reference::value && is_copy_constructible::value) +// __oracle_has_nothrow_copy appears to behave the same as __oracle_has_nothrow_assign, disabled for now: +//# define BOOST_HAS_NOTHROW_COPY(T) ((__oracle_has_nothrow_copy(T) || __oracle_has_trivial_copy(T) || __oracle_is_trivial(T)) && !is_volatile::value && !is_reference::value && is_copy_constructible::value) # define BOOST_HAS_NOTHROW_ASSIGN(T) ((__oracle_has_nothrow_assign(T) || __oracle_has_trivial_assign(T) || __oracle_is_trivial(T)) && !is_volatile::value && !is_const::value) # define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __oracle_has_virtual_destructor(T) From 745bf9bee1792800d23b9dce310dca1eaba2e551 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sun, 14 Jun 2015 18:05:58 +0100 Subject: [PATCH 33/51] Fix for Oracle+STLPort. --- test/decay_test.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/decay_test.cpp b/test/decay_test.cpp index 33b9249..cf22e15 100644 --- a/test/decay_test.cpp +++ b/test/decay_test.cpp @@ -120,20 +120,24 @@ TT_TEST_BEGIN(decay) typedef int f1_type(void); typedef int f2_type(int); - BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_same< + BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_same< ::tt::decay::type,int (*)(void)>::value), true ); BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_same< ::tt::decay::type,int (*)(int)>::value), true ); +#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS + // + // Don't test this if the std lib has no templated constructors (Oracle+STLPort): + // std::pair p = boost::make_pair( "foo", "bar" ); std::pair p2 = boost::make_pair( "foo", 1 ); #ifndef BOOST_NO_STD_WSTRING std::pair p3 = boost::make_pair( L"foo", "bar" ); std::pair p4 = boost::make_pair( L"foo", 1 ); #endif - +#endif // // Todo: make these work sometime. The test id not directly // related to decay::type and can be avoided for now. From 136b7dbd7f027f744df82f55e3bdd628eee41dd2 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sun, 14 Jun 2015 18:27:57 +0100 Subject: [PATCH 34/51] Oracle has_nothrow_assign need to check for assignablility. --- include/boost/type_traits/intrinsics.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/type_traits/intrinsics.hpp b/include/boost/type_traits/intrinsics.hpp index fff1079..6987750 100644 --- a/include/boost/type_traits/intrinsics.hpp +++ b/include/boost/type_traits/intrinsics.hpp @@ -286,7 +286,7 @@ # define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) ((__oracle_has_nothrow_constructor(T) || __oracle_has_trivial_constructor(T) || __oracle_is_trivial(T)) && is_default_constructible::value) // __oracle_has_nothrow_copy appears to behave the same as __oracle_has_nothrow_assign, disabled for now: //# define BOOST_HAS_NOTHROW_COPY(T) ((__oracle_has_nothrow_copy(T) || __oracle_has_trivial_copy(T) || __oracle_is_trivial(T)) && !is_volatile::value && !is_reference::value && is_copy_constructible::value) -# define BOOST_HAS_NOTHROW_ASSIGN(T) ((__oracle_has_nothrow_assign(T) || __oracle_has_trivial_assign(T) || __oracle_is_trivial(T)) && !is_volatile::value && !is_const::value) +# define BOOST_HAS_NOTHROW_ASSIGN(T) ((__oracle_has_nothrow_assign(T) || __oracle_has_trivial_assign(T) || __oracle_is_trivial(T)) && !is_volatile::value && !is_const::value && is_assignable::value) # define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __oracle_has_virtual_destructor(T) # define BOOST_IS_ABSTRACT(T) __oracle_is_abstract(T) From 6b7ed138b279a3c36af4e0ffcb93805cc350d7dd Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sun, 14 Jun 2015 18:46:24 +0100 Subject: [PATCH 35/51] Stop including type_traits headers from intrinsics.hpp: it leads to cyclic dependencies. --- include/boost/type_traits/intrinsics.hpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/include/boost/type_traits/intrinsics.hpp b/include/boost/type_traits/intrinsics.hpp index 6987750..e72d9ce 100644 --- a/include/boost/type_traits/intrinsics.hpp +++ b/include/boost/type_traits/intrinsics.hpp @@ -272,10 +272,6 @@ #endif #if defined(__SUNPRO_CC) && (__SUNPRO_CC >= 0x5130) -# include -# include -# include - # define BOOST_IS_UNION(T) __oracle_is_union(T) # define BOOST_IS_POD(T) (__oracle_is_pod(T) && !is_function::value) # define BOOST_IS_EMPTY(T) __oracle_is_empty(T) From 0408a8888f045875e3af8a3b94018d7256019a6c Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sun, 14 Jun 2015 18:50:08 +0100 Subject: [PATCH 36/51] Add missing #include for Solaris. --- include/boost/type_traits/has_trivial_constructor.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/type_traits/has_trivial_constructor.hpp b/include/boost/type_traits/has_trivial_constructor.hpp index 0f57aae..60ac52a 100644 --- a/include/boost/type_traits/has_trivial_constructor.hpp +++ b/include/boost/type_traits/has_trivial_constructor.hpp @@ -16,7 +16,7 @@ #ifdef BOOST_HAS_TRIVIAL_CONSTRUCTOR #ifdef BOOST_HAS_SGI_TYPE_TRAITS #include -#elif defined(__GNUC__) +#elif defined(__GNUC__) || defined(__SUNPRO_CC) #include #ifdef BOOST_INTEL #include From d3a0be9f48164333d09bc700f26f5d37c485f043 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sun, 14 Jun 2015 19:17:21 +0100 Subject: [PATCH 37/51] Fix for Oracle compiler thinking non-moveable types are POD's. --- .../type_traits/has_trivial_move_constructor.hpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/include/boost/type_traits/has_trivial_move_constructor.hpp b/include/boost/type_traits/has_trivial_move_constructor.hpp index e37dfe3..d5f5dee 100644 --- a/include/boost/type_traits/has_trivial_move_constructor.hpp +++ b/include/boost/type_traits/has_trivial_move_constructor.hpp @@ -33,13 +33,25 @@ template struct has_trivial_move_constructor : public integral_cons #else +#ifdef __SUNPRO_CC +#include +#include +#if __cplusplus >= 201103 +#define SOLARIS_EXTRA_CHECK && is_assignable::type&, typename remove_const::type&&>::value +#endif +#endif + +#ifndef SOLARIS_EXTRA_CHECK +#define SOLARIS_EXTRA_CHECK +#endif + #include #include namespace boost { template struct has_trivial_move_constructor - : public integral_constant::value && !::boost::is_volatile::value>{}; + : public integral_constant::value && !::boost::is_volatile::value SOLARIS_EXTRA_CHECK>{}; #endif template <> struct has_trivial_move_constructor : public false_type{}; From b554c5ae26c5a4a53e2fd640d6b4ee55f5fe0b6e Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sun, 14 Jun 2015 19:27:32 +0100 Subject: [PATCH 38/51] Oops should be using is_constructible not is_assignable in has_trivial_move_constructor.hpp. --- include/boost/type_traits/has_trivial_move_constructor.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/type_traits/has_trivial_move_constructor.hpp b/include/boost/type_traits/has_trivial_move_constructor.hpp index d5f5dee..5b43c7f 100644 --- a/include/boost/type_traits/has_trivial_move_constructor.hpp +++ b/include/boost/type_traits/has_trivial_move_constructor.hpp @@ -34,10 +34,10 @@ template struct has_trivial_move_constructor : public integral_cons #else #ifdef __SUNPRO_CC -#include +#include #include #if __cplusplus >= 201103 -#define SOLARIS_EXTRA_CHECK && is_assignable::type&, typename remove_const::type&&>::value +#define SOLARIS_EXTRA_CHECK && is_constructible::type, typename remove_const::type&&>::value #endif #endif From 642bf8377dd5e9d0ec9e2682bcca4d08099a98b4 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sun, 14 Jun 2015 19:34:26 +0100 Subject: [PATCH 39/51] More Oracle C++ fixes: Disable noexcept code for is_destructible - Oracle seems to always return false. Filter has_trivial_move_assign through is_assignable. --- .../boost/type_traits/has_nothrow_destructor.hpp | 2 +- .../type_traits/has_trivial_move_assign.hpp | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/include/boost/type_traits/has_nothrow_destructor.hpp b/include/boost/type_traits/has_nothrow_destructor.hpp index 7132a6b..23d1701 100644 --- a/include/boost/type_traits/has_nothrow_destructor.hpp +++ b/include/boost/type_traits/has_nothrow_destructor.hpp @@ -11,7 +11,7 @@ #include -#if !defined(BOOST_NO_CXX11_NOEXCEPT) +#if !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(__SUNPRO_CC) #include #include diff --git a/include/boost/type_traits/has_trivial_move_assign.hpp b/include/boost/type_traits/has_trivial_move_assign.hpp index 7fc7bf9..7077ea0 100644 --- a/include/boost/type_traits/has_trivial_move_assign.hpp +++ b/include/boost/type_traits/has_trivial_move_assign.hpp @@ -28,14 +28,26 @@ #include #endif -namespace boost { +#ifdef __SUNPRO_CC +#include +#include +#if __cplusplus >= 201103 +#define SOLARIS_EXTRA_CHECK && is_assignable::type&, typename remove_const::type&&>::value +#endif +#endif + +#ifndef SOLARIS_EXTRA_CHECK +#define SOLARIS_EXTRA_CHECK +#endif + +namespace boost{ template struct has_trivial_move_assign : public integral_constant::value && !::boost::is_const::value && !::boost::is_volatile::value + ::boost::is_pod::value && !::boost::is_const::value && !::boost::is_volatile::value SOLARIS_EXTRA_CHECK #endif > {}; From b65423f1faa76e92ddf6d7ad1c2ee9e8e9975335 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sun, 14 Jun 2015 19:36:43 +0100 Subject: [PATCH 40/51] Fix comment. --- include/boost/type_traits/is_constructible.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/type_traits/is_constructible.hpp b/include/boost/type_traits/is_constructible.hpp index e3dc31b..0918b38 100644 --- a/include/boost/type_traits/is_constructible.hpp +++ b/include/boost/type_traits/is_constructible.hpp @@ -77,4 +77,4 @@ namespace boost{ } // namespace boost -#endif // BOOST_TT_IS_ASSIGNABLE_HPP_INCLUDED +#endif // BOOST_TT_IS_CONSTRUCTIBLE_HPP_INCLUDED From 821d5a177fea7020d4205476cec94dde2d01c2d2 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sun, 14 Jun 2015 19:39:13 +0100 Subject: [PATCH 41/51] Clean up macros after use. --- include/boost/type_traits/has_trivial_move_assign.hpp | 2 ++ include/boost/type_traits/has_trivial_move_constructor.hpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/include/boost/type_traits/has_trivial_move_assign.hpp b/include/boost/type_traits/has_trivial_move_assign.hpp index 7077ea0..f7bb198 100644 --- a/include/boost/type_traits/has_trivial_move_assign.hpp +++ b/include/boost/type_traits/has_trivial_move_assign.hpp @@ -67,4 +67,6 @@ template struct has_trivial_move_assign : public false_type{}; } // namespace boost +#undef SOLARIS_EXTRA_CHECK + #endif // BOOST_TT_HAS_TRIVIAL_MOVE_ASSIGN_HPP_INCLUDED diff --git a/include/boost/type_traits/has_trivial_move_constructor.hpp b/include/boost/type_traits/has_trivial_move_constructor.hpp index 5b43c7f..9e601f3 100644 --- a/include/boost/type_traits/has_trivial_move_constructor.hpp +++ b/include/boost/type_traits/has_trivial_move_constructor.hpp @@ -52,6 +52,9 @@ namespace boost { template struct has_trivial_move_constructor : public integral_constant::value && !::boost::is_volatile::value SOLARIS_EXTRA_CHECK>{}; + +#undef SOLARIS_EXTRA_CHECK + #endif template <> struct has_trivial_move_constructor : public false_type{}; From fc2b8e14b9a9738d0dc9c9938fb948773b2a36c4 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Mon, 15 Jun 2015 09:02:10 +0100 Subject: [PATCH 42/51] Disable move-construction for arrays - fixes Oracle C++ issue. --- include/boost/type_traits/is_nothrow_move_constructible.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/boost/type_traits/is_nothrow_move_constructible.hpp b/include/boost/type_traits/is_nothrow_move_constructible.hpp index 4b7a71b..3cbca21 100644 --- a/include/boost/type_traits/is_nothrow_move_constructible.hpp +++ b/include/boost/type_traits/is_nothrow_move_constructible.hpp @@ -49,6 +49,8 @@ template struct is_nothrow_move_constructible template struct is_nothrow_move_constructible : public ::boost::false_type {}; template struct is_nothrow_move_constructible : public ::boost::false_type{}; +template struct is_nothrow_move_constructible : public ::boost::false_type{}; +template struct is_nothrow_move_constructible : public ::boost::false_type{}; #else From fe5f4e2253f74c7f72f9dedbff18fd892be006fd Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Tue, 16 Jun 2015 12:47:29 +0100 Subject: [PATCH 43/51] Move private-constructor tests into separate file. These tests fail on older GCC versions. --- test/has_nothrow_constr_test.cpp | 10 --- test/has_nothrow_copy_test.cpp | 11 ---- test/has_trivial_assign_test.cpp | 8 --- test/has_trivial_constr_test.cpp | 8 --- test/has_trivial_copy_test.cpp | 8 --- test/has_trivial_destructor_test.cpp | 8 --- test/is_default_constr_test.cpp | 10 --- test/is_nothrow_move_constructible_test.cpp | 9 --- test/tricky_private_member_test.cpp | 71 +++++++++++++++++++++ 9 files changed, 71 insertions(+), 72 deletions(-) create mode 100644 test/tricky_private_member_test.cpp diff --git a/test/has_nothrow_constr_test.cpp b/test/has_nothrow_constr_test.cpp index 0cc5cb7..f2d60e3 100644 --- a/test/has_nothrow_constr_test.cpp +++ b/test/has_nothrow_constr_test.cpp @@ -37,15 +37,6 @@ struct deleted_default_construct #endif -struct private_default_construct -{ -private: - private_default_construct(); -public: - private_default_construct(char val) : member(val) {} - char member; -}; - #ifndef BOOST_NO_CXX11_NOEXCEPT struct noexcept_default_construct { @@ -210,7 +201,6 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::v #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, false); #endif -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, false); #ifndef BOOST_NO_CXX11_NOEXCEPT BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); #endif diff --git a/test/has_nothrow_copy_test.cpp b/test/has_nothrow_copy_test.cpp index 034cb65..aa2ca02 100644 --- a/test/has_nothrow_copy_test.cpp +++ b/test/has_nothrow_copy_test.cpp @@ -12,13 +12,6 @@ # include #endif -struct non_copy -{ - non_copy(); -private: - non_copy(const non_copy&); -}; - #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS struct delete_copy @@ -237,10 +230,6 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy::value, false) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy::value, true); #endif -#if !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy::value, false); -#endif - TT_TEST_END diff --git a/test/has_trivial_assign_test.cpp b/test/has_trivial_assign_test.cpp index c5e40a3..50aced7 100644 --- a/test/has_trivial_assign_test.cpp +++ b/test/has_trivial_assign_test.cpp @@ -12,13 +12,6 @@ # include #endif -struct non_assignable -{ - non_assignable(); -private: - non_assignable& operator=(const non_assignable&); -}; - #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS struct non_assignable2 @@ -224,7 +217,6 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign::value, false) #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign::value, false); #endif -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign::value, false); TT_TEST_END diff --git a/test/has_trivial_constr_test.cpp b/test/has_trivial_constr_test.cpp index 16a4e8a..4b89df3 100644 --- a/test/has_trivial_constr_test.cpp +++ b/test/has_trivial_constr_test.cpp @@ -27,13 +27,6 @@ public: explicit bug11324_derived(char arg) : data(arg) {} }; -struct private_construct -{ - private_construct(int); -private: - private_construct(); -}; - #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS struct deleted_construct @@ -204,7 +197,6 @@ BOOST_CHECK_SOFT_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, false); #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, false); #endif diff --git a/test/has_trivial_copy_test.cpp b/test/has_trivial_copy_test.cpp index 043f76e..6a803b8 100644 --- a/test/has_trivial_copy_test.cpp +++ b/test/has_trivial_copy_test.cpp @@ -25,13 +25,6 @@ public: #endif -struct private_copy -{ - private_copy(); -private: - private_copy(const private_copy&); -}; - TT_TEST_BEGIN(has_trivial_copy) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy::value, true); @@ -227,7 +220,6 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy::value, false); #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy::value, false); #endif -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy::value, false); TT_TEST_END diff --git a/test/has_trivial_destructor_test.cpp b/test/has_trivial_destructor_test.cpp index 3792004..960a575 100644 --- a/test/has_trivial_destructor_test.cpp +++ b/test/has_trivial_destructor_test.cpp @@ -22,13 +22,6 @@ struct deleted_destruct #endif -struct private_destruct -{ - private_destruct(); -private: - ~private_destruct(); -}; - TT_TEST_BEGIN(has_trivial_destructor) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); @@ -187,7 +180,6 @@ 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); #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, false); #endif diff --git a/test/is_default_constr_test.cpp b/test/is_default_constr_test.cpp index 89444b3..01a702c 100644 --- a/test/is_default_constr_test.cpp +++ b/test/is_default_constr_test.cpp @@ -37,15 +37,6 @@ struct deleted_default_construct #endif -struct private_default_construct -{ -private: - private_default_construct(); -public: - private_default_construct(char val) : member(val) {} - char member; -}; - TT_TEST_BEGIN(is_default_constructible) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_default_constructible::value, true); @@ -198,7 +189,6 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_default_constructible:: #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_default_constructible::value, false); #endif -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_default_constructible::value, false); TT_TEST_END diff --git a/test/is_nothrow_move_constructible_test.cpp b/test/is_nothrow_move_constructible_test.cpp index d756edc..3fdad74 100644 --- a/test/is_nothrow_move_constructible_test.cpp +++ b/test/is_nothrow_move_constructible_test.cpp @@ -14,13 +14,6 @@ # include #endif -struct non_copy -{ - non_copy(); -private: - non_copy(const non_copy&); -}; - #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS struct delete_copy @@ -245,8 +238,6 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, false); -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, false); - #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, false); #endif diff --git a/test/tricky_private_member_test.cpp b/test/tricky_private_member_test.cpp new file mode 100644 index 0000000..b113fdf --- /dev/null +++ b/test/tricky_private_member_test.cpp @@ -0,0 +1,71 @@ + +// (C) Copyright John Maddock 2015. +// 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 + +struct private_default_construct +{ +private: + private_default_construct(); +public: + private_default_construct(char val) : member(val) {} + char member; +}; + +struct non_copy +{ + non_copy(); +private: + non_copy(const non_copy&); +}; + +struct non_assignable +{ + non_assignable(); +private: + non_assignable& operator=(const non_assignable&); +}; + +struct private_copy +{ + private_copy(); +private: + private_copy(const private_copy&); +}; + +struct private_destruct +{ + private_destruct(); +private: + ~private_destruct(); +}; + + + +TT_TEST_BEGIN(tricky_private_members_test) + +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, false); +#if !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy::value, false); +#endif +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_default_constructible::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, false); + + + +TT_TEST_END + + From 863ba0a7c51f7e6b5b37fdc76a07035f0da94691 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Tue, 16 Jun 2015 18:30:02 +0100 Subject: [PATCH 44/51] Revert "Move private-constructor tests into separate file." This wasn't the right fix, and didn't fix the issue anyway. This reverts commit fe5f4e2253f74c7f72f9dedbff18fd892be006fd. --- .../boost_typetraits/category/transform.html | 6 + .../category/value_traits/properties.html | 24 +++ doc/html/boost_typetraits/reference.html | 10 +- .../reference/common_type.html | 143 ++++++++---------- .../boost_typetraits/reference/decay.html | 10 +- .../boost_typetraits/reference/extent.html | 6 +- .../reference/floating_point_promotion.html | 2 +- .../reference/function_traits.html | 4 +- .../reference/has_nothrow_assign.html | 12 +- .../reference/has_nothrow_constructor.html | 21 +-- .../reference/has_nothrow_copy.html | 27 ++-- .../reference/has_nothrow_cp_cons.html | 6 +- .../reference/has_trivial_assign.html | 15 +- .../reference/has_trivial_constructor.html | 17 +-- .../reference/has_trivial_copy.html | 24 ++- .../reference/has_trivial_destructor.html | 17 +-- .../reference/has_trivial_move_assign.html | 19 +-- .../has_trivial_move_constructor.html | 19 +-- .../reference/has_virtual_destructor.html | 13 +- .../reference/integral_constant.html | 1 + .../reference/integral_promotion.html | 2 +- .../boost_typetraits/reference/is_array.html | 11 +- .../reference/is_base_of.html | 17 +-- .../boost_typetraits/reference/is_class.html | 15 +- .../reference/is_complex.html | 4 + .../reference/is_compound.html | 4 + .../boost_typetraits/reference/is_const.html | 10 +- .../reference/is_convertible.html | 16 +- .../reference/is_copy_assignable.html | 14 +- .../reference/is_copy_constructible.html | 17 ++- .../boost_typetraits/reference/is_empty.html | 13 +- .../boost_typetraits/reference/is_enum.html | 7 +- .../boost_typetraits/reference/is_final.html | 11 +- .../reference/is_floating_point.html | 4 + .../reference/is_function.html | 4 + .../reference/is_fundamental.html | 4 + .../reference/is_integral.html | 4 + .../reference/is_lvalue_reference.html | 6 +- .../reference/is_member_function_pointer.html | 4 + .../reference/is_member_object_pointer.html | 4 + .../reference/is_member_pointer.html | 4 + .../reference/is_nothrow_move_assignable.html | 6 +- .../is_nothrow_move_constructible.html | 15 +- .../boost_typetraits/reference/is_object.html | 4 + .../boost_typetraits/reference/is_pod.html | 21 +-- .../reference/is_pointer.html | 4 + .../reference/is_reference.html | 6 +- .../reference/is_rvalue_reference.html | 6 +- .../boost_typetraits/reference/is_same.html | 5 +- .../boost_typetraits/reference/is_scalar.html | 5 +- .../boost_typetraits/reference/is_signed.html | 4 + .../reference/is_stateless.html | 17 +-- .../boost_typetraits/reference/is_union.html | 6 +- .../reference/is_unsigned.html | 4 + .../reference/is_virtual_base_of.html | 8 +- .../boost_typetraits/reference/is_void.html | 4 + .../reference/is_volatile.html | 4 + .../reference/make_signed.html | 6 +- .../reference/make_unsigned.html | 6 +- .../boost_typetraits/reference/promote.html | 6 +- doc/html/boost_typetraits/reference/rank.html | 4 + .../reference/remove_all_extents.html | 10 +- .../reference/remove_const.html | 10 +- .../boost_typetraits/reference/remove_cv.html | 10 +- .../reference/remove_extent.html | 10 +- .../reference/remove_pointer.html | 10 +- .../reference/remove_reference.html | 10 +- .../reference/remove_volatile.html | 16 +- .../reference/type_with_alignment.html | 6 +- doc/html/index.html | 10 +- doc/html/index/s11.html | 17 ++- doc/html/index/s12.html | 2 +- doc/html/index/s13.html | 16 +- doc/html/index/s14.html | 46 ++++-- test/has_nothrow_constr_test.cpp | 10 ++ test/has_nothrow_copy_test.cpp | 11 ++ test/has_trivial_assign_test.cpp | 8 + test/has_trivial_constr_test.cpp | 8 + test/has_trivial_copy_test.cpp | 8 + test/has_trivial_destructor_test.cpp | 8 + test/is_default_constr_test.cpp | 10 ++ test/is_nothrow_move_constructible_test.cpp | 9 ++ test/tricky_private_member_test.cpp | 71 --------- 83 files changed, 534 insertions(+), 494 deletions(-) delete mode 100644 test/tricky_private_member_test.cpp diff --git a/doc/html/boost_typetraits/category/transform.html b/doc/html/boost_typetraits/category/transform.html index 5ebf62c..7437ec2 100644 --- a/doc/html/boost_typetraits/category/transform.html +++ b/doc/html/boost_typetraits/category/transform.html @@ -63,6 +63,9 @@ template <class... T> struct common_type; +template <class T, class U> +struct copy_cv; + template <class T> struct decay; @@ -101,6 +104,9 @@ template <class T> struct remove_volatile; + +template <class T> +struct type_identity; diff --git a/doc/html/boost_typetraits/category/value_traits/properties.html b/doc/html/boost_typetraits/category/value_traits/properties.html index bccb201..6e527d1 100644 --- a/doc/html/boost_typetraits/category/value_traits/properties.html +++ b/doc/html/boost_typetraits/category/value_traits/properties.html @@ -54,6 +54,9 @@ template<classT>structhas_nothrow_copy_constructor; +template<classT> +structhas_nothrow_destructor; + template<classT>structhas_trivial_assign; @@ -78,12 +81,33 @@ template<classT>structis_abstract; +template<classT,classU> +structis_assignable; + +template<classT> +structis_copy_constructible; + +template<classT> +structis_copy_assignable; + +template<classT,class...Args> +structis_constructible; + +template<classT> +structis_default_constructible; + +template<classT> +structis_destructible; + template<classT>structis_const;template<classT>structis_empty; +template<classT> +structis_final; + template<classT>structis_stateless; diff --git a/doc/html/boost_typetraits/reference.html b/doc/html/boost_typetraits/reference.html index 4ccfab4..f1cfab2 100644 --- a/doc/html/boost_typetraits/reference.html +++ b/doc/html/boost_typetraits/reference.html @@ -38,7 +38,9 @@
alignment_of
conditional
common_type
+
copy_cv
decay
+
declval
extent
floating_point_promotion
function_traits
@@ -74,6 +76,7 @@
has_nothrow_assign
has_nothrow_constructor
has_nothrow_copy
+
has_nothrow_destructor
has_nothrow_copy_constructor
has_nothrow_default_constructor
has_plus
@@ -100,14 +103,18 @@
is_abstract
is_arithmetic
is_array
+
is_assignable
is_base_of
is_class
is_complex
is_compound
is_const
+
is_constructible
is_convertible
-
is_copy_constructible
is_copy_assignable
+
is_copy_constructible
+
is_default_constructible
+
is_destructible
is_empty
is_enum
is_final
@@ -147,6 +154,7 @@
remove_pointer
remove_reference
remove_volatile
+
type_identity
type_with_alignment
diff --git a/doc/html/boost_typetraits/reference/common_type.html b/doc/html/boost_typetraits/reference/common_type.html index 602e8a1..6c78990 100644 --- a/doc/html/boost_typetraits/reference/common_type.html +++ b/doc/html/boost_typetraits/reference/common_type.html @@ -7,7 +7,7 @@ - +
@@ -20,7 +20,7 @@

-PrevUpHomeNext +PrevUpHomeNext

@@ -32,115 +32,92 @@ or #include <boost/type_traits.hpp>

namespace boost {
-  template <class ...T>  struct common_type;
+  template <class... T> struct common_type;
 }
 

- common_type - is a traits class used to deduce a type common to a several types, useful - as the return type of functions operating on multiple input types such as - in mixed-mode arithmetic.. + common_type is a traits class + used to deduce a type common to a several types, useful as the return type + of functions operating on multiple input types such as in mixed-mode arithmetic..

The nested typedef ::type could be defined as follows:

-
template <class ...T>
+
template <class... T>
 struct common_type;
 
-template <class T, class U, class ...V>
-struct common_type<T,U,...V> {
-    typedef typename common_type<typename common_type<T, U>::type, V...>::type type;
+template <class T, class U, class... V>
+struct common_type<T, U, V...> {
+    typedef typename common_type<typename common_type<T, U>::type, V...>::type type;
+};
+
+template <>
+struct common_type<> {
 };
 
 template <class T>
 struct common_type<T> {
-    typedef T type;
+    typedef typename decay<T>::type type;
 };
 
 template <class T, class U>
 struct common_type<T, U> {
-    typedef decltype(declval<bool>() ? declval<T>() : declval<U>()) type;
+    typedef typename decay<
+        decltype( declval<bool>()?
+            declval<typename decay<T>::type>():
+            declval<typename decay<U>::type>() )
+    >::type type;
 };
 

All parameter types must be complete. This trait is permitted to be specialized by a user if at least one template parameter is a user-defined type. Note: Such specializations are required when only - explicit conversions are desired among the common_type + explicit conversions are desired among the common_type arguments.

Note that when the compiler does not support variadic templates (and the - macro BOOST_NO_VARIADIC_TEMPLATES is defined) then the maximum number of - template arguments is 3. + macro BOOST_NO_CXX11_VARIADIC_TEMPLATES + is defined) then the maximum number of template arguments is 9.

- Configuration - macros -
-

- When the compiler does not support static assertions then the user can select - the way static assertions are reported. Define -

-
    -
  • - BOOST_COMMON_TYPE_USES_STATIC_ASSERT: define it if you want to use Boost.StaticAssert -
  • -
  • - BOOST_COMMON_TYPE_USES_MPL_ASSERT: define it if you want to use Boost.MPL - static assertions -
  • -
-

- The default behavior is to use mpl assertions in this case, but setting BOOST_COMMON_TYPE_USES_STATIC_ASSERT - may reduce compile times and header dependencies somewhat. -

-

- Depending on the static assertion used you will have an hint of the failing - assertion either through the symbol or through the text. -

-

- When possible common_type is implemented using decltype. - Otherwise when BOOST_COMMON_TYPE_DONT_USE_TYPEOF is not defined it uses Boost.TypeOf. -

-
- Tutorial

- In a nutshell, common_type + In a nutshell, common_type is a trait that takes 1 or more types, and returns a type which all of the types will convert to. The default definition demands this conversion be implicit. However the trait can be specialized for user-defined types which want to limit their inter-type conversions to explicit, and yet still want - to interoperate with the common_type + to interoperate with the common_type facility.

Example:

template <class T, class U>
-complex<typename common_type<T, U>::type>
+complex<typename common_type<T, U>::type>
 operator+(complex<T>, complex<U>);
 

In the above example, "mixed-mode" complex arithmetic is allowed. - The return type is described by common_type. + The return type is described by common_type. For example the resulting type of adding a complex<float> and complex<double> might be a complex<double>.

Here is how someone might produce a variadic comparison function:

template <class ...T>
-typename common_type<T...>::type
+typename common_type<T...>::type
 min(T... t);
 

This is a very useful and broadly applicable utility.

- + How to get the common type of types with explicit conversions?
@@ -148,23 +125,23 @@ Another choice for the author of the preceding operator could be

template <class T, class U>
-typename common_type<complex<T>, complex<U> >::type
+typename common_type<complex<T>, complex<U> >::type
 operator+(complex<T>, complex<U>);
 

- As the default definition of common_type + As the default definition of common_type demands the conversion be implicit, we need to specialize the trait for complex types as follows.

template <class T, class U>
-struct common_type<complex<T>, complex<U> > {
-    typedef complex< common_type<T, U> > type;
+struct common_type<complex<T>, complex<U> > {
+    typedef complex< common_type<T, U> > type;
 };
 
- - How - important is the order of the common_type<> template arguments? + + How + important is the order of the common_type<> template arguments?

The order of the template parameters is important. @@ -242,9 +219,10 @@ A>.

- - Can - the common_type of two types be a third type? + + Can + the common_type of two types + be a third type?

Given the preceding example, one might expect common_type<A,B>::type to be C @@ -269,9 +247,10 @@ B>.

- - How - common_type behaves with pointers? + + How + does common_type behave with + pointers?

Consider @@ -305,26 +284,32 @@ Of course the user can always make this specialization.

- - Can - you explain the pros/cons of common_type against Boost.Typeof? + + Can + you explain the pros/cons of common_type + against Boost.Typeof?

- Even if they appear to be close, common_type + Even if they appear to be close, common_type and typeof have different purposes. You use typeof - to get the type of an expression, while you use common_type + to get the type of an expression, while you use common_type to set explicitly the type returned of a template function. Both are complementary, - and indeed common_type - is equivalent to decltype(declval<bool>() ? declval<T>() - : declval<U>()) + and indeed common_type is + approximately equivalent to decltype(declval<bool>() + ? declval<T>() + : declval<U>()).

- common_type - is also similar to promote_args<class ...T> in boost/math/tools/promotion.hpp, - though it is not exactly the same as promote_args either. common_type<T1, - T2>::type simply represents the result of some operation on T1 and T2, - and defaults to the type obtained by putting T1 and T2 into a conditional + common_type is also similar + to promote_args<class ...T> in + boost/math/tools/promotion.hpp, though + it is not exactly the same as promote_args + either. common_type<T1, T2>::type + simply represents the result of some operation on T1 + and T2, and defaults to the + type obtained by putting T1 + and T2 into a conditional statement.

@@ -346,7 +331,7 @@


-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_typetraits/reference/decay.html b/doc/html/boost_typetraits/reference/decay.html index 4e77ade..fbbe632 100644 --- a/doc/html/boost_typetraits/reference/decay.html +++ b/doc/html/boost_typetraits/reference/decay.html @@ -6,8 +6,8 @@ - - + + @@ -20,7 +20,7 @@

-PrevUpHomeNext +PrevUpHomeNext

@@ -48,7 +48,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.17. Examples

+

Table 1.18. Examples

@@ -149,7 +149,7 @@

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_typetraits/reference/extent.html b/doc/html/boost_typetraits/reference/extent.html index 1204e3f..97f4600 100644 --- a/doc/html/boost_typetraits/reference/extent.html +++ b/doc/html/boost_typetraits/reference/extent.html @@ -6,7 +6,7 @@ - + @@ -20,7 +20,7 @@
-PrevUpHomeNext +PrevUpHomeNext

@@ -107,7 +107,7 @@
-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_typetraits/reference/floating_point_promotion.html b/doc/html/boost_typetraits/reference/floating_point_promotion.html index 257dab9..afab9d8 100644 --- a/doc/html/boost_typetraits/reference/floating_point_promotion.html +++ b/doc/html/boost_typetraits/reference/floating_point_promotion.html @@ -48,7 +48,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.18. Examples

+

Table 1.19. Examples

diff --git a/doc/html/boost_typetraits/reference/function_traits.html b/doc/html/boost_typetraits/reference/function_traits.html index 68084ac..77ea0a9 100644 --- a/doc/html/boost_typetraits/reference/function_traits.html +++ b/doc/html/boost_typetraits/reference/function_traits.html @@ -59,7 +59,7 @@

-

Table 1.19. Function Traits Members

+

Table 1.20. Function Traits Members

@@ -122,7 +122,7 @@

-

Table 1.20. Examples

+

Table 1.21. Examples

diff --git a/doc/html/boost_typetraits/reference/has_nothrow_assign.html b/doc/html/boost_typetraits/reference/has_nothrow_assign.html index f0c4494..c01d51f 100644 --- a/doc/html/boost_typetraits/reference/has_nothrow_assign.html +++ b/doc/html/boost_typetraits/reference/has_nothrow_assign.html @@ -37,9 +37,15 @@ type.

- Compiler Compatibility: Either a compiler - intrinsic (for example this is provided by Visual C++ 8 or later, plus all - GCC versions in C++11 mode), alternatively support for the C++11 noexcept feature. + Compiler Compatibility: Either requires + C++11 noexcept and decltype or else some (unspecified) help from + the compiler. Currently (June 2015) compilers more recent than Visual C++ + 8, GCC-4.3, Greenhills 6.0, Intel-11.0, and Codegear and all recent GCC versions + have the necessary compiler intrinsics + to ensure that this trait "just works". You may test to see if + the necessary support is available by checking to see if defined(BOOST_HAS_NOTHROW_CONSTRUCTOR) || (!defined(BOOST_NO_CXX11_DECLTYPE) + && !defined(BOOST_NO_CXX11_NOEXCEPT)) + is true.

Header: #include diff --git a/doc/html/boost_typetraits/reference/has_nothrow_constructor.html b/doc/html/boost_typetraits/reference/has_nothrow_constructor.html index 5080c1e..fb55aca 100644 --- a/doc/html/boost_typetraits/reference/has_nothrow_constructor.html +++ b/doc/html/boost_typetraits/reference/has_nothrow_constructor.html @@ -43,20 +43,15 @@ These two traits are synonyms for each other.

- Compiler Compatibility: If the compiler - does not support partial-specialization of class templates, then this template - can not be used with function types. -

-

- Without some (unspecified) help from the compiler, has_nothrow_constructor - will never report that a class or struct has a non-throwing default-constructor; - this is always safe, if possibly sub-optimal. Currently (May 2011) compilers - more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0, Intel-11.0, and Codegear + Compiler Compatibility: Either requires + C++11 noexcept and decltype or else some (unspecified) help from + the compiler. Currently (June 2015) compilers more recent than Visual C++ + 8, GCC-4.3, Greenhills 6.0, Intel-11.0, and Codegear and all recent GCC versions have the necessary compiler intrinsics - to ensure that this trait "just works". You may also test to see - if the necessary intrinsics - are available by checking to see if the macro BOOST_HAS_NOTHROW_CONSTRUCTOR - is defined. + to ensure that this trait "just works". You may test to see if + the necessary support is available by checking to see if defined(BOOST_HAS_NOTHROW_CONSTRUCTOR) || (!defined(BOOST_NO_CXX11_DECLTYPE) + && !defined(BOOST_NO_CXX11_NOEXCEPT)) + is true.

Header: #include diff --git a/doc/html/boost_typetraits/reference/has_nothrow_copy.html b/doc/html/boost_typetraits/reference/has_nothrow_copy.html index 0da7c7e..1ffa425 100644 --- a/doc/html/boost_typetraits/reference/has_nothrow_copy.html +++ b/doc/html/boost_typetraits/reference/has_nothrow_copy.html @@ -7,7 +7,7 @@ - +

@@ -20,7 +20,7 @@

-PrevUpHomeNext +PrevUpHomeNext

@@ -43,20 +43,15 @@ These two traits are synonyms for each other.

- Compiler Compatibility: If the compiler - does not support partial-specialization of class templates, then this template - can not be used with function types. -

-

- Without some (as yet unspecified) help from the compiler, has_nothrow_copy - will never report that a class or struct has a non-throwing copy-constructor; - this is always safe, if possibly sub-optimal. Currently (May 2011) compilers - more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0, Intel-11.0, and Codegear + Compiler Compatibility: Either requires + C++11 noexcept and decltype or else some (unspecified) help from + the compiler. Currently (June 2015) compilers more recent than Visual C++ + 8, GCC-4.3, Greenhills 6.0, Intel-11.0, and Codegear and all recent GCC versions have the necessary compiler intrinsics - to ensure that this trait "just works". You may also test to see - if the necessary intrinsics - are available by checking to see if the macro BOOST_HAS_NOTHROW_COPY - is defined. + to ensure that this trait "just works". You may test to see if + the necessary support is available by checking to see if defined(BOOST_HAS_NOTHROW_COPY) || (!defined(BOOST_NO_CXX11_DECLTYPE) + && !defined(BOOST_NO_CXX11_NOEXCEPT)) + is true.

Header: #include @@ -78,7 +73,7 @@


-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_typetraits/reference/has_nothrow_cp_cons.html b/doc/html/boost_typetraits/reference/has_nothrow_cp_cons.html index 08698f8..5ca8144 100644 --- a/doc/html/boost_typetraits/reference/has_nothrow_cp_cons.html +++ b/doc/html/boost_typetraits/reference/has_nothrow_cp_cons.html @@ -6,7 +6,7 @@ - + @@ -20,7 +20,7 @@
-PrevUpHomeNext +PrevUpHomeNext

@@ -44,7 +44,7 @@
-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_typetraits/reference/has_trivial_assign.html b/doc/html/boost_typetraits/reference/has_trivial_assign.html index 453e43a..e11e420 100644 --- a/doc/html/boost_typetraits/reference/has_trivial_assign.html +++ b/doc/html/boost_typetraits/reference/has_trivial_assign.html @@ -40,15 +40,12 @@ can be safely replaced with a call to memcpy.

- Compiler Compatibility: If the compiler - does not support partial-specialization of class templates, then this template - can not be used with function types. -

-

- Without some (as yet unspecified) help from the compiler, has_trivial_assign - will never report that a user-defined class or struct has a trivial constructor; - this is always safe, if possibly sub-optimal. Currently (May 2011) compilers - more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0, Intel-11.0, and Codegear + Compiler Compatibility: Without some (as + yet unspecified) help from the compiler, has_trivial_assign will never report + that a user-defined class or struct has a trivial constructor; this is always + safe, if possibly sub-optimal. In order to correctly handle deleted or private + assignment operators, the compiler must also support C++11's decltype. Currently (May 2015) compilers more + recent than Visual C++ 8, GCC-4.3, Greenhills 6.0, Intel-11.0, and Codegear have the necessary compiler intrinsics to ensure that this trait "just works". You may also test to see if the necessary intrinsics diff --git a/doc/html/boost_typetraits/reference/has_trivial_constructor.html b/doc/html/boost_typetraits/reference/has_trivial_constructor.html index 103b367..34666a5 100644 --- a/doc/html/boost_typetraits/reference/has_trivial_constructor.html +++ b/doc/html/boost_typetraits/reference/has_trivial_constructor.html @@ -48,16 +48,13 @@ some benefit in terms of code size and speed can be obtained.

- Compiler Compatibility: If the compiler - does not support partial-specialization of class templates, then this template - can not be used with function types. -

-

- Without some (as yet unspecified) help from the compiler, has_trivial_constructor - will never report that a user-defined class or struct has a trivial constructor; - this is always safe, if possibly sub-optimal. Currently (May 2011) compilers - more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0, Intel-11.0, and Codegear - have the necessary compiler intrinsics + Compiler Compatibility: Without some (as + yet unspecified) help from the compiler, has_trivial_constructor will never + report that a user-defined class or struct has a trivial constructor; this + is always safe, if possibly sub-optimal. In addition, in order to correctly + handle private or deleted default-constructors then C++11's deltype is required. Currently (May 2015) + compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0, Intel-11.0, + and Codegear have the necessary compiler intrinsics to ensure that this trait "just works". You may also test to see if the necessary intrinsics are available by checking to see if the macro BOOST_HAS_TRIVIAL_CONSTRUCTOR diff --git a/doc/html/boost_typetraits/reference/has_trivial_copy.html b/doc/html/boost_typetraits/reference/has_trivial_copy.html index 6a8f205..85c3f8e 100644 --- a/doc/html/boost_typetraits/reference/has_trivial_copy.html +++ b/doc/html/boost_typetraits/reference/has_trivial_copy.html @@ -46,19 +46,17 @@ can be safely replaced with a call to memcpy.

- Compiler Compatibility: If the compiler - does not support partial-specialization of class templates, then this template - can not be used with function types. -

-

- Without some (as yet unspecified) help from the compiler, has_trivial_copy - will never report that a user-defined class or struct has a trivial constructor; - this is always safe, if possibly sub-optimal. Currently (May 2011) compilers - more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0, Intel-11.0, and Codegear - have the necessary compiler intrinsics - to ensure that this trait "just works". You may also test to see - if the necessary intrinsics - are available by checking to see if the macro BOOST_HAS_TRIVIAL_COPY + Compiler Compatibility: Without some (as + yet unspecified) help from the compiler, has_trivial_copy will never report + that a user-defined class or struct has a trivial constructor; this is always + safe, if possibly sub-optimal. In addition, in order to correctly handle + deleted or private copy-constructors then C++11's dectype + is required. Currently (May 2015) compilers more recent than Visual C++ 8, + GCC-4.3, Greenhills 6.0, Intel-11.0, and Codegear have the necessary compiler + intrinsics to ensure that + this trait "just works". You may also test to see if the necessary + intrinsics are available + by checking to see if the macro BOOST_HAS_TRIVIAL_COPY is defined.

diff --git a/doc/html/boost_typetraits/reference/has_trivial_destructor.html b/doc/html/boost_typetraits/reference/has_trivial_destructor.html index 76f346c..26b44ab 100644 --- a/doc/html/boost_typetraits/reference/has_trivial_destructor.html +++ b/doc/html/boost_typetraits/reference/has_trivial_destructor.html @@ -42,16 +42,13 @@ some benefit in terms of code size and speed can be obtained.

- Compiler Compatibility: If the compiler - does not support partial-specialization of class templates, then this template - can not be used with function types. -

-

- Without some (as yet unspecified) help from the compiler, has_trivial_destructor - will never report that a user-defined class or struct has a trivial destructor; - this is always safe, if possibly sub-optimal. Currently (May 2011) compilers - more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0, Intel-11.0, and Codegear - have the necessary compiler intrinsics + Compiler Compatibility: Without some (as + yet unspecified) help from the compiler, has_trivial_destructor will never + report that a user-defined class or struct has a trivial destructor; this + is always safe, if possibly sub-optimal. In addition, in order to correctly + handle deleted or private destructors then support for C++11's decltype is required. Currently (June 2015) + compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0, Intel-11.0, + and Codegear have the necessary compiler intrinsics to ensure that this trait "just works". You may also test to see if the necessary intrinsics are available by checking to see if the macro BOOST_HAS_TRIVIAL_DESTRUCTOR diff --git a/doc/html/boost_typetraits/reference/has_trivial_move_assign.html b/doc/html/boost_typetraits/reference/has_trivial_move_assign.html index 330a719..93dc7ae 100644 --- a/doc/html/boost_typetraits/reference/has_trivial_move_assign.html +++ b/doc/html/boost_typetraits/reference/has_trivial_move_assign.html @@ -40,17 +40,14 @@ operator can be safely replaced with a call to memcpy.

- Compiler Compatibility: If the compiler - does not support partial-specialization of class templates, then this template - can not be used with function types. -

-

- Without some (as yet unspecified) help from the compiler, has_trivial_move_assign - will never report that a user-defined class or struct has a trivial constructor; - this is always safe, if possibly sub-optimal. Currently (February 2013) compilers - have no necessary intrinsics - to ensure that this trait "just works". You may also test to see - if the necessary intrinsics + Compiler Compatibility: Without some (as + yet unspecified) help from the compiler, has_trivial_move_assign will never + report that a user-defined class or struct has a trivial move assign; this + is always safe, if possibly sub-optimal. In addition, in order to correctly + handle private or deleted move assignment operators then c++11's decltype is required. Currently (June 2015) + compilers that have the necessary intrinsics + to ensure that this trait "just works" include Clang, GCC-5.1 and + MSVC-12.0. You may also test to see if the necessary intrinsics are available by checking to see if the macro BOOST_HAS_TRIVIAL_MOVE_ASSIGN is defined.

diff --git a/doc/html/boost_typetraits/reference/has_trivial_move_constructor.html b/doc/html/boost_typetraits/reference/has_trivial_move_constructor.html index b244be0..e0e5d3a 100644 --- a/doc/html/boost_typetraits/reference/has_trivial_move_constructor.html +++ b/doc/html/boost_typetraits/reference/has_trivial_move_constructor.html @@ -40,17 +40,14 @@ can be safely replaced with a call to memcpy.

- Compiler Compatibility: If the compiler - does not support partial-specialization of class templates, then this template - can not be used with function types. -

-

- Without some (as yet unspecified) help from the compiler, has_trivial_move_constructor - will never report that a user-defined class or struct has a trivial constructor; - this is always safe, if possibly sub-optimal. Currently (February 2013) compilers - have no necessary intrinsics - to ensure that this trait "just works". You may also test to see - if the necessary intrinsics + Compiler Compatibility: Without some (as + yet unspecified) help from the compiler, has_trivial_move_constructor will + never report that a user-defined class or struct has a trivial constructor; + this is always safe, if possibly sub-optimal. In addition C++11's decltype is required to correctly support + deleted or private move constructors. Currently (June 2015) compilers that + have the necessary intrinsics + to ensure that this trait "just works" include Clang, GCC-5.1, + and MSVC-12.0. You may also test to see if the necessary intrinsics are available by checking to see if the macro BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR is defined.

diff --git a/doc/html/boost_typetraits/reference/has_virtual_destructor.html b/doc/html/boost_typetraits/reference/has_virtual_destructor.html index 6c0fe00..4abb29d 100644 --- a/doc/html/boost_typetraits/reference/has_virtual_destructor.html +++ b/doc/html/boost_typetraits/reference/has_virtual_destructor.html @@ -35,15 +35,14 @@ otherwise inherits from false_type.

- Compiler Compatibility: This trait is provided - for completeness, since it's part of the Technical Report on C++ Library - Extensions. However, there is currently no way to portably implement this - trait. The default version provided always inherits from false_type, + Compiler Compatibility: There is currently + no way to portably implement this trait: the default version always inherits + from false_type, and has to be explicitly specialized for types with virtual destructors unless the compiler used has compiler intrinsics - that enable the trait to do the right thing: Currently (May 2011) compilers - more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0, Intel-11.0, and Codegear - have the necessary compiler intrinsics + that enable the trait to do the right thing: Currently (June 2015) compilers + more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0, Intel-11.0, plus + Codegear and Clang have the necessary compiler intrinsics to ensure that this trait "just works". You may also test to see if the necessary intrinsics are available by checking to see if the macro BOOST_HAS_VIRTUAL_DESTRUCTOR diff --git a/doc/html/boost_typetraits/reference/integral_constant.html b/doc/html/boost_typetraits/reference/integral_constant.html index 4f53b75..8eb28b4 100644 --- a/doc/html/boost_typetraits/reference/integral_constant.html +++ b/doc/html/boost_typetraits/reference/integral_constant.html @@ -32,6 +32,7 @@ typedef integral_constant<T, val> type; typedef T value_type; static const T value = val; + constexpr operator T()const; }; typedef integral_constant<bool, true> true_type; diff --git a/doc/html/boost_typetraits/reference/integral_promotion.html b/doc/html/boost_typetraits/reference/integral_promotion.html index 223a773..ca664ba 100644 --- a/doc/html/boost_typetraits/reference/integral_promotion.html +++ b/doc/html/boost_typetraits/reference/integral_promotion.html @@ -49,7 +49,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.21. Examples

+

Table 1.22. Examples

diff --git a/doc/html/boost_typetraits/reference/is_array.html b/doc/html/boost_typetraits/reference/is_array.html index 3e84563..78741ae 100644 --- a/doc/html/boost_typetraits/reference/is_array.html +++ b/doc/html/boost_typetraits/reference/is_array.html @@ -7,7 +7,7 @@ - +
@@ -20,7 +20,7 @@

-PrevUpHomeNext +PrevUpHomeNext

@@ -43,9 +43,8 @@ or #include <boost/type_traits.hpp>

- Compiler Compatibility: If the compiler - does not support partial-specialization of class templates, then this template - can give the wrong result with function types. + Compiler Compatibility: All current compilers + are supported by this trait.

Examples: @@ -78,7 +77,7 @@


-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_typetraits/reference/is_base_of.html b/doc/html/boost_typetraits/reference/is_base_of.html index ecbd126..de2e639 100644 --- a/doc/html/boost_typetraits/reference/is_base_of.html +++ b/doc/html/boost_typetraits/reference/is_base_of.html @@ -6,7 +6,7 @@ - + @@ -20,7 +20,7 @@
-PrevUpHomeNext +PrevUpHomeNext

@@ -57,15 +57,8 @@ or #include <boost/type_traits.hpp>

- Compiler Compatibility: If the compiler - does not support partial-specialization of class templates, then this template - can not be used with function types. There are some older compilers which - will produce compiler errors if Base - is a private base class of Derived, - or if Base is an ambiguous - base of Derived. These compilers - include Borland C++, older versions of Sun Forte C++, Digital Mars C++, and - older versions of EDG based compilers. + Compiler Compatibility: All current compilers + are supported by this trait.

Examples: @@ -108,7 +101,7 @@


-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_typetraits/reference/is_class.html b/doc/html/boost_typetraits/reference/is_class.html index ae5c903..480364a 100644 --- a/doc/html/boost_typetraits/reference/is_class.html +++ b/doc/html/boost_typetraits/reference/is_class.html @@ -43,16 +43,11 @@ or #include <boost/type_traits.hpp>

- Compiler Compatibility: Without (some as - yet unspecified) help from the compiler, we cannot distinguish between union - and class types, as a result this type will erroneously inherit from true_type for - union types. See also is_union. - Currently (May 2011) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills - 6.0, Intel-11.0, and Codegear have the necessary compiler intrinsics - to ensure that this trait "just works". You may also test to see - if the necessary intrinsics - are available by checking to see if the macro BOOST_IS_CLASS - is defined. + Compiler Compatibility: This trait works + correctly for almost all current compilers (as of June 2015), with just a + minority of older compilers not correctly detecting all the corner cases. + You can check the macro BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION + which is defined to 1 when the class works correctly in all cases.

Examples: diff --git a/doc/html/boost_typetraits/reference/is_complex.html b/doc/html/boost_typetraits/reference/is_complex.html index ec977c7..684b36c 100644 --- a/doc/html/boost_typetraits/reference/is_complex.html +++ b/doc/html/boost_typetraits/reference/is_complex.html @@ -38,6 +38,10 @@

C++ Standard Reference: 26.2.

+

+ Compiler Compatibility: All current compilers + are supported by this trait. +

Header: #include <boost/type_traits/is_complex.hpp> diff --git a/doc/html/boost_typetraits/reference/is_compound.html b/doc/html/boost_typetraits/reference/is_compound.html index 0d04efa..41d9dde 100644 --- a/doc/html/boost_typetraits/reference/is_compound.html +++ b/doc/html/boost_typetraits/reference/is_compound.html @@ -38,6 +38,10 @@

C++ Standard Reference: 3.9.2.

+

+ Compiler Compatibility: All current compilers + are supported by this trait. +

Header: #include <boost/type_traits/is_compound.hpp> diff --git a/doc/html/boost_typetraits/reference/is_const.html b/doc/html/boost_typetraits/reference/is_const.html index 010c6ef..d5142bf 100644 --- a/doc/html/boost_typetraits/reference/is_const.html +++ b/doc/html/boost_typetraits/reference/is_const.html @@ -7,7 +7,7 @@ - + @@ -20,7 +20,7 @@


-PrevUpHomeNext +PrevUpHomeNext

@@ -42,6 +42,10 @@ <boost/type_traits/is_const.hpp> or #include <boost/type_traits.hpp>

+

+ Compiler Compatibility: All current compilers + are supported by this trait. +

Examples:

@@ -87,7 +91,7 @@
-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_typetraits/reference/is_convertible.html b/doc/html/boost_typetraits/reference/is_convertible.html index f4ccb5f..497748b 100644 --- a/doc/html/boost_typetraits/reference/is_convertible.html +++ b/doc/html/boost_typetraits/reference/is_convertible.html @@ -6,8 +6,8 @@ - - + + @@ -20,7 +20,7 @@

-PrevUpHomeNext +PrevUpHomeNext

@@ -69,12 +69,8 @@ C++ Standard Reference: 4 and 8.5.

- Compiler Compatibility: This template is - currently broken with Borland C++ Builder 5 (and earlier), for constructor-based - conversions, and for the Metrowerks 7 (and earlier) compiler in all cases. - If the compiler does not support is_abstract, - then the template parameter To - must not be an abstract type. + Compiler Compatibility: All current compilers + are supported by this trait.

Header: #include @@ -127,7 +123,7 @@


-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_typetraits/reference/is_copy_assignable.html b/doc/html/boost_typetraits/reference/is_copy_assignable.html index 9b2495a..83f3f3d 100644 --- a/doc/html/boost_typetraits/reference/is_copy_assignable.html +++ b/doc/html/boost_typetraits/reference/is_copy_assignable.html @@ -6,8 +6,8 @@ - - + + @@ -20,7 +20,7 @@

-PrevUpHomeNext +PrevUpHomeNext

@@ -47,9 +47,9 @@ boost::noncopyable and is not marked with BOOST_MOVABLE_BUT_NOT_COPYABLE(T).

- Compiler Compatibility: If the compiler - does not support partial-specialization of class templates, then this template - can not be used. + Compiler Compatibility: Requires the C++11 + features decltype and SFINAE-expressions + for full support.

If your compiler does not support C++11 deleted functions (= delete) @@ -100,7 +100,7 @@


-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_typetraits/reference/is_copy_constructible.html b/doc/html/boost_typetraits/reference/is_copy_constructible.html index 456c272..aa9782f 100644 --- a/doc/html/boost_typetraits/reference/is_copy_constructible.html +++ b/doc/html/boost_typetraits/reference/is_copy_constructible.html @@ -6,8 +6,8 @@ - - + + @@ -20,7 +20,7 @@

-PrevUpHomeNext +PrevUpHomeNext

@@ -45,9 +45,9 @@ boost::noncopyable and does not marked with BOOST_MOVABLE_BUT_NOT_COPYABLE(T).

- Compiler Compatibility: If the compiler - does not support partial-specialization of class templates, then this template - can not be used. + Compiler Compatibility: This trait requires + the C++11 features decltype + and SFINAE-expression support for full support.

If your compiler does not support C++11 deleted functions (= delete) @@ -56,7 +56,8 @@ that class is noncopyable.

- Trait does not care about access modifiers, so if you see errors like this: + The trait does not care about access modifiers, so if you see errors like + this:

'T::T(const T&)' is private
 boost/type_traits/is_copy_constructible.hpp:68:5: error: within this context
@@ -97,7 +98,7 @@
 
 
-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_typetraits/reference/is_empty.html b/doc/html/boost_typetraits/reference/is_empty.html index f2be447..fbff564 100644 --- a/doc/html/boost_typetraits/reference/is_empty.html +++ b/doc/html/boost_typetraits/reference/is_empty.html @@ -6,7 +6,7 @@ - + @@ -20,7 +20,7 @@
-PrevUpHomeNext +PrevUpHomeNext

@@ -59,13 +59,6 @@

Can not be used with incomplete types.

-

- Can not be used with union types, until is_union can be made to work. -

-

- If the compiler does not support partial-specialization of class templates, - then this template can not be used with abstract types. -

Examples:

@@ -103,7 +96,7 @@
-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_typetraits/reference/is_enum.html b/doc/html/boost_typetraits/reference/is_enum.html index d026c1b..cfa1e46 100644 --- a/doc/html/boost_typetraits/reference/is_enum.html +++ b/doc/html/boost_typetraits/reference/is_enum.html @@ -43,11 +43,8 @@ or #include <boost/type_traits.hpp>

- Compiler Compatibility: Requires a correctly - functioning is_convertible - template; this means that is_enum is currently broken under Borland C++ Builder - 5, and for the Metrowerks compiler prior to version 8, other compilers should - handle this template just fine. + Compiler Compatibility: All current compilers + are supported by this trait.

Examples: diff --git a/doc/html/boost_typetraits/reference/is_final.html b/doc/html/boost_typetraits/reference/is_final.html index 8d94ed4..cd40fb2 100644 --- a/doc/html/boost_typetraits/reference/is_final.html +++ b/doc/html/boost_typetraits/reference/is_final.html @@ -45,11 +45,12 @@ never inherit from true_type, unless the user explicitly specializes the template for their user-defined final class types, or unless the compiler supplies some unspecified intrinsic - that implements this functionality. Currently (Aug 2014) compilers more recent - than GCC-4.7, and Clang have the necessary compiler intrinsics - to ensure that this trait "just works". You may also test to see - if the necessary intrinsics - are available by checking to see if the macro BOOST_IS_FINAL + that implements this functionality. Currently (June 2015) compilers more + recent than GCC-4.7, Oracle-12.4, and Clang have the necessary compiler + intrinsics to ensure that + this trait "just works". You may also test to see if the necessary + intrinsics are available + by checking to see if the macro BOOST_IS_FINAL is defined.

diff --git a/doc/html/boost_typetraits/reference/is_floating_point.html b/doc/html/boost_typetraits/reference/is_floating_point.html index e79fd23..2335462 100644 --- a/doc/html/boost_typetraits/reference/is_floating_point.html +++ b/doc/html/boost_typetraits/reference/is_floating_point.html @@ -37,6 +37,10 @@

C++ Standard Reference: 3.9.1p8.

+

+ Compiler Compatibility: All current compilers + are supported by this trait. +

Header: #include <boost/type_traits/is_floating_point.hpp> diff --git a/doc/html/boost_typetraits/reference/is_function.html b/doc/html/boost_typetraits/reference/is_function.html index 8cd9e5a..0f24871 100644 --- a/doc/html/boost_typetraits/reference/is_function.html +++ b/doc/html/boost_typetraits/reference/is_function.html @@ -43,6 +43,10 @@

C++ Standard Reference: 3.9.2p1 and 8.3.5.

+

+ Compiler Compatibility: All current compilers + are supported by this trait. +

Header: #include <boost/type_traits/is_function.hpp> diff --git a/doc/html/boost_typetraits/reference/is_fundamental.html b/doc/html/boost_typetraits/reference/is_fundamental.html index 330e2e1..e074caa 100644 --- a/doc/html/boost_typetraits/reference/is_fundamental.html +++ b/doc/html/boost_typetraits/reference/is_fundamental.html @@ -41,6 +41,10 @@

C++ Standard Reference: 3.9.1.

+

+ Compiler Compatibility: All current compilers + are supported by this trait. +

Header: #include <boost/type_traits/is_fundamental.hpp> diff --git a/doc/html/boost_typetraits/reference/is_integral.html b/doc/html/boost_typetraits/reference/is_integral.html index 2de58bb..bdbb7a2 100644 --- a/doc/html/boost_typetraits/reference/is_integral.html +++ b/doc/html/boost_typetraits/reference/is_integral.html @@ -37,6 +37,10 @@

C++ Standard Reference: 3.9.1p7.

+

+ Compiler Compatibility: All current compilers + are supported by this trait. +

Header: #include <boost/type_traits/is_integral.hpp> diff --git a/doc/html/boost_typetraits/reference/is_lvalue_reference.html b/doc/html/boost_typetraits/reference/is_lvalue_reference.html index c076691..56c51dc 100644 --- a/doc/html/boost_typetraits/reference/is_lvalue_reference.html +++ b/doc/html/boost_typetraits/reference/is_lvalue_reference.html @@ -38,10 +38,8 @@ C++ Standard Reference: 3.9.2 and 8.3.2.

- Compiler Compatibility: If the compiler - does not support partial-specialization of class templates, then this template - may report the wrong result for function types, and for types that are both - const and volatile qualified. + Compiler Compatibility: All current compilers + are supported by this trait.

Header: #include diff --git a/doc/html/boost_typetraits/reference/is_member_function_pointer.html b/doc/html/boost_typetraits/reference/is_member_function_pointer.html index 0ffe473..15ece40 100644 --- a/doc/html/boost_typetraits/reference/is_member_function_pointer.html +++ b/doc/html/boost_typetraits/reference/is_member_function_pointer.html @@ -37,6 +37,10 @@

C++ Standard Reference: 3.9.2 and 8.3.3.

+

+ Compiler Compatibility: All current compilers + are supported by this trait. +

Header: #include <boost/type_traits/is_member_function_pointer.hpp> diff --git a/doc/html/boost_typetraits/reference/is_member_object_pointer.html b/doc/html/boost_typetraits/reference/is_member_object_pointer.html index 1d220c3..b046242 100644 --- a/doc/html/boost_typetraits/reference/is_member_object_pointer.html +++ b/doc/html/boost_typetraits/reference/is_member_object_pointer.html @@ -37,6 +37,10 @@

C++ Standard Reference: 3.9.2 and 8.3.3.

+

+ Compiler Compatibility: All current compilers + are supported by this trait. +

Header: #include <boost/type_traits/is_member_object_pointer.hpp> diff --git a/doc/html/boost_typetraits/reference/is_member_pointer.html b/doc/html/boost_typetraits/reference/is_member_pointer.html index 2218849..0ed4032 100644 --- a/doc/html/boost_typetraits/reference/is_member_pointer.html +++ b/doc/html/boost_typetraits/reference/is_member_pointer.html @@ -38,6 +38,10 @@

C++ Standard Reference: 3.9.2 and 8.3.3.

+

+ Compiler Compatibility: All current compilers + are supported by this trait. +

Header: #include <boost/type_traits/is_member_pointer.hpp> diff --git a/doc/html/boost_typetraits/reference/is_nothrow_move_assignable.html b/doc/html/boost_typetraits/reference/is_nothrow_move_assignable.html index 9535553..48da178 100644 --- a/doc/html/boost_typetraits/reference/is_nothrow_move_assignable.html +++ b/doc/html/boost_typetraits/reference/is_nothrow_move_assignable.html @@ -53,9 +53,9 @@ Without some (C++11 noexcept shall work correctly) help from the compiler, is_nothrow_move_assignable will never report that a class or struct has a non-throwing assignment-operator; - this is always safe, if possibly sub-optimal. Currently (February 2013) Clang - and GCC 4.7 have the necessary compiler support to ensure that this trait - "just works". + this is always safe, if possibly sub-optimal. Currently (June 2015) MSVC-12.0, + Clang and GCC 4.7 have the necessary compiler support to ensure that this + trait "just works".

Header: #include diff --git a/doc/html/boost_typetraits/reference/is_nothrow_move_constructible.html b/doc/html/boost_typetraits/reference/is_nothrow_move_constructible.html index 1d7d2df..1ae4dc1 100644 --- a/doc/html/boost_typetraits/reference/is_nothrow_move_constructible.html +++ b/doc/html/boost_typetraits/reference/is_nothrow_move_constructible.html @@ -43,17 +43,12 @@ is a variable of type T).

- Compiler Compatibility: If the compiler - does not support partial-specialization of class templates, then this template - can not be used with function types. -

-

- Without some (C++11 noexcept shall work correctly) help from the compiler, - is_nothrow_move_constructible + Compiler Compatibility: Without some (C++11 + noexcept shall work correctly) help from the compiler, is_nothrow_move_constructible will never report that a class or struct has a non-throwing copy-constructor; - this is always safe, if possibly sub-optimal. Currently (February 2013) Clang - and GCC 4.7 have the necessary compiler support to ensure that this trait - "just works". + this is always safe, if possibly sub-optimal. Currently (February 2013) MSVC-12.0, + Clang and GCC 4.7 have the necessary compiler support to ensure that this + trait "just works".

Header: #include diff --git a/doc/html/boost_typetraits/reference/is_object.html b/doc/html/boost_typetraits/reference/is_object.html index c449d8c..bb2fdc1 100644 --- a/doc/html/boost_typetraits/reference/is_object.html +++ b/doc/html/boost_typetraits/reference/is_object.html @@ -38,6 +38,10 @@

C++ Standard Reference: 3.9p9.

+

+ Compiler Compatibility: All current compilers + are supported by this trait. +

Header: #include <boost/type_traits/is_object.hpp> diff --git a/doc/html/boost_typetraits/reference/is_pod.html b/doc/html/boost_typetraits/reference/is_pod.html index d8d2ff9..320a5a9 100644 --- a/doc/html/boost_typetraits/reference/is_pod.html +++ b/doc/html/boost_typetraits/reference/is_pod.html @@ -48,19 +48,14 @@ that POD's are also aggregates, see 8.5.1).

- Compiler Compatibility: If the compiler - does not support partial-specialization of class templates, then this template - can not be used with function types. -

-

- Without some (as yet unspecified) help from the compiler, is_pod will never - report that a class or struct is a POD; this is always safe, if possibly - sub-optimal. Currently (May 2011) compilers more recent than Visual C++ 8, - GCC-4.3, Greenhills 6.0, Intel-11.0, and Codegear have the necessary compiler - intrinsics to ensure that - this trait "just works". You may also test to see if the necessary - intrinsics are available - by checking to see if the macro BOOST_IS_POD + Compiler Compatibility: Without some (as + yet unspecified) help from the compiler, is_pod will never report that a + class or struct is a POD; this is always safe, if possibly sub-optimal. Currently + (June 2015) compilers more recent than Visual C++ 8, Clang-3, GCC-4.3, Greenhills + 6.0, Intel-11.0, and Codegear have the necessary compiler intrinsics + to ensure that this trait "just works". You may also test to see + if the necessary intrinsics + are available by checking to see if the macro BOOST_IS_POD is defined.

diff --git a/doc/html/boost_typetraits/reference/is_pointer.html b/doc/html/boost_typetraits/reference/is_pointer.html index 9a05fa0..54afdb5 100644 --- a/doc/html/boost_typetraits/reference/is_pointer.html +++ b/doc/html/boost_typetraits/reference/is_pointer.html @@ -43,6 +43,10 @@ <boost/type_traits/is_pointer.hpp> or #include <boost/type_traits.hpp>

+

+ Compiler Compatibility: All current compilers + are supported by this trait. +

Examples:

diff --git a/doc/html/boost_typetraits/reference/is_reference.html b/doc/html/boost_typetraits/reference/is_reference.html index a46b750..3a626c7 100644 --- a/doc/html/boost_typetraits/reference/is_reference.html +++ b/doc/html/boost_typetraits/reference/is_reference.html @@ -38,10 +38,8 @@ C++ Standard Reference: 3.9.2 and 8.3.2.

- Compiler Compatibility: If the compiler - does not support partial-specialization of class templates, then this template - may report the wrong result for function types, and for types that are both - const and volatile qualified. + Compiler Compatibility: All current compilers + are supported by this trait.

Header: #include diff --git a/doc/html/boost_typetraits/reference/is_rvalue_reference.html b/doc/html/boost_typetraits/reference/is_rvalue_reference.html index e3b8b57..03efcd4 100644 --- a/doc/html/boost_typetraits/reference/is_rvalue_reference.html +++ b/doc/html/boost_typetraits/reference/is_rvalue_reference.html @@ -38,10 +38,8 @@ C++ Standard Reference: 3.9.2 and 8.3.2.

- Compiler Compatibility: If the compiler - does not support partial-specialization of class templates, then this template - may report the wrong result for function types, and for types that are both - const and volatile qualified. + Compiler Compatibility: All current compilers + are supported by this trait.

Header: #include diff --git a/doc/html/boost_typetraits/reference/is_same.html b/doc/html/boost_typetraits/reference/is_same.html index 7644c8c..41e2ba5 100644 --- a/doc/html/boost_typetraits/reference/is_same.html +++ b/doc/html/boost_typetraits/reference/is_same.html @@ -40,9 +40,8 @@ or #include <boost/type_traits.hpp>

- Compiler Compatibility: If the compiler - does not support partial-specialization of class templates, then this template - can not be used with abstract, incomplete or function types. + Compiler Compatibility: All current compilers + are supported by this trait.

Examples: diff --git a/doc/html/boost_typetraits/reference/is_scalar.html b/doc/html/boost_typetraits/reference/is_scalar.html index 8ebbd9d..86f733d 100644 --- a/doc/html/boost_typetraits/reference/is_scalar.html +++ b/doc/html/boost_typetraits/reference/is_scalar.html @@ -45,9 +45,8 @@ or #include <boost/type_traits.hpp>

- Compiler Compatibility: If the compiler - does not support partial-specialization of class templates, then this template - can not be used with function types. + Compiler Compatibility: All current compilers + are supported by this trait.

Examples: diff --git a/doc/html/boost_typetraits/reference/is_signed.html b/doc/html/boost_typetraits/reference/is_signed.html index 54db92e..b443e2a 100644 --- a/doc/html/boost_typetraits/reference/is_signed.html +++ b/doc/html/boost_typetraits/reference/is_signed.html @@ -38,6 +38,10 @@

C++ Standard Reference: 3.9.1, 7.2.

+

+ Compiler Compatibility: All current compilers + are supported by this trait. +

Header: #include <boost/type_traits/is_signed.hpp> diff --git a/doc/html/boost_typetraits/reference/is_stateless.html b/doc/html/boost_typetraits/reference/is_stateless.html index feb4b0c..b207dcf 100644 --- a/doc/html/boost_typetraits/reference/is_stateless.html +++ b/doc/html/boost_typetraits/reference/is_stateless.html @@ -58,17 +58,12 @@ or #include <boost/type_traits.hpp>

- Compiler Compatibility: If the compiler - does not support partial-specialization of class templates, then this template - can not be used with function types. -

-

- Without some (as yet unspecified) help from the compiler, is_stateless will - never report that a class or struct is stateless; this is always safe, if - possibly sub-optimal. Currently (May 2011) compilers more recent than Visual - C++ 8, GCC-4.3, Greenhills 6.0, Intel-11.0, and Codegear have the necessary - compiler intrinsics to - ensure that this trait "just works". + Compiler Compatibility: Without some (as + yet unspecified) help from the compiler, is_stateless will never report that + a class or struct is stateless; this is always safe, if possibly sub-optimal. + Currently (June 2015) compilers more recent than Visual C++ 8, Clang, GCC-4.3, + Greenhills 6.0, Intel-11.0, and Codegear have the necessary compiler intrinsics to ensure that this + trait "just works".

diff --git a/doc/html/boost_typetraits/reference/is_union.html b/doc/html/boost_typetraits/reference/is_union.html index f6cd401..eb03217 100644 --- a/doc/html/boost_typetraits/reference/is_union.html +++ b/doc/html/boost_typetraits/reference/is_union.html @@ -46,9 +46,9 @@ inherit from true_type, unless the user explicitly specializes the template for their user-defined union types, or unless the compiler supplies some unspecified intrinsic that - implements this functionality. Currently (May 2011) compilers more recent - than Visual C++ 8, GCC-4.3, Greenhills 6.0, Intel-11.0, and Codegear have - the necessary compiler intrinsics + implements this functionality. Currently (June 2015) compilers more recent + than Visual C++ 8, clang, GCC-4.3, Greenhills 6.0, Intel-11.0, and Codegear + have the necessary compiler intrinsics to ensure that this trait "just works". You may also test to see if the necessary intrinsics are available by checking to see if the macro BOOST_IS_UNION diff --git a/doc/html/boost_typetraits/reference/is_unsigned.html b/doc/html/boost_typetraits/reference/is_unsigned.html index d49a6b6..4c706d7 100644 --- a/doc/html/boost_typetraits/reference/is_unsigned.html +++ b/doc/html/boost_typetraits/reference/is_unsigned.html @@ -38,6 +38,10 @@

C++ Standard Reference: 3.9.1, 7.2.

+

+ Compiler Compatibility: All current compilers + are supported by this trait. +

Header: #include <boost/type_traits/is_unsigned.hpp> diff --git a/doc/html/boost_typetraits/reference/is_virtual_base_of.html b/doc/html/boost_typetraits/reference/is_virtual_base_of.html index 238ea34..7d1f9dd 100644 --- a/doc/html/boost_typetraits/reference/is_virtual_base_of.html +++ b/doc/html/boost_typetraits/reference/is_virtual_base_of.html @@ -46,9 +46,8 @@ or #include <boost/type_traits.hpp>

- Compiler Compatibility: this trait also - requires a working is_base_of - trait. + Compiler Compatibility: All current compilers + are supported by this trait.

@@ -58,7 +57,8 @@

There are a small number of cases where it's simply not possible for this trait to work, and where attempting to instantiate the trait will cause - compiler errors (see bug report #3730). + compiler errors (see bug reports #3730 + and 11323). Further more the issues may well be compiler specific. In this situation the user should supply a full specialization of the trait to work around the problem. diff --git a/doc/html/boost_typetraits/reference/is_void.html b/doc/html/boost_typetraits/reference/is_void.html index d1fbee0..819d96c 100644 --- a/doc/html/boost_typetraits/reference/is_void.html +++ b/doc/html/boost_typetraits/reference/is_void.html @@ -37,6 +37,10 @@

C++ Standard Reference: 3.9.1p9.

+

+ Compiler Compatibility: All current compilers + are supported by this trait. +

Header: #include <boost/type_traits/is_void.hpp> diff --git a/doc/html/boost_typetraits/reference/is_volatile.html b/doc/html/boost_typetraits/reference/is_volatile.html index 59cc21f..9d3c19a 100644 --- a/doc/html/boost_typetraits/reference/is_volatile.html +++ b/doc/html/boost_typetraits/reference/is_volatile.html @@ -37,6 +37,10 @@

C++ Standard Reference: 3.9.3.

+

+ Compiler Compatibility: All current compilers + are supported by this trait. +

Header: #include <boost/type_traits/is_volatile.hpp> diff --git a/doc/html/boost_typetraits/reference/make_signed.html b/doc/html/boost_typetraits/reference/make_signed.html index cf3a724..2baa3af 100644 --- a/doc/html/boost_typetraits/reference/make_signed.html +++ b/doc/html/boost_typetraits/reference/make_signed.html @@ -48,13 +48,17 @@

C++ Standard Reference: 3.9.1.

+

+ Compiler Compatibility: All current compilers + are supported by this trait. +

Header: #include <boost/type_traits/make_signed.hpp> or #include <boost/type_traits.hpp>

-

Table 1.22. Examples

+

Table 1.23. Examples

diff --git a/doc/html/boost_typetraits/reference/make_unsigned.html b/doc/html/boost_typetraits/reference/make_unsigned.html index 48ace73..914cacf 100644 --- a/doc/html/boost_typetraits/reference/make_unsigned.html +++ b/doc/html/boost_typetraits/reference/make_unsigned.html @@ -48,13 +48,17 @@

C++ Standard Reference: 3.9.1.

+

+ Compiler Compatibility: All current compilers + are supported by this trait. +

Header: #include <boost/type_traits/make_unsigned.hpp> or #include <boost/type_traits.hpp>

-

Table 1.23. Examples

+

Table 1.24. Examples

diff --git a/doc/html/boost_typetraits/reference/promote.html b/doc/html/boost_typetraits/reference/promote.html index abc78e7..69a600b 100644 --- a/doc/html/boost_typetraits/reference/promote.html +++ b/doc/html/boost_typetraits/reference/promote.html @@ -45,13 +45,17 @@ C++ Standard Reference: 4.5 except 4.5/3 (integral bit-field) and 4.6.

+

+ Compiler Compatibility: All current compilers + are supported by this trait. +

Header: #include <boost/type_traits/promote.hpp> or #include <boost/type_traits.hpp>

-

Table 1.24. Examples

+

Table 1.25. Examples

diff --git a/doc/html/boost_typetraits/reference/rank.html b/doc/html/boost_typetraits/reference/rank.html index 5dcb436..875e73a 100644 --- a/doc/html/boost_typetraits/reference/rank.html +++ b/doc/html/boost_typetraits/reference/rank.html @@ -39,6 +39,10 @@ If T is not a (built-in) array type, then RANK(T) is zero.

+

+ Compiler Compatibility: All current compilers + are supported by this trait. +

Header: #include <boost/type_traits/rank.hpp> diff --git a/doc/html/boost_typetraits/reference/remove_all_extents.html b/doc/html/boost_typetraits/reference/remove_all_extents.html index 212417d..3b844e9 100644 --- a/doc/html/boost_typetraits/reference/remove_all_extents.html +++ b/doc/html/boost_typetraits/reference/remove_all_extents.html @@ -41,12 +41,8 @@ C++ Standard Reference: 8.3.4.

- Compiler Compatibility: If the compiler - does not support partial specialization of class-templates then this template - will compile, but the member type - will always be the same as type T - except where compiler - workarounds have been applied. + Compiler Compatibility: All current compilers + are supported by this trait.

Header: #include @@ -54,7 +50,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.25. Examples

+

Table 1.26. Examples

diff --git a/doc/html/boost_typetraits/reference/remove_const.html b/doc/html/boost_typetraits/reference/remove_const.html index cd88642..77753f1 100644 --- a/doc/html/boost_typetraits/reference/remove_const.html +++ b/doc/html/boost_typetraits/reference/remove_const.html @@ -40,12 +40,8 @@ C++ Standard Reference: 3.9.3.

- Compiler Compatibility: If the compiler - does not support partial specialization of class-templates then this template - will compile, but the member type - will always be the same as type T - except where compiler - workarounds have been applied. + Compiler Compatibility: All current compilers + are supported by this trait.

Header: #include @@ -53,7 +49,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.26. Examples

+

Table 1.27. Examples

diff --git a/doc/html/boost_typetraits/reference/remove_cv.html b/doc/html/boost_typetraits/reference/remove_cv.html index 933e79d..91ac299 100644 --- a/doc/html/boost_typetraits/reference/remove_cv.html +++ b/doc/html/boost_typetraits/reference/remove_cv.html @@ -40,12 +40,8 @@ C++ Standard Reference: 3.9.3.

- Compiler Compatibility: If the compiler - does not support partial specialization of class-templates then this template - will compile, but the member type - will always be the same as type T - except where compiler - workarounds have been applied. + Compiler Compatibility: All current compilers + are supported by this trait.

Header: #include @@ -53,7 +49,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.27. Examples

+

Table 1.28. Examples

diff --git a/doc/html/boost_typetraits/reference/remove_extent.html b/doc/html/boost_typetraits/reference/remove_extent.html index bb5b7b3..05ffeff 100644 --- a/doc/html/boost_typetraits/reference/remove_extent.html +++ b/doc/html/boost_typetraits/reference/remove_extent.html @@ -41,12 +41,8 @@ C++ Standard Reference: 8.3.4.

- Compiler Compatibility: If the compiler - does not support partial specialization of class-templates then this template - will compile, but the member type - will always be the same as type T - except where compiler - workarounds have been applied. + Compiler Compatibility: All current compilers + are supported by this trait.

Header: #include @@ -54,7 +50,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.28. Examples

+

Table 1.29. Examples

diff --git a/doc/html/boost_typetraits/reference/remove_pointer.html b/doc/html/boost_typetraits/reference/remove_pointer.html index de1db74..bf2d59f 100644 --- a/doc/html/boost_typetraits/reference/remove_pointer.html +++ b/doc/html/boost_typetraits/reference/remove_pointer.html @@ -42,12 +42,8 @@ C++ Standard Reference: 8.3.1.

- Compiler Compatibility: If the compiler - does not support partial specialization of class-templates then this template - will compile, but the member type - will always be the same as type T - except where compiler - workarounds have been applied. + Compiler Compatibility: All current compilers + are supported by this trait.

Header: #include @@ -55,7 +51,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.29. Examples

+

Table 1.30. Examples

diff --git a/doc/html/boost_typetraits/reference/remove_reference.html b/doc/html/boost_typetraits/reference/remove_reference.html index 4ffeff9..37caa50 100644 --- a/doc/html/boost_typetraits/reference/remove_reference.html +++ b/doc/html/boost_typetraits/reference/remove_reference.html @@ -40,12 +40,8 @@ C++ Standard Reference: 8.3.2.

- Compiler Compatibility: If the compiler - does not support partial specialization of class-templates then this template - will compile, but the member type - will always be the same as type T - except where compiler - workarounds have been applied. + Compiler Compatibility: All current compilers + are supported by this trait.

Header: #include @@ -53,7 +49,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.30. Examples

+

Table 1.31. Examples

diff --git a/doc/html/boost_typetraits/reference/remove_volatile.html b/doc/html/boost_typetraits/reference/remove_volatile.html index 57f4735..155fb13 100644 --- a/doc/html/boost_typetraits/reference/remove_volatile.html +++ b/doc/html/boost_typetraits/reference/remove_volatile.html @@ -7,7 +7,7 @@ - +
@@ -20,7 +20,7 @@

-PrevUpHomeNext +PrevUpHomeNext

@@ -40,12 +40,8 @@ C++ Standard Reference: 3.9.3.

- Compiler Compatibility: If the compiler - does not support partial specialization of class-templates then this template - will compile, but the member type - will always be the same as type T - except where compiler - workarounds have been applied. + Compiler Compatibility: All current compilers + are supported by this trait.

Header: #include @@ -53,7 +49,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.31. Examples

+

Table 1.32. Examples

@@ -155,7 +151,7 @@

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_typetraits/reference/type_with_alignment.html b/doc/html/boost_typetraits/reference/type_with_alignment.html index 242e702..67156e5 100644 --- a/doc/html/boost_typetraits/reference/type_with_alignment.html +++ b/doc/html/boost_typetraits/reference/type_with_alignment.html @@ -6,7 +6,7 @@ - + @@ -20,7 +20,7 @@


-PrevUpHomeNext +PrevUpHomeNext

@@ -56,7 +56,7 @@
-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/index.html b/doc/html/index.html index 6b90ebf..e4aedc8 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -94,7 +94,9 @@
alignment_of
conditional
common_type
+
copy_cv
decay
+
declval
extent
floating_point_promotion
function_traits
@@ -130,6 +132,7 @@
has_nothrow_assign
has_nothrow_constructor
has_nothrow_copy
+
has_nothrow_destructor
has_nothrow_copy_constructor
has_nothrow_default_constructor
has_plus
@@ -156,14 +159,18 @@
is_abstract
is_arithmetic
is_array
+
is_assignable
is_base_of
is_class
is_complex
is_compound
is_const
+
is_constructible
is_convertible
-
is_copy_constructible
is_copy_assignable
+
is_copy_constructible
+
is_default_constructible
+
is_destructible
is_empty
is_enum
is_final
@@ -203,6 +210,7 @@
remove_pointer
remove_reference
remove_volatile
+
type_identity
type_with_alignment
History
diff --git a/doc/html/index/s11.html b/doc/html/index/s11.html index 198d865..cedaa2f 100644 --- a/doc/html/index/s11.html +++ b/doc/html/index/s11.html @@ -24,7 +24,7 @@

-Class Index

+Class Index

A C D E F H I M N O P R T

diff --git a/doc/html/index/s12.html b/doc/html/index/s12.html index 268e753..c03e68e 100644 --- a/doc/html/index/s12.html +++ b/doc/html/index/s12.html @@ -24,7 +24,7 @@

-Typedef Index

+Typedef Index

F R T V

diff --git a/doc/html/index/s13.html b/doc/html/index/s13.html index 6db8623..96f4896 100644 --- a/doc/html/index/s13.html +++ b/doc/html/index/s13.html @@ -24,7 +24,7 @@

-Macro Index

+Macro Index

B

@@ -36,16 +36,13 @@
  • -

    BOOST_COMMON_TYPE_DONT_USE_TYPEOF

    - -
  • -
  • BOOST_HAS_NOTHROW_ASSIGN

  • BOOST_HAS_NOTHROW_CONSTRUCTOR

    @@ -116,10 +113,7 @@
  • BOOST_IS_CLASS

    - +
  • BOOST_IS_CONVERTIBLE

    @@ -169,6 +163,10 @@
  • Macros for Compiler Intrinsics

  • +
  • +

    BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION

    + +
  • diff --git a/doc/html/index/s14.html b/doc/html/index/s14.html index 47b53f0..f7f55ae 100644 --- a/doc/html/index/s14.html +++ b/doc/html/index/s14.html @@ -23,7 +23,7 @@

    -Index

    +Index

    A B C D E F H I M N O P R T U V

    @@ -67,16 +67,13 @@
  • -

    BOOST_COMMON_TYPE_DONT_USE_TYPEOF

    - -
  • -
  • BOOST_HAS_NOTHROW_ASSIGN

  • BOOST_HAS_NOTHROW_CONSTRUCTOR

    @@ -147,10 +144,7 @@
  • BOOST_IS_CLASS

    - +
  • BOOST_IS_CONVERTIBLE

    @@ -200,18 +194,24 @@
  • Macros for Compiler Intrinsics

  • +
  • +

    BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION

    + +
  • C
    -
    D
    @@ -512,6 +512,10 @@
  • has_new_operator

  • +

    has_nothrow_assign

    + +
  • +
  • has_nothrow_constructor

    • BOOST_HAS_NOTHROW_CONSTRUCTOR

    • @@ -535,6 +539,7 @@

      has_nothrow_default_constructor

      +
    • has_nothrow_destructor

    • has_not_equal_to

        @@ -613,7 +618,10 @@
      • has_trivial_assign

        - +
      • has_trivial_constructor

        @@ -647,7 +655,10 @@
      • has_trivial_move_assign

        - +
      • has_trivial_move_constructor

        @@ -706,11 +717,12 @@
      • is_abstract

      • is_arithmetic

      • is_array

      • +
      • is_assignable

      • is_base_of

      • is_class

        @@ -718,6 +730,7 @@
      • is_complex

      • is_compound

      • is_const

      • +
      • is_constructible

      • is_convertible

      • is_convertible_to_Ret

        @@ -725,6 +738,8 @@
      • is_copy_assignable

      • is_copy_constructible

      • +
      • is_default_constructible

      • +
      • is_destructible

      • is_empty

        diff --git a/test/has_nothrow_constr_test.cpp b/test/has_nothrow_constr_test.cpp index f2d60e3..0cc5cb7 100644 --- a/test/has_nothrow_constr_test.cpp +++ b/test/has_nothrow_constr_test.cpp @@ -37,6 +37,15 @@ struct deleted_default_construct #endif +struct private_default_construct +{ +private: + private_default_construct(); +public: + private_default_construct(char val) : member(val) {} + char member; +}; + #ifndef BOOST_NO_CXX11_NOEXCEPT struct noexcept_default_construct { @@ -201,6 +210,7 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::v #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, false); #endif +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, false); #ifndef BOOST_NO_CXX11_NOEXCEPT BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); #endif diff --git a/test/has_nothrow_copy_test.cpp b/test/has_nothrow_copy_test.cpp index aa2ca02..034cb65 100644 --- a/test/has_nothrow_copy_test.cpp +++ b/test/has_nothrow_copy_test.cpp @@ -12,6 +12,13 @@ # include #endif +struct non_copy +{ + non_copy(); +private: + non_copy(const non_copy&); +}; + #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS struct delete_copy @@ -230,6 +237,10 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy::value, false) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy::value, true); #endif +#if !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy::value, false); +#endif + TT_TEST_END diff --git a/test/has_trivial_assign_test.cpp b/test/has_trivial_assign_test.cpp index 50aced7..c5e40a3 100644 --- a/test/has_trivial_assign_test.cpp +++ b/test/has_trivial_assign_test.cpp @@ -12,6 +12,13 @@ # include #endif +struct non_assignable +{ + non_assignable(); +private: + non_assignable& operator=(const non_assignable&); +}; + #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS struct non_assignable2 @@ -217,6 +224,7 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign::value, false) #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign::value, false); #endif +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign::value, false); TT_TEST_END diff --git a/test/has_trivial_constr_test.cpp b/test/has_trivial_constr_test.cpp index 4b89df3..16a4e8a 100644 --- a/test/has_trivial_constr_test.cpp +++ b/test/has_trivial_constr_test.cpp @@ -27,6 +27,13 @@ public: explicit bug11324_derived(char arg) : data(arg) {} }; +struct private_construct +{ + private_construct(int); +private: + private_construct(); +}; + #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS struct deleted_construct @@ -197,6 +204,7 @@ BOOST_CHECK_SOFT_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, false); #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, false); #endif diff --git a/test/has_trivial_copy_test.cpp b/test/has_trivial_copy_test.cpp index 6a803b8..043f76e 100644 --- a/test/has_trivial_copy_test.cpp +++ b/test/has_trivial_copy_test.cpp @@ -25,6 +25,13 @@ public: #endif +struct private_copy +{ + private_copy(); +private: + private_copy(const private_copy&); +}; + TT_TEST_BEGIN(has_trivial_copy) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy::value, true); @@ -220,6 +227,7 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy::value, false); #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy::value, false); #endif +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy::value, false); TT_TEST_END diff --git a/test/has_trivial_destructor_test.cpp b/test/has_trivial_destructor_test.cpp index 960a575..3792004 100644 --- a/test/has_trivial_destructor_test.cpp +++ b/test/has_trivial_destructor_test.cpp @@ -22,6 +22,13 @@ struct deleted_destruct #endif +struct private_destruct +{ + private_destruct(); +private: + ~private_destruct(); +}; + TT_TEST_BEGIN(has_trivial_destructor) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, true); @@ -180,6 +187,7 @@ 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); #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, false); #endif diff --git a/test/is_default_constr_test.cpp b/test/is_default_constr_test.cpp index 01a702c..89444b3 100644 --- a/test/is_default_constr_test.cpp +++ b/test/is_default_constr_test.cpp @@ -37,6 +37,15 @@ struct deleted_default_construct #endif +struct private_default_construct +{ +private: + private_default_construct(); +public: + private_default_construct(char val) : member(val) {} + char member; +}; + TT_TEST_BEGIN(is_default_constructible) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_default_constructible::value, true); @@ -189,6 +198,7 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_default_constructible:: #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_default_constructible::value, false); #endif +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_default_constructible::value, false); TT_TEST_END diff --git a/test/is_nothrow_move_constructible_test.cpp b/test/is_nothrow_move_constructible_test.cpp index 3fdad74..d756edc 100644 --- a/test/is_nothrow_move_constructible_test.cpp +++ b/test/is_nothrow_move_constructible_test.cpp @@ -14,6 +14,13 @@ # include #endif +struct non_copy +{ + non_copy(); +private: + non_copy(const non_copy&); +}; + #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS struct delete_copy @@ -238,6 +245,8 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, false); + #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, false); #endif diff --git a/test/tricky_private_member_test.cpp b/test/tricky_private_member_test.cpp deleted file mode 100644 index b113fdf..0000000 --- a/test/tricky_private_member_test.cpp +++ /dev/null @@ -1,71 +0,0 @@ - -// (C) Copyright John Maddock 2015. -// 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 - -struct private_default_construct -{ -private: - private_default_construct(); -public: - private_default_construct(char val) : member(val) {} - char member; -}; - -struct non_copy -{ - non_copy(); -private: - non_copy(const non_copy&); -}; - -struct non_assignable -{ - non_assignable(); -private: - non_assignable& operator=(const non_assignable&); -}; - -struct private_copy -{ - private_copy(); -private: - private_copy(const private_copy&); -}; - -struct private_destruct -{ - private_destruct(); -private: - ~private_destruct(); -}; - - - -TT_TEST_BEGIN(tricky_private_members_test) - -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, false); -#if !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy::value, false); -#endif -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign::value, false); -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, false); -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy::value, false); -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, false); -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_default_constructible::value, false); -BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible::value, false); - - - -TT_TEST_END - - From 9ab3aae3e6c412a177f2da906673ff3ddc517daf Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Tue, 16 Jun 2015 18:42:55 +0100 Subject: [PATCH 45/51] Fix use of is_constructible - to limits to cases where it's really needed. And to not use it when the compiler would choke. --- .../type_traits/has_trivial_constructor.hpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/include/boost/type_traits/has_trivial_constructor.hpp b/include/boost/type_traits/has_trivial_constructor.hpp index 60ac52a..3fca9bf 100644 --- a/include/boost/type_traits/has_trivial_constructor.hpp +++ b/include/boost/type_traits/has_trivial_constructor.hpp @@ -24,17 +24,34 @@ #endif #endif + +#if (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 409)) || defined(BOOST_CLANG) +#include +#define BOOST_TT_TRIVIAL_CONSTRUCT_FIX && is_default_constructible::value +#else +// +// Mot all compilers, particularly older GCC versions can handle the fix above. +#define BOOST_TT_TRIVIAL_CONSTRUCT_FIX +#endif + namespace boost { template struct has_trivial_constructor #ifdef BOOST_HAS_TRIVIAL_CONSTRUCTOR - : public integral_constant ::value || BOOST_HAS_TRIVIAL_CONSTRUCTOR(T)) && is_default_constructible::value)>{}; + : public integral_constant ::value || BOOST_HAS_TRIVIAL_CONSTRUCTOR(T)) BOOST_TT_TRIVIAL_CONSTRUCT_FIX)>{}; #else : public integral_constant ::value>{}; #endif +template <> struct has_trivial_constructor : public boost::false_type{}; +template <> struct has_trivial_constructor : public boost::false_type{}; +template <> struct has_trivial_constructor : public boost::false_type{}; +template <> struct has_trivial_constructor : public boost::false_type{}; + template struct has_trivial_default_constructor : public has_trivial_constructor {}; +#undef BOOST_TT_TRIVIAL_CONSTRUCT_FIX + } // namespace boost #endif // BOOST_TT_HAS_TRIVIAL_CONSTRUCTOR_HPP_INCLUDED From 5a4f30208aec8353507f7f93eafd49124f1c6890 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Tue, 16 Jun 2015 19:11:53 +0100 Subject: [PATCH 46/51] More fixes for older GCC versions: Don't filter through is_constructible/is_assignable etc as older GCC versions can't cope, and don't need these anyway. --- include/boost/type_traits/has_nothrow_assign.hpp | 1 + include/boost/type_traits/has_nothrow_copy.hpp | 1 + include/boost/type_traits/has_trivial_copy.hpp | 12 ++++++++++-- include/boost/type_traits/intrinsics.hpp | 8 ++++++++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/include/boost/type_traits/has_nothrow_assign.hpp b/include/boost/type_traits/has_nothrow_assign.hpp index 9458ef3..6af665f 100644 --- a/include/boost/type_traits/has_nothrow_assign.hpp +++ b/include/boost/type_traits/has_nothrow_assign.hpp @@ -28,6 +28,7 @@ #include #include #include +#include #ifdef BOOST_INTEL #include #endif diff --git a/include/boost/type_traits/has_nothrow_copy.hpp b/include/boost/type_traits/has_nothrow_copy.hpp index 61d52b9..de7499a 100644 --- a/include/boost/type_traits/has_nothrow_copy.hpp +++ b/include/boost/type_traits/has_nothrow_copy.hpp @@ -18,6 +18,7 @@ #include #include #include +#include #ifdef BOOST_INTEL #include #endif diff --git a/include/boost/type_traits/has_trivial_copy.hpp b/include/boost/type_traits/has_trivial_copy.hpp index c717f1d..2a0c5bb 100644 --- a/include/boost/type_traits/has_trivial_copy.hpp +++ b/include/boost/type_traits/has_trivial_copy.hpp @@ -12,14 +12,20 @@ #include #include #include -#include + +#if (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 409)) || defined(BOOST_CLANG) +#include +#define BOOST_TT_TRIVIAL_CONSTRUCT_FIX && is_copy_constructible::value +#else +#define BOOST_TT_TRIVIAL_CONSTRUCT_FIX +#endif namespace boost { template struct has_trivial_copy : public integral_constant::value + BOOST_HAS_TRIVIAL_COPY(T) BOOST_TT_TRIVIAL_CONSTRUCT_FIX #else ::boost::is_pod::value #endif @@ -39,6 +45,8 @@ template <> struct has_trivial_copy : public false_type{}; template struct has_trivial_copy_constructor : public has_trivial_copy{}; +#undef BOOST_TT_TRIVIAL_CONSTRUCT_FIX + } // namespace boost #endif // BOOST_TT_HAS_TRIVIAL_COPY_HPP_INCLUDED diff --git a/include/boost/type_traits/intrinsics.hpp b/include/boost/type_traits/intrinsics.hpp index e72d9ce..313b70d 100644 --- a/include/boost/type_traits/intrinsics.hpp +++ b/include/boost/type_traits/intrinsics.hpp @@ -241,11 +241,19 @@ # define BOOST_IS_EMPTY(T) __is_empty(T) # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) ((__has_trivial_constructor(T) BOOST_INTEL_TT_OPTS) && ! ::boost::is_volatile::value) # define BOOST_HAS_TRIVIAL_COPY(T) ((__has_trivial_copy(T) BOOST_INTEL_TT_OPTS) && !is_reference::value) +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 # define BOOST_HAS_TRIVIAL_ASSIGN(T) ((__has_trivial_assign(T) BOOST_INTEL_TT_OPTS) && ! ::boost::is_volatile::value && ! ::boost::is_const::value && is_assignable::value) # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) BOOST_INTEL_TT_OPTS && is_destructible::value) # define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_constructor(T) && is_default_constructible::value BOOST_INTEL_TT_OPTS) # define BOOST_HAS_NOTHROW_COPY(T) ((__has_nothrow_copy(T) BOOST_INTEL_TT_OPTS) && !is_volatile::value && !is_reference::value && is_copy_constructible::value) # define BOOST_HAS_NOTHROW_ASSIGN(T) ((__has_nothrow_assign(T) BOOST_INTEL_TT_OPTS) && !is_volatile::value && !is_const::value && is_assignable::value) +#else +# define BOOST_HAS_TRIVIAL_ASSIGN(T) ((__has_trivial_assign(T) BOOST_INTEL_TT_OPTS) && ! ::boost::is_volatile::value && ! ::boost::is_const::value) +# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) BOOST_INTEL_TT_OPTS) +# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_constructor(T) BOOST_INTEL_TT_OPTS) +# define BOOST_HAS_NOTHROW_COPY(T) ((__has_nothrow_copy(T) BOOST_INTEL_TT_OPTS) && !is_volatile::value && !is_reference::value && !is_array::value) +# define BOOST_HAS_NOTHROW_ASSIGN(T) ((__has_nothrow_assign(T) BOOST_INTEL_TT_OPTS) && !is_volatile::value && !is_const::value && !is_array::value) +#endif # define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T) # define BOOST_IS_ABSTRACT(T) __is_abstract(T) From 57134385f1934d20d3f13155811ede0648e2cba8 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Tue, 16 Jun 2015 19:23:37 +0100 Subject: [PATCH 47/51] Use old version of is_copy_constructible with older GCC versions. --- include/boost/type_traits/is_copy_constructible.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/type_traits/is_copy_constructible.hpp b/include/boost/type_traits/is_copy_constructible.hpp index 1d950d0..77c4ac5 100644 --- a/include/boost/type_traits/is_copy_constructible.hpp +++ b/include/boost/type_traits/is_copy_constructible.hpp @@ -12,7 +12,7 @@ #include #include -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) && !BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40900) #include From 904a4adf00492d5a0d5dd95bc26180d307e27b99 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Tue, 16 Jun 2015 19:32:27 +0100 Subject: [PATCH 48/51] Fix #include. --- include/boost/type_traits/has_trivial_copy.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/type_traits/has_trivial_copy.hpp b/include/boost/type_traits/has_trivial_copy.hpp index 2a0c5bb..d7e1dee 100644 --- a/include/boost/type_traits/has_trivial_copy.hpp +++ b/include/boost/type_traits/has_trivial_copy.hpp @@ -14,7 +14,7 @@ #include #if (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 409)) || defined(BOOST_CLANG) -#include +#include #define BOOST_TT_TRIVIAL_CONSTRUCT_FIX && is_copy_constructible::value #else #define BOOST_TT_TRIVIAL_CONSTRUCT_FIX From d9255a7958a6cb06f3fde219244dfc0fe05d93e0 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Wed, 17 Jun 2015 18:17:42 +0100 Subject: [PATCH 49/51] Disable fully conforming is_convertible for gcc-4.6.4 as it fails our tests. --- include/boost/type_traits/is_convertible.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/type_traits/is_convertible.hpp b/include/boost/type_traits/is_convertible.hpp index 9854f8b..bc11a59 100644 --- a/include/boost/type_traits/is_convertible.hpp +++ b/include/boost/type_traits/is_convertible.hpp @@ -54,7 +54,7 @@ namespace boost { namespace detail { -#if !defined(BOOST_NO_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +#if !defined(BOOST_NO_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !(defined(BOOST_GCC) && (BOOST_GCC < 40700)) // This is a C++11 conforming version, place this first and use it wherever possible: From dca27f8b3d074fe38e7e8b1ec5034d6d0e4ba80a Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Wed, 17 Jun 2015 19:13:19 +0100 Subject: [PATCH 50/51] Fix Oracle failure - needs to filter result through is_constructible. --- include/boost/type_traits/has_trivial_constructor.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/type_traits/has_trivial_constructor.hpp b/include/boost/type_traits/has_trivial_constructor.hpp index 3fca9bf..06c137d 100644 --- a/include/boost/type_traits/has_trivial_constructor.hpp +++ b/include/boost/type_traits/has_trivial_constructor.hpp @@ -25,7 +25,7 @@ #endif -#if (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 409)) || defined(BOOST_CLANG) +#if (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 409)) || defined(BOOST_CLANG) || (defined(__SUNPRO_CC) && defined(BOOST_HAS_TRIVIAL_CONSTRUCTOR)) #include #define BOOST_TT_TRIVIAL_CONSTRUCT_FIX && is_default_constructible::value #else From d66cb6e9051aebb0fd37a6d84bf24440c08505da Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Wed, 17 Jun 2015 19:29:25 +0100 Subject: [PATCH 51/51] Fix Oracle C++11 failure. --- include/boost/type_traits/has_trivial_copy.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/type_traits/has_trivial_copy.hpp b/include/boost/type_traits/has_trivial_copy.hpp index d7e1dee..ef9c290 100644 --- a/include/boost/type_traits/has_trivial_copy.hpp +++ b/include/boost/type_traits/has_trivial_copy.hpp @@ -13,7 +13,7 @@ #include #include -#if (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 409)) || defined(BOOST_CLANG) +#if (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 409)) || defined(BOOST_CLANG) || (defined(__SUNPRO_CC) && defined(BOOST_HAS_TRIVIAL_COPY)) #include #define BOOST_TT_TRIVIAL_CONSTRUCT_FIX && is_copy_constructible::value #else