470,833 Members | 1,634 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,833 developers. It's quick & easy.

templates

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
4 2623
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
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
TB wrote:
f<int>();


tnx ;-)

Feb 26 '06 #4
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.

Similar topics

5 posts views Thread by Tom Alsberg | last post: by
22 posts views Thread by E. Robert Tisdale | last post: by
12 posts views Thread by Fabio De Francesco | last post: by
2 posts views Thread by jimbo_vr5 | last post: by
25 posts views Thread by Ted | last post: by
104 posts views Thread by JohnQ | last post: by
7 posts views Thread by Chris | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.