is array an InputRange?
Jesse Phillips
Jessekphillips+D at gmail.com
Fri Oct 5 15:06:41 PDT 2012
On Friday, 5 October 2012 at 13:39:56 UTC, ref2401 wrote:
> import std.range;
>
> int[] numbers = [1, 3, 5, 7, 9, 11];
>
> auto rangeObject = inputRangeObject(numbers);
> auto inputRange = cast(InputRange!(int[]))rangeObject;
>
> why does 'inputRange' equal null?
On another note to what others said. An array is only a range
when std.array has been imported (or passed to a module expecting
a range which imports std.array).
A range is only a concept, it can not be be stored in an input
range variable. inputRangeObject is rarely needed and I can't
give an example of when it would be.
More information about the Digitalmars-d-learn
mailing list