Static data members in template declarations

Alexandre Oliva oliva@dcc.unicamp.br
Mon Nov 2 01:17:00 GMT 1998


On Nov  2, 1998, Mark Mitchell <mark@markmitchell.com> wrote:

> Concretely, consider this:

> const int a = 7;
> template<class T> struct S : public T { int j [S<T>::a]; int k [a]; };
> struct U { static const int a = 3; };

> Now, in `S<U>', `S<U>::a' is 3 while `a' is 7.

But this is completely different from the previous example.  In that
example, a was declared within the template class, so it couldn't
possibly be bound to names outside the template class body.

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:oliva@gnu.org mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil




More information about the Libstdc++ mailing list