Which C++ standard introduced the if constexpr feature?
Options
- A. C++11
- B. C++14
- C. C++17
- D. More than one of the above
- E. None of the above
Quiz Practice:
C. C++17
Answer: (C) C++17
The if constexpr feature was introduced in C++17.
It allows a condition to be evaluated at compile time in appropriate template contexts.
For example:
if constexpr (condition) { ... }
C++17 also introduced several other useful language and library features, making it another important stage in modern C++ development.