r/cpp • u/Clean-Upstairs-8481 • Jul 20 '26
C++26: what is “template for”? Learning with simple example.
https://techfortalk.co.uk/2026/07/20/c26-what-is-template-for/I have been exploring C++26 in bits and bobs and this one is about template for - a c++26 feature which I find useful. This is a short article explaining how to use this feature with the help of a simple example.
75
Upvotes
View all comments
Show parent comment
2
u/fdwr fdwr@github 🔍 Jul 21 '26 edited Jul 23 '26
With condition outside the parentheses? No, but I often type
constexpr if (expression)by accident, and I get thatif constexpr (expression)is consistent with east-const likeint const x, but it still confuses me because adjective modifiers come before the thing in English, and other modifiers typically flowstatic int x, notint static x.