template < class F > class ClassTemp { public: F test(F* feature ); }; template < class F > F ClassTemp < F > ::test(F* feature) { return *feature; }; ClassTemp < char > myInst; int main() { char c = 'c'; char ret = myInst.test(&c); }
Note: since the compiler replaces the templates, source code of the templates needs to be included where it is used (template source code in the .h for ex).
.
No comments:
Post a Comment