Hacker News new | ask | show | jobs
by jcelerier 1118 days 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();
    }
1 comments

This 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.