By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,544 Members | 2,065 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,544 IT Pros & Developers. It's quick & easy.

templates

P: n/a
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

Feb 26 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
TB
major skrev:
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>();

}


--
TB @ SWEDEN
Feb 26 '06 #2

P: n/a
JE
major wrote:
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-lit....html#faq-35.3

While you're there, the rest of the FAQ makes very good reading. ;)

Feb 26 '06 #3

P: n/a
TB wrote:
f<int>();


tnx ;-)

Feb 26 '06 #4

P: n/a
JE wrote:
While you're there, the rest of the FAQ makes very good reading. ;)


yep, I'm a bit rusty :-(

Feb 26 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.