Since constexpr
doesn't gives guarantee that it will be processed 'in-compile-time', I'd like to know some method to check if my code actually has been performed in compile-time or not.
Lets assume I have created some functor class, that on execution returns an array of values. I want it to be proceeded under compile-time.
#include "Functor.hpp"
constexpr Functor<int> functor_g; // not sure if should be static too
auto globalArray = functor_g(); // not sure if should be also const/constexpr
int main()
{
// ...
}
Obviously I can't run any timers here because they requires run-time environment.
edit: I have confirmed it performs in compile-time by checking the assembly result under godbolt.org. Its a way for a small things, but still I would be grateful for some other methods.