The OpenD Programming Language

appender

Convenience function that returns an Appender instance, optionally initialized with array.

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

Examples

auto w = appender!string;
// pre-allocate space for at least 10 elements (this avoids costly reallocations)
w.reserve(10);
assert(w.capacity >= 10);

w.put('a'); // single elements
w.put("bc"); // multiple elements

// use the append syntax
w ~= 'd';
w ~= "ef";

assert(w[] == "abcdef");

Meta