c++ - What's the legal syntax to define nested template? -
i have following nested template
class { template <typename t> class b { template <typename u> void foo(u arg); }; };
i trying define nested template so:
template <typename t, typename u> void a::b<t>::foo(u arg) {...}
but getting declaration incompatible function template
error. what's legal syntax so?
you need separate template declarations:
template <typename t> template <typename u> void a::b<t>::foo(u arg) { … }
Comments
Post a Comment