This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Templates and inheritance of types
- To: Gerald Pfeifer <pfeifer at dbai dot tuwien dot ac dot at>
- Subject: Re: Templates and inheritance of types
- From: Alexandre Oliva <oliva at dcc dot unicamp dot br>
- Date: 10 Aug 1998 08:29:25 -0300
- Cc: egcs-bugs at cygnus dot com, Mark Mitchell <mark at markmitchell dot com>
- References: <Pine.GSO.4.02.9808101205510.26575-100000@markab.dbai.tuwien.ac.at>
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