Re:Improving _Generic in C2y
by Conscat on Sunday August 04, 2024 @07:22PM
(#41156974)
I tried using `_Generic` inside C++ templates as a lighter alternative to `std::conditional_t`, but I was disappointed to find it didn't have short-circuiting semantics, which is my biggest pain point with `std::conditional_t`. If it wasn't necessary to type-check, that would make variadic programming much easier for me. The other problem is that only Clang accepts it in C++ mode.
[ Parent
| on HN ]
If constexpr makes it moot nowadays, but before that there were generic lambda tricks.
Fore pure type level programming, it is possible to write lazily evaluated std::conditional. What's your usecase?