jeudi 24 mars 2022

How to use ... in a class template specialization?

This is an example with ... in the middle position of a template, however I cant understand what it means.

template <typename T, T f> class Invalid;
template <typename T1, typename... Args, T1 (*f)(Args...)>
class Invalid<T1 (*)(Args...), f>
{};

The following also works for me and is easy to comprehend.

template <typename... Args> class Invalid;
template <typename T1, typename... Args>
class Invalid<T1 (*)(Args...), T1>
{};

Why would I use the first one instead of the second?

Aucun commentaire:

Enregistrer un commentaire