All pastes #34712 Raw Edit

Untitled

public text v1 · immutable
#34712 ·published 2005-12-23 16:24 UTC
rendered paste body
#include<algorithm>
#include<functional>
#include<iostream>
#include<numeric>
#include<vector>

class A
{
private:

public:
    int one() const { return 1; }
};

int
foo(const int &x, const A &a)
{
    return x + a.one();
}

int
main()
{
    std::vector<A> v;

    v.push_back(A());
    v.push_back(A());

    std::cout << std::accumulate(v.begin(), v.end(), 0, foo) << std::endl;

    return 0;
}