33 ms·
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 s
by Conscat 2y ago
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.
- gpderetta 2y agoIf 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?