Reputation: 10166
I have the following nested template
class A {
template <typename T> class B {
template <typename U> void foo(U arg);
};
};
I am trying to define the nested template like so:
template <typename T, typename U> void
A::B<T>::foo(U arg) {...}
But am getting declaration is incompatible with function template
error. What's the legal syntax to do so?
Upvotes: 8
Views: 1159
Reputation: 546143
You need to separate the template declarations:
template <typename T>
template <typename U>
void
A::B<T>::foo(U arg) { … }
Upvotes: 14