![]() |
Template Questions
I just have a few questions about templates. I will just use the following class as an example to use for my questions:
:
template <class T>My second question is if I have to keep the implementation of my functions in the same file, would there be a point to still define it outside if the class definition like I have shown above, or should I just define it inside the class? Thanks. |
Too tired to phrase an intelligent answer to the first but this link seems to do a good job at explaining the details.
On the second question, well for your example it is largely just a matter of taste, but again the mentioned link goes more into the specifics. |
can't give any cool details...BUT i've been told that when you use templates the declarations and definitions need to be in one file.
the reason you find weird shit like this is that C++ is not a ground-up new language. it's a wrapper for C. so add-on crap like templates involves weird shit so they don't have to rewrite the whole compiler. you just gotta live with it. good luck! |
Thanks for the info guys. Is there any difference at all if I define the function inline or outside of the class definition?
|
| All times are GMT -5. The time now is 2:03 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC