| View previous topic :: View next topic |
| Author |
Message |
major Guest
|
Posted: Sun Feb 26, 2006 5:06 pm Post subject: 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 |
|
| Back to top |
|
 |
TB Guest
|
Posted: Sun Feb 26, 2006 5:06 pm Post subject: Re: templates |
|
|
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>();
--
TB @ SWEDEN |
|
| Back to top |
|
 |
JE Guest
|
Posted: Sun Feb 26, 2006 5:06 pm Post subject: Re: templates |
|
|
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.  |
|
| Back to top |
|
 |
major Guest
|
Posted: Sun Feb 26, 2006 6:06 pm Post subject: Re: templates |
|
|
JE wrote:
| Quote: | While you're there, the rest of the FAQ makes very good reading.
|
yep, I'm a bit rusty  |
|
| Back to top |
|
 |
major Guest
|
Posted: Sun Feb 26, 2006 6:06 pm Post subject: Re: templates |
|
|
TB wrote:
tnx  |
|
| Back to top |
|
 |
|