Enforce compile-time constexpr
c++, c++11, constexpr
Solution
Replace it with a metafunction:
template <int x> struct foo { static constexpr int value = x + 1; };
Usage:
foo<12>::value
Problem
In C++11 we get `constexpr`: ``` constexpr int foo (int x) { return x + 1; } ``` Is it possible to make invocations of `foo` with a dynamic value of `x` a compile time error? That is, I want to create a `foo` such that one can only pass in `constexpr` arguments.