Originally Posted by johnsfine
Please use CODE tags, not QUOTE tags for the code you post.
You can make one template function for all classes. That function would work for any classes that have clear() methods and give compile time errors for those that don't.
That is the usual way that templates work in C++.
template <class Anything>
void func1(Anything &s)
If I understand correctly, your template only covers 'func1' while the OP has two different functions: 'func1', 'func2'.
The problem can, of course, be resolved trivially using a macro, but the OP requested a template solution.