|
Boost Users : |
Subject: Re: [Boost-users] ptr_vector sort usage
From: Roman Perepelitsa (roman.perepelitsa_at_[hidden])
Date: 2010-08-05 10:03:35
2010/8/5 archie14 <admin_at_[hidden]>
> 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);
> }
> private:
> int _i;
> };
Try making your operator const:
bool operator<(const A& v1, const A& v2) *const*
Roman Perepelitsa.
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