Click here to Skip to main content
15,888,610 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
George_George wrote:
I have tried similar code as yours


it is not at all similar.

in my example it is
template <class T> void f(T a) {g (a);}


template <class T> void f(int a) {g (a);}
in this Template argument T is not addressed, in this case you want call like,
f<char> (100); // i used char just to deduce T.

similarly
template <class T1, class T2> void f(T2 a) {g (a);} 
here also template argument T1 is not deduced. here also you can use f<char> (100);

if you want template specialization, use like this,
void g(int a)
{	cout << a << endl;
}

extern void g(double);

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

<code>template <> 
void f(int a) 
{
	g (a);
}
or
template <> 
void f <int>(int a) 
{
	g (a);
}</code>
int main()
{	
	f (100);
	return 0;
}


modified on Thursday, March 6, 2008 7:20 AM

GeneralRe: template function instantiation Pin
George_George6-Mar-08 1:56
George_George6-Mar-08 1:56 
GeneralRe: template function instantiation Pin
Rajkumar R6-Mar-08 2:04
Rajkumar R6-Mar-08 2:04 
GeneralRe: template function instantiation Pin
George_George6-Mar-08 2:08
George_George6-Mar-08 2:08 
GeneralRe: template function instantiation Pin
Rajkumar R6-Mar-08 2:23
Rajkumar R6-Mar-08 2:23 
GeneralRe: template function instantiation Pin
George_George6-Mar-08 15:11
George_George6-Mar-08 15:11 
Generaliterator for deque Pin
George_George5-Mar-08 22:00
George_George5-Mar-08 22:00 
GeneralRe: iterator for deque Pin
Maximilien6-Mar-08 1:00
Maximilien6-Mar-08 1:00 
GeneralRe: iterator for deque Pin
George_George6-Mar-08 16:26
George_George6-Mar-08 16:26 
QuestionSelecting a folder from open dialog ???????? Pin
TooShy2Talk5-Mar-08 21:40
TooShy2Talk5-Mar-08 21:40 
GeneralRe: Selecting a folder from open dialog ???????? Pin
Rajkumar R5-Mar-08 21:48
Rajkumar R5-Mar-08 21:48 
GeneralRe: Selecting a folder from open dialog ???????? Pin
James R. Twine6-Mar-08 5:30
James R. Twine6-Mar-08 5:30 
GeneralProblem in Release Mode please look at the code. Pin
ritz12345-Mar-08 21:38
ritz12345-Mar-08 21:38 
AnswerRe: Problem in Release Mode please look at the code. Pin
Roger Stoltz5-Mar-08 22:59
Roger Stoltz5-Mar-08 22:59 
GeneralRe: Problem in Release Mode please look at the code. Pin
ritz12345-Mar-08 23:27
ritz12345-Mar-08 23:27 
AnswerRe: Problem in Release Mode please look at the code. Pin
Maxwell Chen6-Mar-08 1:24
Maxwell Chen6-Mar-08 1:24 
GeneralRe: Problem in Release Mode please look at the code. Pin
Roger Stoltz6-Mar-08 1:37
Roger Stoltz6-Mar-08 1:37 
GeneralRe: Problem in Release Mode please look at the code. Pin
ritz12346-Mar-08 17:12
ritz12346-Mar-08 17: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.