Reputation: 13575
Assume class Data
has a local class template Element<i>
, the following code has a compilation error. Code seems simple, but what is wrong?
template<unsigned i, class Data>
class A
{
public:
typedef typename Data::Element<i> ElementTy; // compilation error: token error
};
Upvotes: 0
Views: 30
Reputation: 52365
You need the template
keyword:
typedef typename Data::template Element<i> ElementTy;
This tells the compiler that the name following is a template.
Upvotes: 1