lundi 30 janvier 2017

Is it possible to ensure a constexpr function is called at most once at compile time?

As the title asks: Is it possible to ensure a constexpr function is called at most once at compile time?

This clearly won't be possible if the function is not constepxr; I could write a function that gets called whenever I press the space bar, so the compiler could never figure that out at compile time.

Aucun commentaire:

Enregistrer un commentaire