29 explicit Accumulator(T t = T()) : fAccumulator(t) {}
31 T operator()(T t) {
return (fAccumulator += t); }
33 T operator()()
const {
return fAccumulator; }
41 std::vector<int> v(3);
46 a = std::for_each(v.begin(), v.end(), a);
47 std::cout <<
make_range(v) <<
" sum: " << a() << std::endl;
Range (see also boost Range library)
Range< Iter > make_range(Iter it1, Iter it2)