How do I use constexpr improvements in C++14?

C++14 introduces several improvements to `constexpr`, allowing more complex computations to be evaluated at compile time. This enhances performance and code clarity by enabling more powerful constant expressions.
C++14, constexpr, compile-time evaluation, constant expressions, C++ programming

#include 

// A simple constexpr function
constexpr int factorial(int n) {
    return (n <= 1) ? 1 : n * factorial(n - 1);
}

int main() {
    constexpr int val = 5;
    constexpr int result = factorial(val); // Evaluated at compile time

    std::cout << "Factorial of " << val << " is " << result << std::endl;
    return 0;
}
    

C++14 constexpr compile-time evaluation constant expressions C++ programming