is an array of elements of type E
an InputRange
import std.range; static assert(isInputRange!(typeof(asInputRange("hello")))); void testrange(string f, string result) { char[50] s; int i; foreach (c; f.asInputRange()) { s[i++] = c; } assert(s[0 .. i] == result); } testrange("file", "file"); { // various boundary conditions auto r = "foo".asInputRange; assert(!r.empty); assert(!r.empty); r.popFront(); r.popFront(); r.popFront(); assert(r.empty); }
Turn an array into an InputRange, useful for unittesting.