Boost logo

Boost :

Subject: Re: [boost] [review] Formal review period for Sort library continuing through November 19
From: Phil Endecott (spam_from_boost_dev_at_[hidden])
Date: 2014-11-17 07:21:45


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.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk