[PATCH] libstdc++: New _IndexPack utility to simplify index pack creation
Tomasz Kaminski
tkaminsk@redhat.com
Fri Oct 24 12:17:22 GMT 2025
On Fri, Oct 24, 2025 at 2:04 PM Matthias Kretz <m.kretz@gsi.de> wrote:
> > > > #endif // __glibcxx_integer_sequence
> > >
> > > This is defined for C++14 and later, but I think it can't actually be
> > > used for anything useful without C++26 packs introduced by structured
> > > bindings, right?
> > >
> > > I wonder if we want to restrict the definition of _IndexPack to C++26?
> >
> > I have defined my inital patch under #if __cpp_structured_bindings >=
> > 202411L,
> > i.e. auto [...ids] = is supported by the compiler, and I think this is
> the
> > right condition.
> > If this functionality will be made available as extension in previous
> > standard, _IndexPack
> > will also be useful.
>
> My thinking was that this simple tool itself doesn't require C++26. You
> can
> also use it like this:
>
> for (int i : _IndexPack<10>) { ... }
>
I can also use C-style for and have even less impact at compile time.
So I am not sold on this.
>
> So it can be useful even without __cpp_structured_bindings >= 202411L. But
> I'm
> happy either way, since I only need it in [simd]. ;-)
>
I would limit it to __cpp_structured_binidngs.
>
> - Matthias
>
> --
> ──────────────────────────────────────────────────────────────────────────
> Dr. Matthias Kretz https://mattkretz.github.io
> GSI Helmholtz Center for Heavy Ion Research https://gsi.de
> std::simd
> ──────────────────────────────────────────────────────────────────────────
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20251024/27306c2f/attachment.htm>
More information about the Libstdc++
mailing list