appender

Convenience function that returns a RefAppender instance initialized with arrayPtr. Don't use null for the array pointer, use the other version of appender instead.

  1. Appender!A appender()
  2. Appender!(E[]) appender(A array)
  3. RefAppender!(E[]) appender(P arrayPtr)
    appender
    (
    P : E[]*
    E
    )

Examples

int[] a = [1, 2];
auto app2 = appender(&a);
assert(app2[] == [1, 2]);
assert(a == [1, 2]);
app2 ~= 3;
app2 ~= [4, 5, 6];
assert(app2[] == [1, 2, 3, 4, 5, 6]);
assert(a == [1, 2, 3, 4, 5, 6]);

app2.reserve(5);
assert(app2.capacity >= 5);

Meta