lundi 3 août 2020

How to avoid this kind of code repetition?

In order to avoid code repetition, I need to do something like this (in my real code I have much more complex types similar to T1 and T2):

template <class T1, class T2>
struct A 
{};

template <class T1, class T2>
struct B 
{};

template <class X>
struct C 
{
   using p1 = int;
   using p2 = char;

   using some = X<p1, p2>;
};

int main()
{
   C<A> o1; // must produce C<A<int,char> >
   C<B> o2; // must produce C<B<int,char> >
}

Aucun commentaire:

Enregistrer un commentaire