Get the latest tech news
C++26 Expansion Tricks
P1306 gives us compile time repetition of a statement for each element of a range - what if we instead want the elements as a pack without introducing a new function scope?
In this blog post we’ll look at the expand helper, expansion statements and how arbitrary ranges can be made decomposable via structured bindings to reduce the need for IILEs. In a lot of existing C++(20 and upwards) code you see the following pattern to accept string literals as constant template arguments. While all of the aforementioned examples make use of reflection features, generating a pack of constants is not actually a new concept.
Or read this on Hacker News