Skip to content

Instantly share code, notes, and snippets.

@scheibo
Created March 30, 2011 03:33
Show Gist options
  • Select an option

  • Save scheibo/893818 to your computer and use it in GitHub Desktop.

Select an option

Save scheibo/893818 to your computer and use it in GitHub Desktop.
int qsort_cmp ( const void * elem1, const void * elem2 ) {
int y_diff = (*(Point **)elem1)->y() - (*(Point **)elem2)->y();
return (y_diff != 0 ? y_diff : (*(Point **)elem1)->x() - (*(Point **)elem2)->x() );
}
vector< Point* > points(n,NULL);
qsort(&points[0] , n, sizeof(Point*), qsort_cmp );
11 minutes ago · Like ·
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment