582484 Algorithm Libraries
Exercise 4
- wed 15.2.2006 10-12 | B119
- wed 15.2.2006 16-18 | B119
- Write variants of the reverse_word_order algorithm
from Exercise 2 (see solution) so that the instead
of a single separator value the algorithm gets
- a range of values, all of which are separators.
- a unary predicate for recognizing separators.
- Use for_each to add a newline character '\n' to the end
every string in a container of strings.
- Write your own functor.
- Use only standard functor adaptors (Hint: push_back).
- Write a unary functor that as an argument to the transform
algorithm transforms a value into the average of the value and
the last few values before it.
This achieves a similar (but not identical) smoothing
effect as the smooth_iterator from Exercise 1.