List<T>

class List<T>

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.

T[]

Returns a borrowed view of a range of items.

escaped T[]

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

bool

Reports whether the index is in range and writes the item to result. An item that is itself unspecified (a List<int?> entry) still counts as present.

Generated with campc 0.14.0-preview.1.