C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Making tuple an aggregate

From: Avi Kivity <avi_at_[hidden]>
Date: Tue, 7 Jun 2022 22:22:33 +0300
On 07/06/2022 21.03, Thiago Macieira via Std-Proposals wrote:
> On Tuesday, 7 June 2022 09:54:57 PDT Phil Endecott via Std-Proposals wrote:
>> template <typename... TYPES>
>> struct tuple {
>> TYPES fields;...
>> };
>>
>> I note that we can use pack expansion with ",". Why not also with ";" ?
> Because the statement is already over and it would be impossible difficult to
> tell what the ... applies to. Remember we also have fold expressions.


maybe:


TYPES... fields;


>> Any thoughts?
> That would remove the Empty Base Optimisation for std::tuple, which finds uses
> for classes generically storing possibly-empty templates.


[[no_unique_address]] TYPES... fields;


>
> Example: allocators in all containers, deleters in the smart pointers. As in:
> https://code.woboq.org/gcc/libstdc++-v3/include/bits/
> unique_ptr.h.html#std::__uniq_ptr_impl::_M_t
>

Received on 2022-06-07 19:22:38