is there a way to put condition on constant value parameter in C++ template specialization?

Viewed 613

is there's a way to constrain the integral template parameter as specialization instead of this code redundancy ?

// redundant code

template <int N>
struct A {};
template <>
struct A <0> {};
template <>
struct A <1> {};

// what i want is some thing like this

template <int N>
struct A {};

template <>
struct A <N < 2> {};
2 Answers
Related