Topic: use of a private typedef as a template parameter?


Author: vinogradsky@my-deja.com
Date: 2000/07/27
Raw View
Please, consider the following sample:

template<typename T> class base
{
  typedef T type;
  ...
};

class otherClass : public base<sometype>
{
  ...
};

template<typename T> class derived : public base<T::type>
{
  ...
};

...

derived<otherClass> obj; // compiles fine under VC++
otherClass::type var; // compile error under VC++: can't access private
typedef

Definition of the derived class makes use of base's private typedef.
VC++ compiles it without an error. Is this legal behavior according to
the standard?

Thanks in advance,

Vlad


Sent via Deja.com http://www.deja.com/
Before you buy.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]