6 ms·
If you haven’t already look up ‘if constexpr’ in cpp17 and newer. It lets you have compile time branches in a single function.
by cshokie 2y ago
If you haven’t already look up ‘if constexpr’ in cpp17 and newer. It lets you have compile time branches in a single function.
- mst 2y agoAlso requires, which initially looks batshit insane but is in fact really quite cool: https://www.think-cell.com/en/career/devblog/if-constexpr-requires-requires-requires https://www.think-cell.com/en/career/devblog/if-constexpr-re...
- Loranubi 2y ago> Unlike requires requires and requires { requires }, which are perfectly reasonable C++ code, requires requires { requires } is completely silly. Normal day in cpp land...
- spopejoy 2y agoHow on earth did C++ brainrot lead them to think that reusing that keyword was anything but a nightmare? The very first line of the article > Probably the two most useful features added to C++20 are requires and requires said without a trace of irony ... the whole thing reads like parody! I keep hearing that C++20 or whatever is getting so great but if so why would they specify such a dumpster fire of syntax???