vendredi 4 août 2017

Variadic template combined with default template argument

Suppose I have a class

enum CallbackType
{
    SYNC,
    ASYNC
}


template<CallbackType CB = SYNC, typename... Args>
class Callback
{
}

I would like to be able to optionally specificy the callback type while still being ablet to have variadic template argument. Now I understand that the compiler can't tell them apart, but maybe there is some way to handle the specific case where the first template argument is of CallbackType ?

Callback<int int> //Should be Callback<SYNC, int, int>
Callback<ASYNC, int, int> //Should be Callback<ASYNC, int, int>

Aucun commentaire:

Enregistrer un commentaire