From 97cea143b944a9d180acaae41f89ab3671531485 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Wed, 13 Apr 2016 18:36:03 +0100 Subject: [PATCH 1/8] Add and comment cstddef includes whenever std::size_t is used. See https://svn.boost.org/trac/boost/ticket/12124. --- include/boost/type_traits/extent.hpp | 1 + include/boost/type_traits/has_nothrow_assign.hpp | 1 + include/boost/type_traits/has_nothrow_constructor.hpp | 1 + include/boost/type_traits/has_trivial_assign.hpp | 1 + include/boost/type_traits/has_trivial_copy.hpp | 1 + include/boost/type_traits/has_trivial_move_assign.hpp | 1 + include/boost/type_traits/has_trivial_move_constructor.hpp | 1 + include/boost/type_traits/is_abstract.hpp | 1 + include/boost/type_traits/is_array.hpp | 2 +- include/boost/type_traits/is_assignable.hpp | 1 + include/boost/type_traits/is_const.hpp | 3 ++- include/boost/type_traits/is_default_constructible.hpp | 1 + include/boost/type_traits/is_destructible.hpp | 1 + include/boost/type_traits/is_nothrow_move_constructible.hpp | 1 + include/boost/type_traits/is_pod.hpp | 1 + include/boost/type_traits/is_volatile.hpp | 3 ++- include/boost/type_traits/rank.hpp | 1 + include/boost/type_traits/remove_all_extents.hpp | 2 +- include/boost/type_traits/remove_const.hpp | 2 +- include/boost/type_traits/remove_cv.hpp | 2 +- include/boost/type_traits/remove_extent.hpp | 2 +- include/boost/type_traits/remove_volatile.hpp | 2 +- include/boost/type_traits/type_with_alignment.hpp | 2 +- 23 files changed, 25 insertions(+), 9 deletions(-) diff --git a/include/boost/type_traits/extent.hpp b/include/boost/type_traits/extent.hpp index dfb3c54..1242578 100644 --- a/include/boost/type_traits/extent.hpp +++ b/include/boost/type_traits/extent.hpp @@ -10,6 +10,7 @@ #ifndef BOOST_TT_EXTENT_HPP_INCLUDED #define BOOST_TT_EXTENT_HPP_INCLUDED +#include // size_t #include #include diff --git a/include/boost/type_traits/has_nothrow_assign.hpp b/include/boost/type_traits/has_nothrow_assign.hpp index 65fbeef..7517fa8 100644 --- a/include/boost/type_traits/has_nothrow_assign.hpp +++ b/include/boost/type_traits/has_nothrow_assign.hpp @@ -9,6 +9,7 @@ #ifndef BOOST_TT_HAS_NOTHROW_ASSIGN_HPP_INCLUDED #define BOOST_TT_HAS_NOTHROW_ASSIGN_HPP_INCLUDED +#include // size_t #include #include diff --git a/include/boost/type_traits/has_nothrow_constructor.hpp b/include/boost/type_traits/has_nothrow_constructor.hpp index a71d42e..fa47b1d 100644 --- a/include/boost/type_traits/has_nothrow_constructor.hpp +++ b/include/boost/type_traits/has_nothrow_constructor.hpp @@ -9,6 +9,7 @@ #ifndef BOOST_TT_HAS_NOTHROW_CONSTRUCTOR_HPP_INCLUDED #define BOOST_TT_HAS_NOTHROW_CONSTRUCTOR_HPP_INCLUDED +#include // size_t #include #include diff --git a/include/boost/type_traits/has_trivial_assign.hpp b/include/boost/type_traits/has_trivial_assign.hpp index a434dae..15b917e 100644 --- a/include/boost/type_traits/has_trivial_assign.hpp +++ b/include/boost/type_traits/has_trivial_assign.hpp @@ -9,6 +9,7 @@ #ifndef BOOST_TT_HAS_TRIVIAL_ASSIGN_HPP_INCLUDED #define BOOST_TT_HAS_TRIVIAL_ASSIGN_HPP_INCLUDED +#include // size_t #include #include #include diff --git a/include/boost/type_traits/has_trivial_copy.hpp b/include/boost/type_traits/has_trivial_copy.hpp index 9d3265d..fd6ad2d 100644 --- a/include/boost/type_traits/has_trivial_copy.hpp +++ b/include/boost/type_traits/has_trivial_copy.hpp @@ -9,6 +9,7 @@ #ifndef BOOST_TT_HAS_TRIVIAL_COPY_HPP_INCLUDED #define BOOST_TT_HAS_TRIVIAL_COPY_HPP_INCLUDED +#include // size_t #include #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 f7bb198..6d954ab 100644 --- a/include/boost/type_traits/has_trivial_move_assign.hpp +++ b/include/boost/type_traits/has_trivial_move_assign.hpp @@ -11,6 +11,7 @@ #ifndef BOOST_TT_HAS_TRIVIAL_MOVE_ASSIGN_HPP_INCLUDED #define BOOST_TT_HAS_TRIVIAL_MOVE_ASSIGN_HPP_INCLUDED +#include // size_t #include #include diff --git a/include/boost/type_traits/has_trivial_move_constructor.hpp b/include/boost/type_traits/has_trivial_move_constructor.hpp index 9e601f3..5784f4b 100644 --- a/include/boost/type_traits/has_trivial_move_constructor.hpp +++ b/include/boost/type_traits/has_trivial_move_constructor.hpp @@ -11,6 +11,7 @@ #ifndef BOOST_TT_HAS_TRIVIAL_MOVE_CONSTRUCTOR_HPP_INCLUDED #define BOOST_TT_HAS_TRIVIAL_MOVE_CONSTRUCTOR_HPP_INCLUDED +#include // size_t #include #include diff --git a/include/boost/type_traits/is_abstract.hpp b/include/boost/type_traits/is_abstract.hpp index 7715c5c..781d94a 100644 --- a/include/boost/type_traits/is_abstract.hpp +++ b/include/boost/type_traits/is_abstract.hpp @@ -48,6 +48,7 @@ // to degrade gracefully, rather than trash the compiler (John Maddock). // +#include // size_t #include #include #ifndef BOOST_IS_ABSTRACT diff --git a/include/boost/type_traits/is_array.hpp b/include/boost/type_traits/is_array.hpp index 497dc49..53e1613 100644 --- a/include/boost/type_traits/is_array.hpp +++ b/include/boost/type_traits/is_array.hpp @@ -15,7 +15,7 @@ #define BOOST_TT_IS_ARRAY_HPP_INCLUDED #include -#include +#include // size_t namespace boost { diff --git a/include/boost/type_traits/is_assignable.hpp b/include/boost/type_traits/is_assignable.hpp index 9cf681d..49d1716 100644 --- a/include/boost/type_traits/is_assignable.hpp +++ b/include/boost/type_traits/is_assignable.hpp @@ -9,6 +9,7 @@ #ifndef BOOST_TT_IS_ASSIGNABLE_HPP_INCLUDED #define BOOST_TT_IS_ASSIGNABLE_HPP_INCLUDED +#include // size_t #include #include diff --git a/include/boost/type_traits/is_const.hpp b/include/boost/type_traits/is_const.hpp index d9dd2aa..e0ed88a 100644 --- a/include/boost/type_traits/is_const.hpp +++ b/include/boost/type_traits/is_const.hpp @@ -21,6 +21,7 @@ #ifndef BOOST_TT_IS_CONST_HPP_INCLUDED #define BOOST_TT_IS_CONST_HPP_INCLUDED +#include // size_t #include namespace boost { @@ -35,7 +36,7 @@ namespace boost { template struct is_const : public false_type {}; template struct is_const : public true_type{}; - template struct is_const : public true_type{}; + template struct is_const : public true_type{}; template struct is_const : public true_type{}; #endif diff --git a/include/boost/type_traits/is_default_constructible.hpp b/include/boost/type_traits/is_default_constructible.hpp index 0b7d960..fa5d76a 100644 --- a/include/boost/type_traits/is_default_constructible.hpp +++ b/include/boost/type_traits/is_default_constructible.hpp @@ -9,6 +9,7 @@ #ifndef BOOST_TT_IS_DEFAULT_CONSTRUCTIBLE_HPP_INCLUDED #define BOOST_TT_IS_DEFAULT_CONSTRUCTIBLE_HPP_INCLUDED +#include // size_t #include #include diff --git a/include/boost/type_traits/is_destructible.hpp b/include/boost/type_traits/is_destructible.hpp index 9f1e5d9..742d990 100644 --- a/include/boost/type_traits/is_destructible.hpp +++ b/include/boost/type_traits/is_destructible.hpp @@ -9,6 +9,7 @@ #ifndef BOOST_TT_IS_DESTRUCTIBLE_HPP_INCLUDED #define BOOST_TT_IS_DESTRUCTIBLE_HPP_INCLUDED +#include // size_t #include #include diff --git a/include/boost/type_traits/is_nothrow_move_constructible.hpp b/include/boost/type_traits/is_nothrow_move_constructible.hpp index 4c8f734..0d5d57a 100644 --- a/include/boost/type_traits/is_nothrow_move_constructible.hpp +++ b/include/boost/type_traits/is_nothrow_move_constructible.hpp @@ -11,6 +11,7 @@ #ifndef BOOST_TT_IS_NOTHROW_MOVE_CONSTRUCTIBLE_HPP_INCLUDED #define BOOST_TT_IS_NOTHROW_MOVE_CONSTRUCTIBLE_HPP_INCLUDED +#include // size_t #include #include #include diff --git a/include/boost/type_traits/is_pod.hpp b/include/boost/type_traits/is_pod.hpp index 9204c93..9bd1962 100644 --- a/include/boost/type_traits/is_pod.hpp +++ b/include/boost/type_traits/is_pod.hpp @@ -9,6 +9,7 @@ #ifndef BOOST_TT_IS_POD_HPP_INCLUDED #define BOOST_TT_IS_POD_HPP_INCLUDED +#include // size_t #include #include #include diff --git a/include/boost/type_traits/is_volatile.hpp b/include/boost/type_traits/is_volatile.hpp index cefe987..5b8e716 100644 --- a/include/boost/type_traits/is_volatile.hpp +++ b/include/boost/type_traits/is_volatile.hpp @@ -21,6 +21,7 @@ #ifndef BOOST_TT_IS_VOLATILE_HPP_INCLUDED #define BOOST_TT_IS_VOLATILE_HPP_INCLUDED +#include // size_t #include namespace boost { @@ -35,7 +36,7 @@ namespace boost { template struct is_volatile : public false_type {}; template struct is_volatile : public true_type{}; - template struct is_volatile : public true_type{}; + template struct is_volatile : public true_type{}; template struct is_volatile : public true_type{}; #endif diff --git a/include/boost/type_traits/rank.hpp b/include/boost/type_traits/rank.hpp index 3dfc693..1f820f1 100644 --- a/include/boost/type_traits/rank.hpp +++ b/include/boost/type_traits/rank.hpp @@ -10,6 +10,7 @@ #ifndef BOOST_TT_RANK_HPP_INCLUDED #define BOOST_TT_RANK_HPP_INCLUDED +#include // size_t #include namespace boost { diff --git a/include/boost/type_traits/remove_all_extents.hpp b/include/boost/type_traits/remove_all_extents.hpp index 3ccdc98..90c90d3 100644 --- a/include/boost/type_traits/remove_all_extents.hpp +++ b/include/boost/type_traits/remove_all_extents.hpp @@ -10,7 +10,7 @@ #define BOOST_TT_REMOVE_ALL_EXTENTS_HPP_INCLUDED #include -#include +#include // size_t #include namespace boost { diff --git a/include/boost/type_traits/remove_const.hpp b/include/boost/type_traits/remove_const.hpp index b47f851..e238962 100644 --- a/include/boost/type_traits/remove_const.hpp +++ b/include/boost/type_traits/remove_const.hpp @@ -12,7 +12,7 @@ #define BOOST_TT_REMOVE_CONST_HPP_INCLUDED #include -#include +#include // size_t #include namespace boost { diff --git a/include/boost/type_traits/remove_cv.hpp b/include/boost/type_traits/remove_cv.hpp index b50607f..08393cf 100644 --- a/include/boost/type_traits/remove_cv.hpp +++ b/include/boost/type_traits/remove_cv.hpp @@ -13,7 +13,7 @@ #include #include -#include +#include // size_t namespace boost { diff --git a/include/boost/type_traits/remove_extent.hpp b/include/boost/type_traits/remove_extent.hpp index 0b50a07..b6528e5 100644 --- a/include/boost/type_traits/remove_extent.hpp +++ b/include/boost/type_traits/remove_extent.hpp @@ -11,7 +11,7 @@ #include #include -#include +#include // size_t namespace boost { diff --git a/include/boost/type_traits/remove_volatile.hpp b/include/boost/type_traits/remove_volatile.hpp index 475e39d..f5870f3 100644 --- a/include/boost/type_traits/remove_volatile.hpp +++ b/include/boost/type_traits/remove_volatile.hpp @@ -13,7 +13,7 @@ #include #include -#include +#include // size_t namespace boost { diff --git a/include/boost/type_traits/type_with_alignment.hpp b/include/boost/type_traits/type_with_alignment.hpp index ffa054a..ddf1d98 100644 --- a/include/boost/type_traits/type_with_alignment.hpp +++ b/include/boost/type_traits/type_with_alignment.hpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include // size_t #include #ifdef BOOST_MSVC From 4243962e406ce649b908814a9fd7cb17fba10ecb Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sun, 8 May 2016 18:12:57 +0100 Subject: [PATCH 2/8] Conditionally stop using outdated msvc workarounds. --- include/boost/type_traits/has_nothrow_destructor.hpp | 2 +- include/boost/type_traits/remove_pointer.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/type_traits/has_nothrow_destructor.hpp b/include/boost/type_traits/has_nothrow_destructor.hpp index 273eb9f..ba70e89 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) && !defined(__SUNPRO_CC) && !defined(BOOST_MSVC) +#if !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(__SUNPRO_CC) && !(defined(BOOST_MSVC) && (_MSC_FULL_VER < 190023506)) #include #include diff --git a/include/boost/type_traits/remove_pointer.hpp b/include/boost/type_traits/remove_pointer.hpp index fb79e59..9216652 100644 --- a/include/boost/type_traits/remove_pointer.hpp +++ b/include/boost/type_traits/remove_pointer.hpp @@ -18,7 +18,7 @@ namespace boost { -#ifdef BOOST_MSVC +#if BOOST_WORKAROUND(BOOST_MSVC, < 1900) namespace detail{ From 5f82b5ac5039031ad6bf6a2a592bd0c8caf18630 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sun, 8 May 2016 18:13:26 +0100 Subject: [PATCH 3/8] Suppress msvc-14 warning. --- include/boost/type_traits/is_virtual_base_of.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/type_traits/is_virtual_base_of.hpp b/include/boost/type_traits/is_virtual_base_of.hpp index f005256..84cb355 100644 --- a/include/boost/type_traits/is_virtual_base_of.hpp +++ b/include/boost/type_traits/is_virtual_base_of.hpp @@ -17,7 +17,7 @@ namespace detail { #ifdef BOOST_MSVC #pragma warning( push ) -#pragma warning( disable : 4584 4250) +#pragma warning( disable : 4584 4250 4594) #elif defined(__GNUC__) && (__GNUC__ >= 4) #pragma GCC system_header #endif From 4fffc7637da8479e3f94674ef1dd0fc996a7d027 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Fri, 7 Oct 2016 23:07:37 -0500 Subject: [PATCH 4/8] Add, and update, documentation build targets. --- doc/Jamfile.v2 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index 0a8f553..7b2503c 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -69,4 +69,8 @@ boostbook standalone install pdfinstall : standalone/pdf : PDF . type_traits.pdf ; explicit pdfinstall ; - +############################################################################### +alias boostdoc ; +explicit boostdoc ; +alias boostrelease : standalone ; +explicit boostrelease ; From c3b38bc3dd0b8720a1bebd81132b0329e98c1429 Mon Sep 17 00:00:00 2001 From: zerotypos-found Date: Tue, 29 Nov 2016 12:05:30 +0900 Subject: [PATCH 5/8] [inspection report] remove tabs and non-ASCII chars, add newline at EOF, fix copyright --- .../type_traits/detail/common_arithmetic_type.hpp | 6 +++--- include/boost/type_traits/is_rvalue_reference.hpp | 2 +- test/common_type_2_test.cpp | 10 +++++----- test/common_type_test.cpp | 10 +++++----- test/is_convertible_test.cpp | 4 ++-- test/mpl_interop_test1.cpp | 2 +- test/mpl_interop_test2.cpp | 2 +- test/mpl_interop_test3.cpp | 2 +- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/include/boost/type_traits/detail/common_arithmetic_type.hpp b/include/boost/type_traits/detail/common_arithmetic_type.hpp index 8c09158..a7aff03 100644 --- a/include/boost/type_traits/detail/common_arithmetic_type.hpp +++ b/include/boost/type_traits/detail/common_arithmetic_type.hpp @@ -46,7 +46,7 @@ template<> struct arithmetic_type<3> #endif // There are five standard signed integer types: -// “signed char”, “short int”, “int”, “long int”, and “long long int”. +// "signed char", "short int", "int", "long int", and "long long int". template<> struct arithmetic_type<4> { @@ -79,8 +79,8 @@ template<> struct arithmetic_type<8> }; // For each of the standard signed integer types, there exists a corresponding -// (but different) standard unsigned integer type: “unsigned char”, “unsigned short int”, -// “unsigned int”, “unsigned long int”, and “unsigned long long int” +// (but different) standard unsigned integer type: "unsigned char", "unsigned short int", +// "unsigned int", "unsigned long int", and "unsigned long long int" template<> struct arithmetic_type<9> { diff --git a/include/boost/type_traits/is_rvalue_reference.hpp b/include/boost/type_traits/is_rvalue_reference.hpp index 50e88ed..a48edb5 100644 --- a/include/boost/type_traits/is_rvalue_reference.hpp +++ b/include/boost/type_traits/is_rvalue_reference.hpp @@ -1,5 +1,5 @@ -// (C) John Maddock 2010. +// (C) Copyright John Maddock 2010. // 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). diff --git a/test/common_type_2_test.cpp b/test/common_type_2_test.cpp index 8a4e746..114b4c2 100644 --- a/test/common_type_2_test.cpp +++ b/test/common_type_2_test.cpp @@ -90,18 +90,18 @@ TT_TEST_BEGIN(common_type) #ifndef __SUNPRO_CC assignation_2(); typedef tt::common_type::type T1; - BOOST_CHECK_TYPE(T1, C1C2); + BOOST_CHECK_TYPE(T1, C1C2); typedef tt::common_type::type T2; - BOOST_CHECK_TYPE(T2, C2*); + BOOST_CHECK_TYPE(T2, C2*); typedef tt::common_type::type T3; - BOOST_CHECK_TYPE(T3, int const*); + BOOST_CHECK_TYPE(T3, int const*); #if defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_COMMON_TYPE_DONT_USE_TYPEOF) // fails if BOOST_COMMON_TYPE_DONT_USE_TYPEOF: typedef tt::common_type::type T4; - BOOST_CHECK_TYPE(T4, int const volatile*); + BOOST_CHECK_TYPE(T4, int const volatile*); #endif typedef tt::common_type::type T5; - BOOST_CHECK_TYPE(T5, int volatile*); + BOOST_CHECK_TYPE(T5, int volatile*); assignation_2(); assignation_2(); diff --git a/test/common_type_test.cpp b/test/common_type_test.cpp index 047b65f..3695a46 100644 --- a/test/common_type_test.cpp +++ b/test/common_type_test.cpp @@ -87,18 +87,18 @@ TT_TEST_BEGIN(common_type) { assignation_2(); typedef tt::common_type::type T1; - BOOST_CHECK_TYPE(T1, C1C2); + BOOST_CHECK_TYPE(T1, C1C2); typedef tt::common_type::type T2; - BOOST_CHECK_TYPE(T2, C2*); + BOOST_CHECK_TYPE(T2, C2*); typedef tt::common_type::type T3; - BOOST_CHECK_TYPE(T3, int const*); + BOOST_CHECK_TYPE(T3, int const*); #if defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_COMMON_TYPE_DONT_USE_TYPEOF) // fails if BOOST_COMMON_TYPE_DONT_USE_TYPEOF: typedef tt::common_type::type T4; - BOOST_CHECK_TYPE(T4, int const volatile*); + BOOST_CHECK_TYPE(T4, int const volatile*); #endif typedef tt::common_type::type T5; - BOOST_CHECK_TYPE(T5, int volatile*); + BOOST_CHECK_TYPE(T5, int volatile*); assignation_2(); assignation_2(); diff --git a/test/is_convertible_test.cpp b/test/is_convertible_test.cpp index 40764c0..22b3201 100644 --- a/test/is_convertible_test.cpp +++ b/test/is_convertible_test.cpp @@ -29,8 +29,8 @@ struct derived2 : public middle2 { }; template struct test_bug_4530 { - template - test_bug_4530(A&&, typename boost::enable_if< ::tt::is_convertible >::type* =0); + template + test_bug_4530(A&&, typename boost::enable_if< ::tt::is_convertible >::type* =0); }; struct A4530 diff --git a/test/mpl_interop_test1.cpp b/test/mpl_interop_test1.cpp index 214c951..3b90418 100644 --- a/test/mpl_interop_test1.cpp +++ b/test/mpl_interop_test1.cpp @@ -27,4 +27,4 @@ int dispatch_test() int main() { return (dispatch_test() == 1) && (dispatch_test() == 0) ? 0 : 1; -} \ No newline at end of file +} diff --git a/test/mpl_interop_test2.cpp b/test/mpl_interop_test2.cpp index 4624e0b..85805c8 100644 --- a/test/mpl_interop_test2.cpp +++ b/test/mpl_interop_test2.cpp @@ -22,4 +22,4 @@ if_test::type t2 = 0; int main() { return (int)(t1 + t2); -} \ No newline at end of file +} diff --git a/test/mpl_interop_test3.cpp b/test/mpl_interop_test3.cpp index 0a4c8ac..e89d50e 100644 --- a/test/mpl_interop_test3.cpp +++ b/test/mpl_interop_test3.cpp @@ -27,4 +27,4 @@ int main() lambda_test::type i = 0; return i; -} \ No newline at end of file +} From d24f722c5aa2d4a48f9edb6800d4e29add735b47 Mon Sep 17 00:00:00 2001 From: Glen Fernandes Date: Mon, 30 Jan 2017 08:47:47 -0500 Subject: [PATCH 6/8] Add make_void and void_t traits --- doc/make_void.qbk | 47 +++++++++++++++++++++++++ doc/type_traits.qbk | 2 ++ include/boost/type_traits.hpp | 1 + include/boost/type_traits/make_void.hpp | 41 +++++++++++++++++++++ test/make_void_test.cpp | 34 ++++++++++++++++++ 5 files changed, 125 insertions(+) create mode 100644 doc/make_void.qbk create mode 100644 include/boost/type_traits/make_void.hpp create mode 100644 test/make_void_test.cpp diff --git a/doc/make_void.qbk b/doc/make_void.qbk new file mode 100644 index 0000000..eb103fb --- /dev/null +++ b/doc/make_void.qbk @@ -0,0 +1,47 @@ +[/ +Copyright 2017 Glen Joseph Fernandes + + +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:make_void make_void] + + template + struct make_void + { + typedef void type; + }; + + template + using void_t = typename make_void::type; + +__type The type `void` for all `T`. + +__header ` #include ` or ` #include ` + +[table Examples + +[[Expression] [Result Type]] + +[[`make_void::type`][`void`]] + +[[`make_void::type`] [`void`]] + +[[`make_void::type`] [`void`]] + +[[`make_void::type`] [`void`]] + +[[`make_void::type`] [`void`]] + +[[`make_void<>::type`] [`void`]] + +[[`make_void::type`] [`void`]] + +] + +[all_compilers] + +[endsect] diff --git a/doc/type_traits.qbk b/doc/type_traits.qbk index 8a914a4..dd9bfc6 100644 --- a/doc/type_traits.qbk +++ b/doc/type_traits.qbk @@ -134,6 +134,7 @@ [def __make_signed [link boost_typetraits.reference.make_signed make_signed]] [def __make_unsigned [link boost_typetraits.reference.make_unsigned make_unsigned]] +[def __make_void [link boost_typetraits.reference.make_void make_void]] [def __decay [link boost_typetraits.reference.decay decay]] [def __is_complex [link boost_typetraits.reference.is_complex is_complex]] @@ -316,6 +317,7 @@ See __has_trivial_constructor. [include make_signed.qbk] [include make_unsigned.qbk] +[include make_void.qbk] [include promote.qbk] [include rank.qbk] diff --git a/include/boost/type_traits.hpp b/include/boost/type_traits.hpp index 7d651ce..93a992d 100644 --- a/include/boost/type_traits.hpp +++ b/include/boost/type_traits.hpp @@ -130,6 +130,7 @@ #include #include #include +#include #include #include #include diff --git a/include/boost/type_traits/make_void.hpp b/include/boost/type_traits/make_void.hpp new file mode 100644 index 0000000..6ee34dd --- /dev/null +++ b/include/boost/type_traits/make_void.hpp @@ -0,0 +1,41 @@ +/* +Copyright 2017 Glen Joseph Fernandes + + +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) +*/ + +#ifndef BOOST_TT_MAKE_VOID_HPP_INCLUDED +#define BOOST_TT_MAKE_VOID_HPP_INCLUDED + +#include + +namespace boost { + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +template +struct make_void { + typedef void type; +}; + +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) +template +using void_t = typename make_void::type; +#endif +#else +template +struct make_void { + typedef void type; +}; + +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) +template +using void_t = typename make_void::type; +#endif +#endif + +} /* boost */ + +#endif diff --git a/test/make_void_test.cpp b/test/make_void_test.cpp new file mode 100644 index 0000000..028b132 --- /dev/null +++ b/test/make_void_test.cpp @@ -0,0 +1,34 @@ +/* +Copyright 2017 Glen Joseph Fernandes + + +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) +*/ + +#include "test.hpp" +#include "check_type.hpp" + +#ifdef TEST_STD +#include +#else +#include +#endif + +TT_TEST_BEGIN(make_void) + +BOOST_CHECK_TYPE(::tt::make_void::type, void); +BOOST_CHECK_TYPE(::tt::make_void::type, void); +BOOST_CHECK_TYPE(::tt::make_void::type, void); +BOOST_CHECK_TYPE(::tt::make_void::type, void); +BOOST_CHECK_TYPE(::tt::make_void::type, void); +BOOST_CHECK_TYPE(::tt::make_void::type, void); +BOOST_CHECK_TYPE(::tt::make_void::type, void); + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +BOOST_CHECK_TYPE(::tt::make_void<>::type, void); +BOOST_CHECK_TYPE3(::tt::make_void::type, void); +#endif + +TT_TEST_END From 7b29d67a3e1eb759bef7a303ed7750c463245877 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Tue, 7 Feb 2017 18:49:33 +0000 Subject: [PATCH 7/8] Small improvements to make_void: * When there are no variadic templates, supports up to 5 parameters. * Tests added for void_t. * Documentation added on compiler support. --- doc/html/boost_typetraits/reference.html | 1 + .../boost_typetraits/reference/make_unsigned.html | 6 +++--- doc/html/boost_typetraits/reference/promote.html | 8 ++++---- .../reference/remove_all_extents.html | 2 +- .../boost_typetraits/reference/remove_const.html | 2 +- doc/html/boost_typetraits/reference/remove_cv.html | 2 +- .../boost_typetraits/reference/remove_extent.html | 2 +- .../boost_typetraits/reference/remove_pointer.html | 2 +- .../reference/remove_reference.html | 2 +- .../boost_typetraits/reference/remove_volatile.html | 2 +- .../boost_typetraits/reference/type_identity.html | 2 +- doc/html/index.html | 1 + doc/html/index/s11.html | 3 ++- doc/html/index/s12.html | 2 +- doc/html/index/s13.html | 2 +- doc/html/index/s14.html | 3 ++- doc/make_void.qbk | 3 ++- include/boost/type_traits/make_void.hpp | 7 +++++-- test/make_void_test.cpp | 13 ++++++++++++- 19 files changed, 42 insertions(+), 23 deletions(-) diff --git a/doc/html/boost_typetraits/reference.html b/doc/html/boost_typetraits/reference.html index f1cfab2..b463bc6 100644 --- a/doc/html/boost_typetraits/reference.html +++ b/doc/html/boost_typetraits/reference.html @@ -145,6 +145,7 @@
is_volatile
make_signed
make_unsigned
+
make_void
promote
rank
remove_all_extents
diff --git a/doc/html/boost_typetraits/reference/make_unsigned.html b/doc/html/boost_typetraits/reference/make_unsigned.html index 914cacf..740206e 100644 --- a/doc/html/boost_typetraits/reference/make_unsigned.html +++ b/doc/html/boost_typetraits/reference/make_unsigned.html @@ -7,7 +7,7 @@ - + @@ -20,7 +20,7 @@

-PrevUpHomeNext +PrevUpHomeNext

@@ -160,7 +160,7 @@
-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_typetraits/reference/promote.html b/doc/html/boost_typetraits/reference/promote.html index 69a600b..c1bd9df 100644 --- a/doc/html/boost_typetraits/reference/promote.html +++ b/doc/html/boost_typetraits/reference/promote.html @@ -6,7 +6,7 @@ - + @@ -20,7 +20,7 @@
-PrevUpHomeNext +PrevUpHomeNext

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

-

Table 1.25. Examples

+

Table 1.26. Examples

@@ -129,7 +129,7 @@

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_typetraits/reference/remove_all_extents.html b/doc/html/boost_typetraits/reference/remove_all_extents.html index 3b844e9..a1e4beb 100644 --- a/doc/html/boost_typetraits/reference/remove_all_extents.html +++ b/doc/html/boost_typetraits/reference/remove_all_extents.html @@ -50,7 +50,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.26. Examples

+

Table 1.27. Examples

diff --git a/doc/html/boost_typetraits/reference/remove_const.html b/doc/html/boost_typetraits/reference/remove_const.html index 77753f1..ed4e887 100644 --- a/doc/html/boost_typetraits/reference/remove_const.html +++ b/doc/html/boost_typetraits/reference/remove_const.html @@ -49,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_cv.html b/doc/html/boost_typetraits/reference/remove_cv.html index 91ac299..bbb0956 100644 --- a/doc/html/boost_typetraits/reference/remove_cv.html +++ b/doc/html/boost_typetraits/reference/remove_cv.html @@ -49,7 +49,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.28. Examples

+

Table 1.29. Examples

diff --git a/doc/html/boost_typetraits/reference/remove_extent.html b/doc/html/boost_typetraits/reference/remove_extent.html index 05ffeff..9a570c4 100644 --- a/doc/html/boost_typetraits/reference/remove_extent.html +++ b/doc/html/boost_typetraits/reference/remove_extent.html @@ -50,7 +50,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.29. Examples

+

Table 1.30. Examples

diff --git a/doc/html/boost_typetraits/reference/remove_pointer.html b/doc/html/boost_typetraits/reference/remove_pointer.html index bf2d59f..d94817f 100644 --- a/doc/html/boost_typetraits/reference/remove_pointer.html +++ b/doc/html/boost_typetraits/reference/remove_pointer.html @@ -51,7 +51,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.30. Examples

+

Table 1.31. Examples

diff --git a/doc/html/boost_typetraits/reference/remove_reference.html b/doc/html/boost_typetraits/reference/remove_reference.html index 37caa50..439559b 100644 --- a/doc/html/boost_typetraits/reference/remove_reference.html +++ b/doc/html/boost_typetraits/reference/remove_reference.html @@ -49,7 +49,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.31. Examples

+

Table 1.32. Examples

diff --git a/doc/html/boost_typetraits/reference/remove_volatile.html b/doc/html/boost_typetraits/reference/remove_volatile.html index 155fb13..f9eeba6 100644 --- a/doc/html/boost_typetraits/reference/remove_volatile.html +++ b/doc/html/boost_typetraits/reference/remove_volatile.html @@ -49,7 +49,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.32. Examples

