3 ms·
A constexpr function can be used with a non-constexpr argument in which case the compiler will keep the function in the compiled code and you can use it as a no
by AlexeyBrin 9y ago
A constexpr function can be used with a non-constexpr argument in which case the compiler will keep the function in the compiled code and you can use it as a normal function.
In the context of the linked article, take the first example and modify it, by reading a number at runtime with std::cin and call factorial or fibonacci with this number as an argument.
Something like this https://godbolt.org/g/CT5M6f https://godbolt.org/g/CT5M6f