I have a function that differs in only one real way for various methods. How it sorts input. For example if you want the lowest 2 points on the face of a object it finds all objects in the face and sorts them by Y. If you want the farthest in an X or Z axis direction it sorts by that.
I would like to pass to the function the sort method to be passed to sort.
so like
int CompareY(int first, int second)
{
....
}
later i’ll use that method via
facevertices.sort(CompareY)
the thing is i’d like to be able to do something like
int mymethod(void sortmethod)
{
facevertices.sort(sortmethod)
}
and then be able to pass it compareY or compareZ or compareX as the sort method.
is that possible to pass a function itself?