List

Generic doubly-linked list

It

List container object

struct It {
  std::list<T> handle
};

add

Append a value to the end of the list

U0 add(List<T> list, T value);

Parameters

  • list — Target list
  • value — Value to append

addAt

Insert a value at a specific index

U0 addAt(List<T> list, T value, I32 index);

Parameters

  • list — Target list
  • value — Value to insert
  • index — Zero-based position

remove

Remove the first matching value from the list

U8 remove(List<T> list, T value);

Parameters

  • list — Target list
  • value — Value to find and remove

Returns — Non-zero if element was found and removed


removeAt

Remove the element at a specific index

U0 removeAt(List<T> list, I32 index);

Parameters

  • list — Target list
  • index — Zero-based position to remove

get

Get a pointer to the element at a specific index

T* get(List<T> list, I32 index);

Parameters

  • list — Target list
  • index — Zero-based position

Returns — Pointer to the element


set

Set the value of an element at a specific index

U0 set(List<T> list, I32 index, T value);

Parameters

  • list — Target list
  • index — Zero-based position
  • value — New value

first

Get a pointer to the first element

T* first(List<T> list);

Parameters

  • list — Target list

Returns — Pointer to first element, or NULL if empty


last

Get a pointer to the last element

T* last(List<T> list);

Parameters

  • list — Target list

Returns — Pointer to last element, or NULL if empty


size

Get the number of elements in the list

U64 size(List<T> list);

Parameters

  • list — Target list

Returns — Element count


clear

Remove all elements from the list

U0 clear(List<T> list);

Parameters

  • list — Target list