Click here to Skip to main content
15,883,843 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: create a graph Pin
Chandrasekharan P6-Mar-08 0:38
Chandrasekharan P6-Mar-08 0:38 
GeneralRe: create a graph Pin
toxcct6-Mar-08 0:43
toxcct6-Mar-08 0:43 
GeneralRe: create a graph Pin
brahmakurrereddy6-Mar-08 18:41
brahmakurrereddy6-Mar-08 18:41 
GeneralRe: create a graph Pin
toxcct6-Mar-08 22:03
toxcct6-Mar-08 22:03 
Questionhow to take Active window file as ainput file in mfc Pin
mastp5-Mar-08 22:33
mastp5-Mar-08 22:33 
Generalusing CColorDialog Pin
Gita.Bairavi5-Mar-08 22:22
Gita.Bairavi5-Mar-08 22:22 
QuestionRe: using CColorDialog Pin
Rajkumar R5-Mar-08 22:47
Rajkumar R5-Mar-08 22:47 
Generaltemplate function instantiation Pin
George_George5-Mar-08 22:22
George_George5-Mar-08 22:22 
Hello everyone,


For the following code from Bjarne's book, it is stated that template parameter T for function g will be instantised as int other than double. My question is why there are not two instantiations for both int and double version of template function g?

// section C.13.8.3 Point of Instantiatant Binding

template <class T> void f (T a) { g(a); }

void g(int);

void h()
{
	extern g (double);
	f (2);
}


Here is the related statement from Bjarne,

--------------------
Each use of a template for a given set of template arguments defines a point of instantiation.
That point is the nearest global or namespace scope enclosing its use,
just before the declaration that contains that use.
--------------------

Does it before g (double) is not global function or namespace scope enclosing its use? If yes, I do not know why g (double) is not a global function, since it is declared as extern and some other compile unit should expose it?


thanks in advance,
George
GeneralRe: template function instantiation Pin
CPallini5-Mar-08 22:35
mveCPallini5-Mar-08 22:35 
GeneralRe: template function instantiation Pin
George_George5-Mar-08 22:51
George_George5-Mar-08 22:51 
QuestionRe: template function instantiation Pin
CPallini5-Mar-08 22:53
mveCPallini5-Mar-08 22:53 
GeneralRe: template function instantiation Pin
George_George5-Mar-08 23:01
George_George5-Mar-08 23:01 
GeneralRe: template function instantiation Pin
CPallini5-Mar-08 23:23
mveCPallini5-Mar-08 23:23 
GeneralRe: template function instantiation Pin
George_George6-Mar-08 0:12
George_George6-Mar-08 0:12 
GeneralRe: template function instantiation Pin
toxcct5-Mar-08 23:53
toxcct5-Mar-08 23:53 
GeneralRe: template function instantiation Pin
George_George6-Mar-08 0:11
George_George6-Mar-08 0:11 
GeneralRe: template function instantiation Pin
Rajkumar R5-Mar-08 23:30
Rajkumar R5-Mar-08 23:30 
GeneralRe: template function instantiation Pin
George_George6-Mar-08 0:07
George_George6-Mar-08 0:07 
GeneralRe: template function instantiation Pin
Rajkumar R6-Mar-08 0:52
Rajkumar R6-Mar-08 0:52 
GeneralRe: template function instantiation Pin
George_George6-Mar-08 0:59
George_George6-Mar-08 0:59 
GeneralRe: template function instantiation Pin
Rajkumar R6-Mar-08 1:08
Rajkumar R6-Mar-08 1:08 
GeneralRe: template function instantiation Pin
George_George6-Mar-08 1:21
George_George6-Mar-08 1:21 
GeneralRe: template function instantiation Pin
George_George6-Mar-08 0:29
George_George6-Mar-08 0:29 
AnswerRe: template function instantiation [modified] Pin
Rajkumar R6-Mar-08 1:00
Rajkumar R6-Mar-08 1:00 
GeneralRe: template function instantiation Pin
George_George6-Mar-08 1:56
George_George6-Mar-08 1:56 

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.