17 Nov
2014
17 Nov
'14
12:21 p.m.
Steven Ross wrote:
If std::sort can sort it, so can string_sort if you use the available functors properly.
How about: bool compare_distance_from_origin(point& a, point& b) { return sqr(a.x)+sqr(a.y) < sqr(b.x)+sqr(b.y); } std::sort(points.begin(),points.end(),&compare_distance_from_origin); To me, it's clear that there are many kinds of sort where a radix sort can't be used. An interesting borderline case would be case-insensitive sorting; have you tried doing that? Regards, Phil.