A
antani
I need to implement a function with a argument that is a compare
function.
This compare function must be several for every necessity.
For example , I would like a compare function to analyze element of
list that are even or a compare function to analyze odd element.
example:
void f (compare )
{
list<int> l;
list<int>::iterator it;
for (it=l.begin();l!=l.end();++it)
{
if ( compare(it) )
{
....
}
}
}
I would like specify in my call, what type of compare function the
function f must use.
Exist a template solution for that?
function.
This compare function must be several for every necessity.
For example , I would like a compare function to analyze element of
list that are even or a compare function to analyze odd element.
example:
void f (compare )
{
list<int> l;
list<int>::iterator it;
for (it=l.begin();l!=l.end();++it)
{
if ( compare(it) )
{
....
}
}
}
I would like specify in my call, what type of compare function the
function f must use.
Exist a template solution for that?