It is often desirable to add certain indentation strings at the start of each line of output of a program. A straight-forward application of this is parallel programming where it can be used to separate the output of the different processes involved.
Is there a standard method using output streams to do this
(e.g. using manipulators?).
Another way to do this is to derive a class ofstream_with_indent from ofstream, and to redefine the appropriate functions. The problem with this approach is that we do not know which functions to redefine and how.
The solution must be such that no existing code must be be rewritten (e.g. many classes already have their own ostream& operator<<).