News for hackers. Stuff that matters.
Re:C++20 Idioms for Parameter Packs by planede on Wednesday February 28, 2024 @06:00AM (#39536414)
You don't need recursion, but you do need a template, AFAIK.

https://godbolt.org/z/o53o53W5r

Re:C++20 Idioms for Parameter Packs by angiosperm on Wednesday February 28, 2024 @04:57PM (#39543989)
Why does the

  <size_t ...Idxs>
construct work, when we needed same_as<char>?
Re:C++20 Idioms for Parameter Packs by planede on Thursday February 29, 2024 @04:22AM (#39547768)
Context. I assume you mean something like `void foo(size_t ...Idxs)`, which indeed doesn't work. It can't work, as nothing indicates that this would be a template, and it should be at least templated on the size of the pack.

<size_t ...Idxs> works because it introduces a pack that is a template parameter, so it naturally gets templated on the size of the pack (as well as on the values).

I guess an other historical issue for the grammar is that without the parameter name, `void foo(size_t ...)` is already valid grammar, and is equivalent to `void foo(size_t, ...)`, a C-style variadic.