Re: Template Functions


[ Follow Ups ] [ Post Followup ] [ CS2704 Web Discussion Board ] [ FAQ ]

Posted by Daniel Longest on March 20, 2001 at 00:42:28:

In Reply to: Template Functions posted by Juan Romero Jr. on March 19, 2001 at 22:17:52:

You would declare a template member function just like you template the class, say template and then put the function. I believe there's a bug in VC++ where you *MUST* define the body of the function inside the class definition. Defining the function outside of the class definition, even if the func. def. is inlined, will cause errors.

Daniel

: We talked a little about template functions, but I had a question about their use-

: Can they only be used as non-member functions? Or is there a way to use them inside a class (especially a non-templated class)

: Example:
: class ApplesandOranges {
: /* data members*/
: public:
: Tank();
: template void Delete(T& todel);
: };

: And if the answer is no, is there an alternative method?




Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ CS2704 Web Discussion Board ] [ FAQ ]