+

Table 1.33. Examples

diff --git a/doc/html/boost_typetraits/reference/type_identity.html b/doc/html/boost_typetraits/reference/type_identity.html index d22ea1d..f8de9b0 100644 --- a/doc/html/boost_typetraits/reference/type_identity.html +++ b/doc/html/boost_typetraits/reference/type_identity.html @@ -38,7 +38,7 @@ or #include <boost/type_traits.hpp>

-

Table 1.33. Examples

+

Table 1.34. Examples

diff --git a/doc/html/index.html b/doc/html/index.html index e4aedc8..9e05e5d 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -201,6 +201,7 @@
is_volatile
make_signed
make_unsigned
+
make_void
promote
rank
remove_all_extents
diff --git a/doc/html/index/s11.html b/doc/html/index/s11.html index 21f2f0c..d064ef4 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

@@ -292,6 +292,7 @@
N diff --git a/doc/html/index/s12.html b/doc/html/index/s12.html index 11c8909..80cb632 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 b68627b..140f57b 100644 --- a/doc/html/index/s13.html +++ b/doc/html/index/s13.html @@ -24,7 +24,7 @@

-Macro Index

+Macro Index

B

diff --git a/doc/html/index/s14.html b/doc/html/index/s14.html index a0aa114..767f4ba 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

