C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Making tuple an aggregate

From: Thiago Macieira <thiago_at_[hidden]>
Date: Tue, 07 Jun 2022 11:03:29 -0700
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.

> Any thoughts?

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

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

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DPG Cloud Engineering

Received on 2022-06-07 18:03:31