Quantcast
Channel: "constexpr if" vs "if" with optimizations - why is "constexpr" needed? - Stack Overflow
Browsing latest articles
Browse All 2 View Live

Answer by Vittorio Romeo for "constexpr if" vs "if" with optimizations - why...

This is easy to explain through an example. Considerstruct Cat { void meow() { } };struct Dog { void bark() { } };andtemplate <typename T>void pet(T x){ if(std::is_same<T, Cat>{}){...

View Article



"constexpr if" vs "if" with optimizations - why is "constexpr" needed?

C++1z will introduce "constexpr if" - an if that will have one of branches removed, based on the condition. Seems reasonable and useful.However, is it not possible to do without constexpr keyword? I...

View Article
Browsing latest articles
Browse All 2 View Live




Latest Images