RE: coding rules for template classes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Rolf,

Your questions are off topic for this forum.

> Does someone know of good coding rules for template classes, other than "put all in the .h file"?

Look here...
http://www.parashift.com/c++-faq-lite/templates.html

> If a template declaration is separated from the definition as to deliver declaration only to the user how will the definition get compiled to code?

It won't.  The declaration+definition of a template is different from the instantiation of a template.

It would be like saying "I want to have 'inline int DoSomething(int, int);' declaration in the header for delivery to the user, but the definition elsewhere where the user can't see it.  How will the definition get compiled (instantiated) to the user's code?"

> Do I need a third "instantiation" file?  Is there some literature about this around?

There is something like this, but it doesn't do what you want.  And it isn't supported very well by C++ compiler vendors in general, so tends to be used infrequently.

For GCC, look here...
http://gcc.gnu.org/onlinedocs/gcc/Template-Instantiation.html

HTH,
--Eljay


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux