Boost logo

Boost Users :

From: Meryl Silverburgh (silverburgh.meryl_at_[hidden])
Date: 2007-02-10 00:45:19


David,

Thank you.

On 2/9/07, David Klein <dave_chp_at_[hidden]> wrote:
> Meryl Silverburgh wrote:
> > Hi,
> >
> > I have code like this which sort a Rect, which compare value of
> > getY(), like this:
> >
> > vector<Rect*> rl;
> >
> > ::sort(rl.begin(), rl.end(), bind(less < int >(),
> > bind(&Rect::getY, _1), bind(&Rect::getY, _2)));
> >
> > how can I change it so that it compares with the 'y' attribute? like,
> > rect1.y < rect2.y?
> >
> > Thank you.
> > _______________________________________________
> > Boost-users mailing list
> > Boost-users_at_[hidden]
> > http://lists.boost.org/mailman/listinfo.cgi/boost-users
> >
> >
> Hi Meryl,
>
> well, just replace &Rect::getY with &Rect::y :)
>
> sort(
> rl.begin(),
> rl.end(),
> bind(
> less<int>(),
> bind(&Rect::y, _1),
> bind(&Rect::y, _2)
> )
> );
>
> --
> HTH dave
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


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