Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardC++template metaprogrammingSingle-choice MCQ

What does the compiler do for the body of this `if constexpr` in a template, and how does it differ from a normal `if`?

template <class T> auto val(T t) { if constexpr (std::is_pointer_v<T>) return *t; else return t; }