Question 13
Back to Exercise
When is a constexpr function evaluated?
- A Always at compile time
- B At compile time when used in a constant expression with constant arguments; otherwise it can run at run time Correct
- C Always at run time
- D Only inside templates
Correct Answer: Option B
That flexibility is the difference from consteval (C++20), which must always be evaluated by the compiler.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!