From: Stephan T. Lavavej (stl_at_[hidden])
Date: 2004-05-08 08:52:39
>  Strictly taken, the C++ standard defines for_each as a
> non-modifying sequence operation, and the function object
> passed to for_each should not modify its argument. The
> requirements for the arguments of for_each are unnecessary
> strict, since as long as the iterators are mutable, for_each
> accepts a function object that can have side-effects on their
> argument. Nevertheless, it is straightforward to provide
> another function template with the functionality
> of std::for_each but more fine-grained requirements for its
This is incorrect, as well as having a typo.
for_each is described as "non-modifying" in the Standard because it does not
inherently modify sequences (contrast copy() and friends). However, the
functor it takes can mutate its argument.
This footnote must be removed.
Stephan T. Lavavej
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk