mercredi 2 décembre 2015

Cannot match function declaration for template function in template class

Consider

template<class Y> struct foo
{
    template <class ForwardIt>
    foo(ForwardIt first, ForwardIt last);
};

In order to implement the constructor, I've written

template<class Y, class ForwardIt> foo(ForwardIt first, ForwardIt last)
{
    // ToDo - code here
}

But this generates a compile error to the effect that it cannot match that definition with a declaration.

What am I doing wrong? I'm using a C++11 compiler.

Aucun commentaire:

Enregistrer un commentaire