#include <iostream>
template <class T> struct base {};
struct derived: base<int> {};
int main(int argc, char* argv[]) {
typename derived::base<double> x; // <- (1) Is this legal?
typename derived::derived::base<double>::base<int>::base<void> y; // <- (2) Is this legal?
return 0;
}
Are both marked lines perfectly legal C++?
Thanks,
Vincent
Like normal (non-template) classes, class templates have an injected-class-name (Clause 12). The injected-
class-name can be used as a template-name or a type-name. When it is used with a template-argument-list, as
a template-argument for a template template-parameter, or as the final identifier in the elaborated-type-specifier
of a friend class template declaration, it refers to the class template itself.
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-discussion+unsubscribe@isocpp.org.
To post to this group, send email to std-dis...@isocpp.org.
Visit this group at https://groups.google.com/a/isocpp.org/group/std-discussion/.