2 ms·
> `if constexpr` is such a disaster. to me it's been a very useful tool for reflection, for instance if constexpr (requires { foo.someMember; }) {
by jcelerier 3y ago
> `if constexpr` is such a disaster.
to me it's been a very useful tool for reflection, for instance
if constexpr (requires { foo.someMember; }) {
use(foo.hasSomeMember);
} else {
some_fallback_case();
}
- mhh__ 3y agoThis is "design by introspection". It works a lot better if you can 1. Do this in types. 2. Do this without introducing a new scope inside a function.