Should formattedWrite take the outputrange by ref?
anonymous
anonymous at example.com
Sat Jan 18 14:45:01 PST 2014
On Saturday, 18 January 2014 at 21:55:54 UTC, Tobias Pankrath
wrote:
> I want to print a tree structure and need to keep track of the
> indention for different parts of the tree. My idea was to write
> a generic wrapper for an output range that outputs tabs when it
> encounters a newline. This wrapper has internal state and if I
> want to use formattedWrite with this wrapper than state changes
> don't propagate to the calling context because by value
> semantics.
>
> Short solution: I'm using a class now.
Alternatively, pass a pointer: formattedWrite(&writer, ...)
More information about the Digitalmars-d-learn
mailing list