C++ Language/Std/Stl/Algorithms/ApplyingItemByItem/IgnoringPriorValues

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Unlike the DoubleEach() example, this function ignores existing item-values: int Compute99() { return 99; }. The algorithm to use it is std::generate(v.begin(), v.end(), Compute99).

Additional information about item-by-item processing that ignores prior values (includes interactive examples)