Boost logo

Boost Users :

Subject: Re: [Boost-users] how to Sort boost collection class using multi sorting options/criteria
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-08-10 11:27:08


AMDG

ch.asad_at_[hidden] wrote:
> Hi I am using boost collection class.
>
> I did sorting e.g apply a quick/bubble sort algo , but i want to do sorting
> using multiple criteria. how we can implement using boost.
> Do boost have any classes or functions through which I can easily sort the
> data using multiple options?
>

What do you mean by multiple options?

If you want to sort by f first and then by g, use
this formula to get a compound predicate:
h(x,y) = f(x,y) || (!f(y,x) && g(x,y))

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net