Click here to Skip to main content
15,910,471 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: anti-standard code can compile -- about template class Pin
George_George7-Mar-08 0:22
George_George7-Mar-08 0:22 
GeneralRe: anti-standard code can compile -- about template class Pin
BadKarma6-Mar-08 22:59
BadKarma6-Mar-08 22:59 
GeneralRe: anti-standard code can compile -- about template class Pin
Maxwell Chen6-Mar-08 23:06
Maxwell Chen6-Mar-08 23:06 
GeneralRe: anti-standard code can compile -- about template class Pin
George_George6-Mar-08 23:24
George_George6-Mar-08 23:24 
GeneralRe: anti-standard code can compile -- about template class Pin
Maxwell Chen6-Mar-08 23:35
Maxwell Chen6-Mar-08 23:35 
JokeRe: anti-standard code can compile -- about template class Pin
Maxwell Chen6-Mar-08 23:41
Maxwell Chen6-Mar-08 23:41 
GeneralRe: anti-standard code can compile -- about template class Pin
George_George7-Mar-08 0:21
George_George7-Mar-08 0:21 
GeneralRe: anti-standard code can compile -- about template class Pin
Maxwell Chen7-Mar-08 3:09
Maxwell Chen7-Mar-08 3:09 
George_George wrote:
What do you mean, Maxwell?


(I am home, so I can copy-and-paste now! )

In the beginning, you quoted Stroustrup's words.
Not can an unqualified name used in a template
 ever be bound to a local name. Finally, even if a template
 is first used within a class, unqualified names used in the template
 will not be bound to members of that class.
 Ignoring lcoal names is essential to prevent a lot of
 nasty macro-like behavior.
  
section C.18.3.3 Point of Instantiation Binding


So I gave you that GCC document[^], which introduced this code sample.
Doesn't the code match what Stroustrup said?! Unsure | :~
template <typename T> 
struct Base {
  int i;
};
template <typename T> 
struct Derived : public Base<T> {
  int get_i() { return i; } // Even if a template is first used within a class, 
                            //  <font color="red">unqualified names</font> used in the template
                            //  will <font color="red">not be bound to members</font> of that class. 
};


  Maxwell Chen

GeneralRe: anti-standard code can compile -- about template class Pin
George_George7-Mar-08 3:18
George_George7-Mar-08 3:18 
GeneralRe: anti-standard code can compile -- about template class Pin
Maxwell Chen7-Mar-08 3:23
Maxwell Chen7-Mar-08 3:23 
GeneralRe: anti-standard code can compile -- about template class Pin
George_George7-Mar-08 3:37
George_George7-Mar-08 3:37 
GeneralRe: anti-standard code can compile -- about template class Pin
Maxwell Chen7-Mar-08 3:56
Maxwell Chen7-Mar-08 3:56 
GeneralRe: anti-standard code can compile -- about template class Pin
George_George7-Mar-08 20:21
George_George7-Mar-08 20:21 
GeneralRe: anti-standard code can compile -- about template class Pin
George_George7-Mar-08 0:20
George_George7-Mar-08 0:20 
GeneralRe: anti-standard code can compile -- about template class Pin
George_George7-Mar-08 0:19
George_George7-Mar-08 0:19 
GeneralRe: anti-standard code can compile -- about template class Pin
BadKarma7-Mar-08 1:11
BadKarma7-Mar-08 1:11 
GeneralRe: anti-standard code can compile -- about template class Pin
George_George7-Mar-08 1:13
George_George7-Mar-08 1:13 
GeneralRe: anti-standard code can compile -- about template class Pin
BadKarma7-Mar-08 1:35
BadKarma7-Mar-08 1:35 
GeneralRe: anti-standard code can compile -- about template class Pin
George_George7-Mar-08 1:39
George_George7-Mar-08 1:39 
GeneralRe: anti-standard code can compile -- about template class Pin
Mike Dimmick7-Mar-08 14:30
Mike Dimmick7-Mar-08 14:30 
GeneralRe: anti-standard code can compile -- about template class Pin
George_George7-Mar-08 20:25
George_George7-Mar-08 20:25 
GeneralRe: anti-standard code can compile -- about template class Pin
Mike Dimmick8-Mar-08 1:34
Mike Dimmick8-Mar-08 1:34 
GeneralRe: anti-standard code can compile -- about template class Pin
George_George8-Mar-08 22:15
George_George8-Mar-08 22:15 
QuestionHow Can Attach Bar Visulizer? Pin
Le@rner6-Mar-08 20:26
Le@rner6-Mar-08 20:26 
QuestionHow to Get Task List in Windows Pin
somasundarambe6-Mar-08 19:12
somasundarambe6-Mar-08 19:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.