[PATCH] PR libstdc++/86963 Implement LWG 2729 constraints on tuple assignment
Jonathan Wakely
jwakely@redhat.com
Mon Aug 20 13:54:00 GMT 2018
On 17/08/18 19:54 +0100, Jonathan Wakely wrote:
>On 17/08/18 19:01 +0100, Jonathan Wakely wrote:
>>On 17/08/18 18:52 +0100, Jonathan Wakely wrote:
>>>+ // The tag parameter ensures that in nested tuples each __tuple_base
>>>+ // is a different type and can use the empty base-class optimisation.
>>>+ template<typename _Tag>
>>>+ class __tuple_base
>>
>>Specifically, this would fail if __tuple_base was not a class
>>template:
>>
>>static_assert(sizeof(tuple<tuple<int>>) == sizeof(int), "");
>>
>>And also:
>>
>>struct empty {};
>>static_assert(sizeof(tuple<tuple<empty>, tuple<empty>>) == 2, "");
>
>
>In fact, it's just occurred to me that we don't really need the
>__tuple_base class template at all. We can make _Tuple_impl
>non-assignable (adding _M_assign members for the required
>functionality). Then we don't need an extra base class.
Which is what this patch does. I think it's cleaner than needing the
__tuple_base base class.
Tested x86_64-linux and committed to trunk.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 11634 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20180820/ca2bd05f/attachment.bin>
More information about the Libstdc++
mailing list