Possible Duplicate:
Sorting a vector of objects by a property of the object
I have a structure like below:
strcut Point
{
int x;
int y;
int z;
};
I also have a generic sorting function for integers:
void sort(vector<int>);
In my program, I need to sort an array of points std::vector frequently using different fields (i.e. x, y, or z). What can I do to convert an array of Points into an an array of integers efficiently?