I want to declare something like this:
template <typename T>
constexpr enable_if_t<is_integral_v<T>, int[]> foo = { 1, 2 };
template <typename T>
constexpr enable_if_t<is_floating_point_v<T>, int[]> foo = { 10, 20, 30 };
But when I try to I'm getting this error:
error: redeclaration of
template<class T> constexpr std::enable_if_t<std::is_floating_point<_Tp>::value, int []> foo
note: previous declarationtemplate<class T> constexpr std::enable_if_t<std::is_integral<_Tp>::value, int []> foo<T>
I feel like this should be legal as there will never be more than one foo
defined for any given template argument. Is there something I can do to help the compiler understand this?