help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: template<> keyword unexpecting hide virtual members


From: Paul Pluzhnikov
Subject: Re: template<> keyword unexpecting hide virtual members
Date: Tue, 26 Dec 2006 22:28:56 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)

"Grizlyk" <grizlyk1@yandex.ru> writes:

> It is pity, i have no "[temp.dep], 14.6.2(3) in the C++ Standard".

Do you mean you don't have the C++ Standard, or that your copy
doesn't have section 14.6.2(3)?

Here is what it says:

  In the definition of a class template or in the definition of a
  member of such a template that appears outside of the template
  definition, if a base class of this template depends on a
  template-parameter, the base class scope is not examined during
  name lookup until the class template is instantiated.

  [Example: 
     typedef double A; 
     template<class T> B { 
       typedef int A; 
     }; 
     template<class T> struct X : B<T> { 
       A a; // a has type double 
     }; 

     The type name A in the definition of X<T> binds to the typedef
     name defined in the global namespace scope, not to the typedef
     name defined in the base class B<T>. 
  ]

> So can you explain me the reason of the hiding?

I don't know why this section was written that particular way,
but there probably was a good reason for this, since this is
somewhat unexpected. The reason possibly has to do with the fact
that template specializations can almost completely change class
interface.

Language experts over in comp.lang.c++ may have a ready explanation.

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]