@@ -839,6 +839,7 @@
  • make_signed

  • make_unsigned

  • +
  • make_void

  • N diff --git a/doc/make_void.qbk b/doc/make_void.qbk index eb103fb..3ae0e3d 100644 --- a/doc/make_void.qbk +++ b/doc/make_void.qbk @@ -42,6 +42,7 @@ __header ` #include ` or ` #include using void_t = typename make_void::type; #endif -#else -template + +#else // BOOST_NO_CXX11_VARIADIC_TEMPLATES + +template struct make_void { typedef void type; }; @@ -34,6 +36,7 @@ struct make_void { template using void_t = typename make_void::type; #endif + #endif } /* boost */ diff --git a/test/make_void_test.cpp b/test/make_void_test.cpp index 028b132..986cdc4 100644 --- a/test/make_void_test.cpp +++ b/test/make_void_test.cpp @@ -26,9 +26,20 @@ BOOST_CHECK_TYPE(::tt::make_void::type, void); BOOST_CHECK_TYPE(::tt::make_void::type, void); BOOST_CHECK_TYPE(::tt::make_void::type, void); -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) BOOST_CHECK_TYPE(::tt::make_void<>::type, void); BOOST_CHECK_TYPE3(::tt::make_void::type, void); + +#ifndef BOOST_NO_CXX11_TEMPLATE_ALIASES +BOOST_CHECK_TYPE(::tt::void_t, void); +BOOST_CHECK_TYPE(::tt::void_t, void); +BOOST_CHECK_TYPE(::tt::void_t, void); +BOOST_CHECK_TYPE(::tt::void_t, void); +BOOST_CHECK_TYPE(::tt::void_t, void); +BOOST_CHECK_TYPE(::tt::void_t, void); +BOOST_CHECK_TYPE(::tt::void_t, void); + +BOOST_CHECK_TYPE(::tt::void_t<>, void); +BOOST_CHECK_TYPE3(::tt::void_t, void); #endif TT_TEST_END From fe7317d1ba5dfcaeb8e27673c253095413f24eb0 Mon Sep 17 00:00:00 2001 From: Glen Fernandes Date: Tue, 7 Feb 2017 18:04:31 -0500 Subject: [PATCH 8/8] Add multiple type support to pre-C++11 void_t alias --- include/boost/type_traits/make_void.hpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/include/boost/type_traits/make_void.hpp b/include/boost/type_traits/make_void.hpp index 74abc80..f48823b 100644 --- a/include/boost/type_traits/make_void.hpp +++ b/include/boost/type_traits/make_void.hpp @@ -25,16 +25,24 @@ template using void_t = typename make_void::type; #endif -#else // BOOST_NO_CXX11_VARIADIC_TEMPLATES +#else /* BOOST_NO_CXX11_VARIADIC_TEMPLATES */ -template +template struct make_void { typedef void type; }; #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) -template -using void_t = typename make_void::type; +template +using void_t = typename make_void::type; #endif #endif