On Monday, September 21, 2015 20:46:51 Jack Stouffer via Digitalmars-d-learn
wrote:
> 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 e
On Monday, 21 September 2015 at 20:33:10 UTC, Jack Stouffer wrote:
That's ridiculous. Do I have to wrap my static arrays in
structs to get range primitives?
Is there an actual reason for this?
I had done basically the same thing. Below is my naive
implementation.
import std.traits;
impor
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, isForward
On Monday, 21 September 2015 at 20:33:10 UTC, Jack Stouffer wrote:
import std.range;
void main() {
int[6] a = [1, 2, 3, 4, 5, 6];
pragma(msg, isInputRange!(typeof(a)));
pragma(msg, isForwardRange!(typeof(a)));
pragma(msg, isRandomAccessRange!(typeof(a)));
}
$ dmd -run test.d
fa
On Monday 21 September 2015 22:33, Jack Stouffer wrote:
> import std.range;
>
> void main() {
> int[6] a = [1, 2, 3, 4, 5, 6];
>
> pragma(msg, isInputRange!(typeof(a)));
> pragma(msg, isForwardRange!(typeof(a)));
> pragma(msg, isRandomAccessRange!(typeof(a)));
> }
>
> $ dmd
On Monday, 21 September 2015 at 20:33:10 UTC, Jack Stouffer wrote:
pragma(msg, isInputRange!(typeof(a)));
try:
pragma(msg, isInputRange!(typeof(a[])));
Notice the addition of the [] after the a. That's the slicing
operator and it will yield a range.
Is there an actual reason for
On Monday, 21 September 2015 at 20:33:10 UTC, Jack Stouffer wrote:
import std.range;
void main() {
int[6] a = [1, 2, 3, 4, 5, 6];
pragma(msg, isInputRange!(typeof(a)));
pragma(msg, isForwardRange!(typeof(a)));
pragma(msg, isRandomAccessRange!(typeof(a)));
}
$ dmd -run test.d
fa
import std.range;
void main() {
int[6] a = [1, 2, 3, 4, 5, 6];
pragma(msg, isInputRange!(typeof(a)));
pragma(msg, isForwardRange!(typeof(a)));
pragma(msg, isRandomAccessRange!(typeof(a)));
}
$ dmd -run test.d
false
false
false
That's ridiculous. Do I have to wrap my static arra