Reputation: 103
I have the following generic methods of sorting:
template< typename T > void SortMethod_1( T i, T j )
{
...
}
template< typename T > void SortMethod_2( T i, T j )
{
...
}
And I would like to implement another test method that receives a pointer to any of the above methods. For example,
void TestingSortMethod( argument_1, argument_2, void (* AnyGenericSortMethod)... )
{
...
}
How I do it?
How I call it?
Upvotes: 0
Views: 69
Reputation: 272497
It sounds like you want your test function to be a function template as well:
template <typename T>
void TestingSortMethod(
T argument_1,
T argument_2,
void (* AnyGenericSortMethod)(T,T))
{
...
}
Upvotes: 6