1

I'm wondering if it is possible to compare / simplify / canonicalize template template parameters.

I.e. I have a

template <template <typename...> class CONTAINER>
struct spam;

and would like to check if two spam types are the same

template <typename T>
using vectoralias = std::vector<T>;

std::is_same_v<spam<std::vector>,spam<vectoralias>>; // is false, where I (too) naively would've expected true.

compiler-explorer link.

I assume comparing equality of two templated types without spelling out the template parameter is hard as the two templated types I'm comparing may contain complicated enable_if or conditional, but in the simple case of an alias like here, I'm wondering if there might be a way.

pseyfert
  • 3,263
  • 3
  • 21
  • 47

0 Answers0