Monday, September 25, 2017

C++14: Relaxed constexpr restrictions

C++14 allows more cases where a function can be declared constexpr. This includes any function satisfies the following 
criteria:
  1. It contains only variable declarations not declared static nor thread_local.
  2. It contains no variable declarations without initializers.
The function can contain if, switch, and loop statements.
The function can change the values of objects, as long as those object is during the execution of the function.

No comments:

Post a Comment