3 ms·
From c++17, You can also use a if statement in c++ (if constexpr (std::is_same_v<T, int>) {...})
by varajelle 4y ago
From c++17, You can also use a if statement in c++ (if constexpr (std::is_same_v<T, int>) {...})
- haberman 4y agoYou can't use "if constexpr" to vary the type signature, for example (as in my link). Or to choose a different representation for a type based on a type parameter. Those will require metaprogramming at the template level. Another example: you can't write std::is_same_v itself using "if constexpr".