jeudi 2 juin 2022

How can I define arguments of variadic template?

I have a variadic template and would to define the arguments using using alias declaration.

Here is an example:

template<class I, class... P>
struct Molecule {
  using Index = I;
};

My question is, how can I define the first argument of P... ?

I have already tried this, but it generates an error:

template<class I, class... P>
struct Molecule {
  using Index = I;
  P array[sizeof...(P)] = { P... };
  using Part1 = array[0];
};

Any suggestions please?

Aucun commentaire:

Enregistrer un commentaire