Understanding std::accumulate
You’re making a mistaken assumption: that type T is of the same type as the InputIterator. But std::accumulate is generic, and allows all different kinds of creative accumulations and reductions. Example #1: Accumulate salary across Employees Here’s a simple example: an Employee class, with many data fields. class Employee { /** All kinds of data: … Read more