C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Making tuple an aggregate

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Tue, 7 Jun 2022 15:20:27 -0400
On Tue, Jun 7, 2022 at 2:03 PM Thiago Macieira via Std-Proposals
<std-proposals_at_[hidden]> 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.
>
> > Any thoughts?
>
> That would remove the Empty Base Optimisation for std::tuple, which finds uses
> for classes generically storing possibly-empty templates.

Not necessarily:

template<typename ...Ts>
struct tpl
{
  [[no_unique_address]] Ts... ts;
};

Received on 2022-06-07 19:21:56