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
    int size() const;

class B
    int stretch_it(int size) const;
    int get_total() const;
    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

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at