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

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -