I have a template class that has a -template function that takes a pointer to the same class as the first argument, for example:
template<class T>
class Foo{
void f(Foo* foo){}
}
When I use it in my main function, everything works until I use another template for the argument.
int main(){
Foo<double> f1;
Foo<double> f2;
f1.f(&f2);
Foo<bool> f3;
f1.f(&f3);
}
Apparently the only function defined here is Foo<T>::f(Foo<T>*)
Is there any way to determine f
which the "generic" template accepts Foo
, so that I can use it with any other type?
source
share