dimanche 6 décembre 2015

Ensuring that a variadic template contains no duplicates

I guess my whole problem is well described in the title. I am trying to create a variadic class template (in C++11, C++14 or C++1z).

template<typename ...Types> struct MyVariadicTemplate {};

and make sure that the list of types in any instantiation of MyVariadicTemplate is injective, so if I, for instance, call the following piece of code:

MyVariadicTemplate<int, double, int> x;

it won't compile (I'd be happy to do that somehow using static_assert).

I would appreciate a hint.

Aucun commentaire:

Enregistrer un commentaire