http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49734

--- Comment #3 from MaratIK <marat.buharov at gmail dot com> 2011-07-13 
15:23:52 UTC ---
(In reply to comment #2)

>     int acc = std::accumulate(c, c + 5, 0);

Thanks. I used overloaded std::accumulate with BinaryOperation (Adder) because
indices for c are in l.

---
struct Adder {
    int *cv;
    Adder(int *c) : cv(c) {}
    int operator()(int x, int y) { return x + cv[y]; }
};
---
int acc = std::accumulate(l, l + 5, 0, Adder(c));
---

With lambda it will be simpler

Reply via email to