Template help,To Alexandre Oliva
Alexandre Oliva
aoliva@redhat.com
Mon Nov 13 20:37:00 GMT 2000
On Nov 14, 2000, "Shiv Shankar Ramakrishnan" <Shiv@pspl.co.in> wrote:
> #if _MSC_VER >= 1200 //check for the version of your compiler
> #define TYPENAME_ typedef
> #else
> #define TYPENAME_ typename
> #endif
This is wrong. `typename' is not a replacement for `typedef'. In
this case, one must use typedef, because a type alias is what the
declaration is going to define, and typename, because it must precede
any template-dependent nested-name-specifiers that are supposed to be
typenames regardless of the template arguments used in an
instantiation.
So, you should define TYPENAME_ to either `typename' or `', and use:
typedef TYPENAME_ T1::Type1 Type1;
Note that there are other uses of the typename keyword, such as in
template parameters, that should either remain unchanged or be
substituted with the `class' keyword.
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me
More information about the Gcc
mailing list