Templates and inheritance of types
Alexandre Oliva
oliva@dcc.unicamp.br
Mon Aug 10 04:33:00 GMT 1998
Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at> writes:
> #include <vector>
> template <class T> class C : public vector<T> {
> C( typename /*vector<T>::*/const_iterator b ) { } };
> Is it really necessary to explicitely write vector<T>:: ?
The standard says [temp.res]/5:
5 [...] The keyword typename shall only be applied to qualified
names, but those names need not be dependent. [...]
Since const_iterator is not a qualified name, `typename' is not
acceptable.
However, if you remove the `typename' keyword, `const_iterator' would
only be considered a type if there were a global type with that name.
Hence, it appears to me that the only valid way to declare the
constructor parameter `b' is: `typename vector<T>::const_iterator b'.
--
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil
More information about the Gcc-bugs
mailing list