operator<
123456789
struct point_t { double x; double y; bool operator<(point_t& rhs) { return (x*x+y*y) < (rhs.x*rhs.x + rhs.y*rhs.y); } } *arr; std::sort(arr, arr+size);