I am trying to implement a is_similar type trait based on the definition given by the standard (details here):
Two types
T1andT2are similar if they have cv-decompositions with the samensuch that correspondingPicomponents are either the same or one is "array ofNi" and the other is "array of unknown bound of", and the types denoted byUare the same.
However, I am not sure to exactly understand what it means, and how to implement it:
template <class T, class U, class = void>
struct is_similar_base: std::false_type {};
template <class T, class U>
struct is_similar_base<T, U, /* ??? */ >: std::true_type {};
template <class T, class U>
struct is_similar: is_similar_base<T, U> {};
template <class T, class U>
inline constexpr bool is_similar_v = is_similar<T, U>::value;
Any help would be welcome.