InPlaceAppender

Undocumented in source.

Members

Aliases

opOpAssign
alias opOpAssign(string op : "~") = put

Appends to the managed array.

Functions

clear
void clear()

Clears the managed array. This allows the elements of the array to be reused for appending.

put
void put(U item)

Appends item to the managed array. Performs encoding for char types if A is a differently typed char array.

put
void put(Range items)

Appends an entire range to the managed array. Performs encoding for char elements if A is a differently typed char array.

shrinkTo
void shrinkTo(size_t newlength)

Shrinks the managed array to the given length.

toString
auto toString()

Gives a string in the form of Appender!(A)(data).

Examples

auto app = appender!string();
string b = "abcdefg";
foreach (char c; b)
    app.put(c);
assert(app[] == "abcdefg");

int[] a = [ 1, 2 ];
auto app2 = appender(a);
app2.put(3);
assert(app2.length == 3);
app2.put([ 4, 5, 6 ]);
assert(app2[] == [ 1, 2, 3, 4, 5, 6 ]);

Meta