asOutputRange

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));
asOutputRange
(
E
S
)
(
ref S stream
)
if ()

Parameters

stream S

The stream to wrap.

Return Value

Type: auto

The output range.

Meta