DArray.opIndex

Use an index to access the array.

  1. T opIndex(const size_t idx)
    struct DArray(T)
    pragma(inline, true) ref
    T
    opIndex
    @trusted
    (
    const size_t idx
    )
  2. const(T) opIndex(const size_t idx)

Examples

1 DArray!(int) fsa;
2 fsa.insertBack(1337);
3 fsa.insertBack(1338);
4 assert(fsa.length == 2);
5 
6 assert(fsa[0] == 1337);
7 assert(fsa[1] == 1338);
8 
9 void f(ref const(DArray!int) d) {
10 	assert(d[0] == 1337);
11 	assert(d[1] == 1338);
12 }
13 
14 f(fsa);

Meta