Topic: About DR 372


Author: daniel.frey@aixigo.de (Daniel Frey)
Date: Mon, 14 Jul 2003 21:58:59 +0000 (UTC)
Raw View
I just read DR 372 and I think that the problem presented is not really=20
discussed/solved properly. Consider this example:

class A {
protected:
   typedef int N;
};

template< typename T >
class B
{};

template< typename U >
class C : public U, public B< typename U::N >
{};

C< A > x;

The question is: If C is derived from A as above, is it allowed to=20
access A::N before the classes opening '{'?

The main problem is that you need to access U's protected parts in C's=20
base-clause. This pattern is common when using policies, Andrei's Loki=20
library was bitten by it as he tried to make some parts of the policies=20
'protected' but some compilers rejected the code. They were right to=20
reject it, I think it's 11.4/2 that applies here and prevents the code=20
above to be legal, although it addresses a different and reasonable=20
example. To me, it seems wrong to reject the code as it is perfectly=20
reasonable to write such stuff. The questions are:

- Do you agree it's reasonable?
- Is it a DR or is it a request for an extension?
- Is DR 372 the right place to address it or shall it be a new DR?

Regards, Daniel

--=20
Daniel Frey

aixigo AG - financial training, research and technology
Schlo=DF-Rahe-Stra=DFe 15, 52072 Aachen, Germany
fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99
eMail: daniel.frey@aixigo.de, web: http://www.aixigo.de

---
[ 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://www.jamesd.demon.co.uk/csc/faq.html                       ]