overloading template variable specialization with SFINAE

46 views Asked by At

The following code:

template<class S, class = void>
constexpr bool is_size = false;
template<class S>
constexpr bool is_size<S, std::void_t<decltype(S::cx, S::cy)>> = true;
template<class S>
constexpr bool is_size<S, std::void_t<decltype(S::width, S::height)>> = true;

gives

error : redefinition of 'is_size<S, std::void_t<decltype(S::width , S::height)>>'.

Is it possible to implement the idea somehow or the only thing that can be done is comparing with all size types?

0

There are 0 answers