Intermediate C++
Q81 / 100

What is if constexpr in C++17?

Correct! Well done.

Incorrect.

The correct answer is B) A compile-time conditional that discards the non-taken branch, enabling type-specific code in templates without SFINAE

B

Correct Answer

A compile-time conditional that discards the non-taken branch, enabling type-specific code in templates without SFINAE

Explanation

if constexpr (is_integral_v<T>) { ... } else { ... } — the else branch is not instantiated for integral T. Simpler than SFINAE for type-based branching.

Progress
81/100