c++ - Why am I getting "error: type name is not allowed" with these spaghetti templates? -


this question has answer here:

i have following code bit of "spaghetti" of templates:

template <typename a, typename b, typename... args> class c {     /*... */     bar& getbar() { /* ... */ } public:     template <typename u>     static void foo() {         a = geta<u>();         baz& bar = getbar();         bar.frob<u>(a); /* @@@ */     }     /*... */ }  /* no template */ class d : public c<somea, d, const somee&> { /* ... */ }  /* no template */ class f : public d { /* ... */} 

and when try compile function following statement:

d::foo<f>(); 

i error type name not allowed, on line marked @@@. why getting that? know when try call function type name, doesn't i'm doing here.

it's classic template ambiguity, unfortunately hard notice if don't know it. answer: need to write bar.template frob<u>(a); reason: see this q&a.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -