Skip to content

Commit

Permalink
Adding enums to avoid risk of GC allocation
Browse files Browse the repository at this point in the history
Adding enums to avoid risk of GC allocation
  • Loading branch information
jmh530 authored Jul 27, 2016
1 parent 5b14ca7 commit 97efba1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions std/experimental/ndslice/selection.d
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,10 @@ template pack(K...)
auto a = r.sliced(3, 4, 5, 6);
auto b = a.pack!2;

assert(b.shape == [3, 4]);
assert(b[0, 0].shape == [5, 6]);
enum res1 = [3, 4];
enum res2 = [5, 6];
assert(b.shape == res1);
assert(b[0, 0].shape == res2);
assert(a == b);
static assert(is(typeof(b) == typeof(a.pack!2)));
static assert(is(typeof(b) == Slice!(2, Slice!(3, typeof(r)))));
Expand Down

0 comments on commit 97efba1

Please sign in to comment.