mercredi 25 mai 2016

Check if two variadic derived classes are instantiated with the same parameter pack

In situations, when you have a base and many derived classes, all of which encode a variadic pack, something like the following

template<typename ... Args>
struct base
{};

template<typename ... Args>
struct derived_1: base <Args...>
{};
template<typename ... Args>
struct derived_2: base <Args...>
{};

How does one check if objects of different derived classes were instantiated using the same pack. For instance given

derived_1<int,float,double> d1_obj;
derived_2<int,float,double> d2_obj;

I want a mechanism to tell me that both objects are equal, in the sense that they contain the same types in the same order.

Aucun commentaire:

Enregistrer un commentaire