|
Boost Users : |
Subject: Re: [Boost-users] ptr_vector sort usage
From: archie14 (admin_at_[hidden])
Date: 2010-08-05 11:36:38
Roman Perepelitsa <roman.perepelitsa <at> gmail.com> writes:
> class Compare
{
> public:
> Â Â Compare (int i) : _i(i){}
> Â Â //this does not compile, but what's the proper way to define
> Â Â // function object for the sort method in ptr_vector?
> Â Â bool operator<(const A& v1, const A& v2)
> Â Â {
> Â Â Â return (v1.i > v2.i) &&(_i != 1);
> Â Â }
...
};
>
> Try making your operator const:
> Â Â bool operator<(const A& v1, const A& v2) const
>
> Roman Perepelitsa.
No, it did not work. Complains that
binary 'operator <' has too many parameters
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