P
Pär Buschka
Hi there.
I have some template functions that operate on different types of object. If
the object has a certain memberfunction I want to call that function, and if
not, I want to call a global function that operates on that object.
Some pseudocode to show what I mean:
template<class T> void Function(T& MyObject)
{
if exist MyObject.Process() then MyObject.Process();
else GlobalProcess(MyObject);
}
is there a good way to do this without having to write a lot of overloaded
functions for one of the cases?
Thanks in advance
Pär Buschka
I have some template functions that operate on different types of object. If
the object has a certain memberfunction I want to call that function, and if
not, I want to call a global function that operates on that object.
Some pseudocode to show what I mean:
template<class T> void Function(T& MyObject)
{
if exist MyObject.Process() then MyObject.Process();
else GlobalProcess(MyObject);
}
is there a good way to do this without having to write a lot of overloaded
functions for one of the cases?
Thanks in advance
Pär Buschka