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 09:52:09 -0500
On Fri, Aug 16, 2019 at 9:05 AM Vladimir Grigoriev via Std-Discussion <
std-discussion_at_[hidden]> wrote:

> In the section 13.6.3 Variadic templates there is written
>
> 3 An init-capture pack is a lambda capture that introduces an init-capture
> for each of the elements in the pack expansion of its initializer
>
> template <typename... Args>
> void foo(Args... args) {
> [...xs=args]{
> bar(xs...); // xs is an init-capture pack
>
> and then
>
> 5 A pack expansion consists of a pattern and an ellipsis,...
>
> However we see that in the example above the pack expansion does not use
> ellipsis. And inside a sizeof... expression there is also ellipsis are not
> used.
>
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`, and also in `bar(xs...)`, `xs...` is a pack expansion. Both use
an ellipsis.
The `sizeof...` operator also contains an ellipsis. It just happens that
the ellipsis is not adjacent to the pack.


>
> So in my opinion the paragraph 5 can be rewritten. Otherwise it confuses
> readers.
>
> With best regards,
> (Vlad from Moscow)
>
> You can meet me at http://cpp.forum24.ru/ or www.stackoverflow.com or
> http://ru.stackoverflow.com
> --
> Std-Discussion mailing list
> Std-Discussion_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion
>


-- 
*Brian Bi*

Received on 2019-08-16 09:54:24