Boost logo

Boost :

From: Giovanni Piero Deretta (gpderetta_at_[hidden])
Date: 2007-03-13 12:01:52


On 3/13/07, Paul Giaccone <paulg_at_[hidden]> wrote:
> Sam Schetterer wrote:
> > This sorting library would have quicksorts, radix quicksorts,
> > radixsorts, mergsorts, a sorted-array class, and an interface class to
> > be inherited from to allow sorting.
>
> Most users, on finding they need to sort data, use something someone
> else has already written, such as the sort functions available in the
> STL. What could your library offer that this does not?
> [...]
> A wish-list of ideas:
>
> * Sorting into reverse order or forwards order
> * Allowing the user to choose the "less-than" operator (as the STL sorts
> already do)
> * A "sort by" function:
>
> class X
> {
> std::string name;
> int age;
> float height;
> }
>
> X array[10];
>
> //set members of elements of arrays here...
>
> sort_by(array, age); //sorts the array by age
>
> //then, later on
> sort_by(array, height);

Aren't all of these trivial applications of bind?

>
> * A "sort within sort" function:
>
> sort_by(array, name, age); //sort array by name, and then sort
> within name by age
>

Isn't sort + stable sort enough?

Do we really need specialized interfaces for these?

gpd


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