Wolfgang Thallergcc 15.1.0ada185d1 year agoHistory
32 lines · 711 B · D
RawDownload
@safe unittest{    import std.range.interfaces;     import std.algorithm.iteration : map;    import std.range : iota;     void useRange(InputRange!int range) {        // Function body.    }     // Create a range type.    auto squares = map!"a * a"(iota(10));     // Wrap it in an interface.    auto squaresWrapped = inputRangeObject(squares);     // Use it.    useRange(squaresWrapped);} @safe unittest{    import std.range.interfaces;      import std.array;     auto app = appender!(uint[])();     auto appWrapped = outputRangeObject!(uint, uint[])(app);     static assert(is(typeof(appWrapped) : OutputRange!(uint[])));     static assert(is(typeof(appWrapped) : OutputRange!(uint)));} 

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t