May Oakes
May Oakes

Reputation: 4619

How do I define a template member function within a template class outside of the class definition?

Given:

template <class T>
class Foo
{
public:
    template <class U>
    void bar();
};

How do I implement bar outside of the class definition while still having access to both template parameters T and U?

Upvotes: 52

Views: 9097

Answers (1)

Anycorn
Anycorn

Reputation: 51465

IIRC:

template<class T> template <class U>
void Foo<T>::bar() { ...

Upvotes: 62

Related Questions