Boost logo

Boost Users :

From: John.Wismar_at_[hidden]
Date: 2003-11-30 16:22:15


Here's the situation I'm trying to remedy, boiled down:

class A
{
public:
    int size() const;
};

class B
{
public:
    int stretch_it(int size) const;
    int get_total() const;
private:
    std::vector<A> myVec;
};

int B::get_total() const
{
    int retVal = 0;
    for (std::vector<A>::const_iterator it = myVec.begin(); it != myVec.end
(); ++it)
    {
        retVal += stretch_it(it->size());
    }
    return retVal;
}

I'd love to use std::accumulate() or equivalent instead of a hand-coded
loop, but I don't know if it's possible to specify a combination of
operations like I have here.... Or if the result would be readable!

Any suggestions would be much appreciated!

---------------------
John Wismar
john.wismar_at_[hidden]


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