Re: nondependent base in templates
On 28 Okt., 14:03, muler <mulugeta.abe...@gmail.com> wrote:
Hi,
Consider this:
template <class X>
class Base {
public:
typedef double T;
};
template <class T>
class Derived : Base<int> { // nondependent base
public:
T strange_; // T is Base<int>::T (i.e, double) not template
parameter T
};
Question: how can I refer to the template parameter T in the derived
class without:
1) changing its name, and
2) changing the typedef in Base ?
3) Changing the template parameter name T in derived
No kidding, this is a nasty problem which is
intensively debated on
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#459
My personal guess is that it won't be fixed for
C++0x. No, no-one told me that, but it's rather
probable given the history of the issue and the
time-line for C++0x.
IMO currently we can only reduce the risks by
proper naming conventions. While I consider the
problem as nasty, I never met it personally,
because I never had a naming clash of a member
typedef with a template parameter name.
HTH & Greetings from Bremen,
Daniel Kr?gler
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]