OutputRange

You will be acquainted with the use of OutputRange in this lesson.

We'll cover the following

Streamed element output

All of the range types that we have seen so far are about element access. OutputRange represents streamed element output, similar to sending characters to stdout.

As mentioned earlier, OutputRange requires support for the put(range, element) operation. put() is a function defined in the std.range module. It determines the capabilities of the range and the element at compile time and uses the most appropriate method to output the element.

put() considers the following cases in the order that they are listed below, and applies the method for the first matching case. R represents the type of the range; range, a range object. E represents the type of the element; and e an element of the range:

Get hands-on with 1200+ tech skills courses.