List<T>

class List<T: copyable>

A vectorized list of items.

Remarks

A List<T> wraps an array, copying elements in and out, and growing it as necessary.

All methods that accept indexes or ranges are safe to call with out-of-range values.

Lifecycle members

constructor

Initializes an empty list and remembers the allocator used for storage.

destructor

Releases the allocated element buffer, if any.

Instance members

void

Adds or inserts a single item.

void

Adds or inserts all items from an array.

void

Clears the list and optionally releases its buffer.

escaped T[]

Allocates a new array and copies a range of items into it.

escaped List<T>*

Allocates a new list and copies a range of items into it.

void

Copies a range of items into an existing array.

void

Ensures the buffer has at least the requested number of slots.

T*

Returns a pointer to an item in the backing buffer.

nuint

Returns the number of allocated item slots.

CharWriter

Returns a writer that appends characters to the list.

T

Returns the item at an index.

nuint
getLength()
property

Returns the number of items in the list.

nuint

Removes one item and returns 1 when an item was removed.

nuint

Removes a range and returns the number of items removed.

void

Replaces the item at an index.

void

Sorts the list in place using the supplied comparer.

escaped T[]

Transfers the used buffer span to the caller and empties the list.

Generated with campc v0.4.0-preview.1+d50446ef951a6ed675f7086cf093dbc993f0041b.