[Patch] [add changelog] reduce template instantiation depth in <variant>
Barrett Adair
barrettellisadair@gmail.com
Sat Nov 12 09:04:00 GMT 2016
>Currently, std::variant exceeds the default ftemplate-depth parameter when instantiated with 297 types. This small patch increases this ceiling to 446 types (from the bottom of the template stack).
Sorry, first patch - I just read the guidelines. I changed the format
and added a changelog entry. I hope I did it correctly this time.
Thanks,
Barrett
-------------- next part --------------
Index: libstdc++-v3/ChangeLog
===================================================================
--- libstdc++-v3/ChangeLog (revision 242328)
+++ libstdc++-v3/ChangeLog (working copy)
@@ -1,3 +1,7 @@
+2016-11-12 Barrett Adair <barrettellisadair@gmail.com>
+
+ * include/std/variant (variant): Replace __and_ usage with fold expressions.
+
2016-11-10 François Dumont <fdumont@gcc.gnu.org>
* src/c++11/debug.cc (format_word): Delete.
Index: libstdc++-v3/include/std/variant
===================================================================
--- libstdc++-v3/include/std/variant (revision 242328)
+++ libstdc++-v3/include/std/variant (working copy)
@@ -353,7 +353,7 @@
struct _Variant_base :
_Variant_storage<_Types...>,
_Dtor_mixin<_Variant_base<_Types...>,
- __and_<std::is_trivially_destructible<_Types>...>::value>
+ (std::is_trivially_destructible<_Types>::value &&...)>
{
using _Storage = _Variant_storage<_Types...>;
@@ -376,7 +376,7 @@
}
_Variant_base(_Variant_base&& __rhs)
- noexcept(__and_<is_nothrow_move_constructible<_Types>...>::value)
+ noexcept((is_nothrow_move_constructible<_Types>::value && ...))
: _Storage(), _M_index(__rhs._M_index)
{
if (__rhs._M_valid())
@@ -467,8 +467,8 @@
_Variant_base&
operator=(_Variant_base&& __rhs)
- noexcept(__and_<is_nothrow_move_constructible<_Types>...,
- is_nothrow_move_assignable<_Types>...>::value)
+ noexcept((is_nothrow_move_constructible<_Types>::value && ...)
+ && (is_nothrow_move_assignable<_Types>::value && ...))
{
if (_M_index == __rhs._M_index)
{
@@ -959,13 +959,13 @@
is_default_constructible_v<
variant_alternative_t<0, variant<_Types...>>>, variant<_Types...>>,
private _Enable_copy_move<
- __and_<is_copy_constructible<_Types>...>::value,
- __and_<is_copy_constructible<_Types>...,
- is_move_constructible<_Types>...,
- is_copy_assignable<_Types>...>::value,
- __and_<is_move_constructible<_Types>...>::value,
- __and_<is_move_constructible<_Types>...,
- is_move_assignable<_Types>...>::value,
+ (is_copy_constructible_v<_Types> && ...),
+ (is_copy_constructible_v<_Types> && ...)
+ && (is_move_constructible_v<_Types> && ...)
+ && (is_copy_assignable_v<_Types> && ...),
+ (is_move_constructible_v<_Types> && ...),
+ (is_move_constructible_v<_Types> && ...)
+ && (is_move_assignable_v<_Types> && ...),
variant<_Types...>>
{
private:
@@ -1008,8 +1008,7 @@
noexcept(is_nothrow_default_constructible_v<__to_type<0>>) = default;
variant(const variant&) = default;
variant(variant&&)
- noexcept(__and_<
- is_nothrow_move_constructible<_Types>...>::value) = default;
+ noexcept((is_nothrow_move_constructible<_Types>::value &&...)) = default;
template<typename _Tp,
typename = enable_if_t<__exactly_once<__accepted_type<_Tp&&>>
@@ -1067,9 +1066,9 @@
{ }
template<typename _Alloc,
- typename = enable_if_t<__and_<__is_uses_allocator_constructible<
+ typename = enable_if_t<(__is_uses_allocator_constructible<
_Types, _Alloc,
- add_lvalue_reference_t<add_const_t<_Types>>>...>::value>>
+ add_lvalue_reference_t<add_const_t<_Types>>>::value && ...)>>
variant(allocator_arg_t, const _Alloc& __a, const variant& __rhs)
: _Base(__a, __rhs),
_Default_ctor_enabler(_Enable_default_constructor_tag{})
@@ -1076,9 +1075,9 @@
{ }
template<typename _Alloc,
- typename = enable_if_t<__and_<
+ typename = enable_if_t<(
__is_uses_allocator_constructible<
- _Types, _Alloc, add_rvalue_reference_t<_Types>>...>::value>>
+ _Types, _Alloc, add_rvalue_reference_t<_Types>>::value && ...)>>
variant(allocator_arg_t, const _Alloc& __a, variant&& __rhs)
: _Base(__a, std::move(__rhs)),
_Default_ctor_enabler(_Enable_default_constructor_tag{})
@@ -1141,8 +1140,8 @@
variant& operator=(const variant&) = default;
variant& operator=(variant&&)
- noexcept(__and_<is_nothrow_move_constructible<_Types>...,
- is_nothrow_move_assignable<_Types>...>::value) = default;
+ noexcept((is_nothrow_move_constructible<_Types>::value && ...)
+ && (is_nothrow_move_assignable<_Types>::value && ...)) = default;
template<typename _Tp>
enable_if_t<__exactly_once<__accepted_type<_Tp&&>>
@@ -1226,7 +1225,7 @@
void
swap(variant& __rhs)
- noexcept(__and_<__is_nothrow_swappable<_Types>...>::value
+ noexcept((__is_nothrow_swappable<_Types>::value && ...)
&& is_nothrow_move_assignable_v<variant>)
{
if (this->index() == __rhs.index())
More information about the Libstdc++
mailing list