Wraps an existing output stream as a Phobos-style output range with a
put method, to make any output stream compatible with functions that take
output ranges. The given stream is stored as a pointer in the underlying
range implementation, so you should still manage ownership of the original
stream.
import std.range.primitives : isOutputRange;
import streams;
auto stream = ArrayOutputStream!int();
auto range = asOutputRange!int(stream);
assert(isOutputRange!(typeof(range), int));
Wraps an existing output stream as a Phobos-style output range with a put method, to make any output stream compatible with functions that take output ranges. The given stream is stored as a pointer in the underlying range implementation, so you should still manage ownership of the original stream.