News for hackers. Stuff that matters.
Re:C++26: Pack Indexing by pragma_x on Friday January 24, 2025 @03:42PM (#42816724)
It's been ages since I've done metaprogramming with C++. I had to look this up, since my first reaction was: just use recursion! Yeah, I can see why a for-loop is the preferred way to go here.

Turns out that const-call depth is limited to 512, but by implementation, not by the standard (which is undefined).

https://stackoverflow.com/a/9320911/713831

Re:C++26: Pack Indexing by foota on Friday January 24, 2025 @04:05PM (#42816923)
There's a way to "iterate" over parameter packs called fold expressions, but they're painful and look very weird.
Re:C++26: Pack Indexing by plorkyeran on Friday January 24, 2025 @04:33PM (#42817134)
I don't find them painful, but they're definitely extremely weird looking. The fact that they're "fold expressions" but are normally used with operator comma to sequence together things that want to be statements is a pretty strong sign that something went wrong in the design process.
Re:C++26: Pack Indexing by a_t48 on Saturday January 25, 2025 @02:31AM (#42820149)
When I first touched this around C++14 or so, I used recursion. It resulted in even worse code.