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