I want to have a template function that is a member of a class. Is this possible? This code snippet is how I would think the syntax would go, although it doesn't compile. How would I achieve the same effect?
Code:class myclass { public: int member ; } ; template <typename T> void myclass::func( T& arg ) { T = member ; } int main() { myclass instance ; instance.member = 0 ; int copy ; instance.func<int>(copy) ; double copy2 ; instance.func<double>(copy2) ; }