Why are static arrays not ranges?

Jack Stouffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Sep 21 13:46:51 PDT 2015


On Monday, 21 September 2015 at 20:39:55 UTC, Jesse Phillips 
wrote:
> A static array has a constant length, so it is not possible to 
> popFront on a static array.
>
> Making a dynamic array from it is easy, just slice it with []:
>
>      pragma(msg, isInputRange!(typeof(a[])));
>      pragma(msg, isForwardRange!(typeof(a[])));
>      pragma(msg, isRandomAccessRange!(typeof(a[])));

Thanks for all of the replies. I was under the impression that 
the slicer allocated GC, but some tests show that's not true.


More information about the Digitalmars-d-learn mailing list