On Tue, Sep 22, 2009 at 3:11 PM, Archie14
<admin@tradeplatform.us> wrote:
If a given class defines operator + and there is a vector of instances of that
class:
how I can use std::accumulate to count sum against this vector for the
elements that satisfy certain conditions?
class A
{
public:
A(useinsum) : _useinsum(useinsum) {};
bool useinsum() {return _useinsum;}
int operator + (int a) {return _i + a;}
private
bool _useinsum;
int _i;
}
std::vector<A> lst;
will that work?
std::accumulate(lst.begin(), lst.end(), 0, boost::lambda::bind(&A::useinsum,
boost::lambda::_1) == false)