Replacement for ternary operator in template metaprogramming
问题 I am implementing a binomial coefficient (n choose k) function in C++. Besides using a "normal" function (which is evaluated at runtime) this also can be accomplished using template metaprogramming (when the arguments are known at compile time): template <unsigned int n, unsigned int k> struct Binomialkoeffizient { static const unsigned int value = Binomialkoeffizient<n, k-1>::value * (n-k+1) / k; }; template <unsigned int n> struct Binomialkoeffizient<n, 0> { static const unsigned int value