C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

templates

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
major
Guest





PostPosted: Sun Feb 26, 2006 5:06 pm    Post subject: templates Reply with quote



Hi all,
I have a function like:

template <typename T>
void f (){
T a;
....
}

how to call it in the main?
of course that gives error:

int main(){
...
f();
...

}


many thanks,
Mauro
Back to top
TB
Guest





PostPosted: Sun Feb 26, 2006 5:06 pm    Post subject: Re: templates Reply with quote



major skrev:
Quote:
Hi all,
I have a function like:

template <typename T
void f (){
T a;
....
}

how to call it in the main?
of course that gives error:

int main(){
...
f();
...

f<int>();

Quote:

}


--
TB @ SWEDEN
Back to top
JE
Guest





PostPosted: Sun Feb 26, 2006 5:06 pm    Post subject: Re: templates Reply with quote



major wrote:
Quote:
Hi all,
I have a function like:

template <typename T
void f (){
T a;
....
}

how to call it in the main?
of course that gives error:

int main(){
...
f();
...

}


many thanks,
Mauro

http://www.parashift.com/c++-faq-lite/templates.html#faq-35.3

While you're there, the rest of the FAQ makes very good reading. Wink
Back to top
major
Guest





PostPosted: Sun Feb 26, 2006 6:06 pm    Post subject: Re: templates Reply with quote

JE wrote:

Quote:
While you're there, the rest of the FAQ makes very good reading. Wink

yep, I'm a bit rusty Sad
Back to top
major
Guest





PostPosted: Sun Feb 26, 2006 6:06 pm    Post subject: Re: templates Reply with quote

TB wrote:

Quote:
f<int>();

tnx Wink
Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.