IndexedArray

Statically-Sized Array of ElementType E indexed by I. TODO: assert that I is continuous if it is a enum.

Alias This

_r

Members

Aliases

Index
alias Index = I
Undocumented in source.
R
alias R = E[I.max + 1]
Undocumented in source.

Mixins

__anonymous
mixin _genIndexAndSliceOps!I
Undocumented in source.

Variables

_r
R _r;
Undocumented in source.

Mixed In Members

From mixin _genIndexAndSliceOps!I

at
auto ref at()

Get element at compile-time index i.

opIndex
auto ref opIndex(I i)

Get element at index i.

opIndexAssign
auto ref opIndexAssign(V value, I i)

Set element at index i to value.

opSlice
auto ref opSlice(I i, I j)
Undocumented in source. Be warned that the author may not have intended to support it.
opSliceAssign
auto ref opSliceAssign(V value, I i, I j)
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

enum N = 7;
enum I { x = 0, y = 1, z = 2}
alias E = int;
alias A = IndexedArray!(E, I);
static assert(A.sizeof == 3*int.sizeof);
A x;
x[I.x] = 1;
x[I.y] = 2;
x[I.z] = 3;
static assert(!__traits(compiles, { x[1] = 3; })); // no integer indexing

Meta