vendredi 19 juin 2020

Partial template specialization for template class like std::function

I want to create a function overload to partially specialize a template class. How to make this code work?

template <typename T>
struct Foo;

template <typename Result, typename ... Args>
struct Foo<Result(Args...)>
{
    Result Bar()
    {
        Result t;
        return t;
    }
};

template <typename ... Args>
void Foo<void(Args...)>::Bar()
{
    // do nothing;
}

Aucun commentaire:

Enregistrer un commentaire