3 ms·
i'm talking about "if constexpr", not "constexpr" ; "if constexpr" allows to make choices at compile time depending on properties of a variable and that is defi
by jcelerier 4y ago
i'm talking about "if constexpr", not "constexpr" ; "if constexpr" allows to make choices at compile time depending on properties of a variable and that is definitely what reflection is about.
e.g.
void f(auto x) {
// common code path
if constexpr(x is floating-point) {
// code path 1
}
else if constexpr(x is a string) {
// code path 2
}
// common code path
}
- still_grokking 4y agoOh, I see. You're right. Thanks for the pointer.