C++ Logo

std-discussion

Advanced search

Re: Contradiction in the description of the pack expansion

From: Brian Bi <bbi5291_at_[hidden]>
Date: Fri, 16 Aug 2019 10:23:26 -0500
On Fri, Aug 16, 2019 at 10:19 AM Ville Voutilainen via Std-Discussion <
std-discussion_at_[hidden]> wrote:

> On Fri, 16 Aug 2019 at 17:52, Brian Bi via Std-Discussion
> <std-discussion_at_[hidden]> wrote:
> > Which pack expansion in this example does not use an ellipsis?
> > There are two pack expansions here: `...xs=args` where the pattern is
> `xs=args`,
>
> That's not a pack expansion. It's a declaration of a captured pack,
> initialized from another pack. It does not
> and should not use a trailing ellipsis.
>
> > and also in `bar(xs...)`, `xs...` is a pack expansion. Both use an
> ellipsis.
>
> That one is fine, yes.
>
> > The `sizeof...` operator also contains an ellipsis. It just happens that
> the ellipsis is not adjacent to the pack.
>
> It contains an ellipsis but it's not a pack expansion.
> --
> Std-Discussion mailing list
> Std-Discussion_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion
>

That's not what the plain text of the standard says (C++17
[temp.variadic]/4):

Pack expansions can occur in the following contexts: ... In a *capture-list*
> (8.1.5); the pattern is a *capture*. In a sizeof... expression (8.3.3);
> the pattern is an *identifier*.


-- 
*Brian Bi*

Received on 2019-08-16 10:25:41