std1.0.0-beta-7 SafeC docs

std :: collections::list

Struct std::List

#include <std/collections/list.h> source

generic<T> struct List {
    ?&heap struct ListNode<T> head;
    ?&heap struct ListNode<T> tail;
    unsigned long len;
    struct NodePool<struct ListNode<T>> pool;
}

Fields

§?&heap struct ListNode<T> headsource
§?&heap struct ListNode<T> tailsource
§unsigned long lensource
§struct NodePool<struct ListNode<T>> poolsource

Methods

§static struct List<T> new()source · definition

empty, no allocation

§int push_front(T value)source · definition

0 on OOM

§int push_back(T value)source · definition

0 on OOM

§?T pop_front()source · definition

null if empty

§?T pop_back()source · definition

null if empty

§?&T front() constsource · definition
§?&T back() constsource · definition
§unsigned long length() constsource · definition
§int is_empty() constsource · definition
§void clear()source · definition

drop every element

§void drop()source · definition

drops the elements, releases the nodes (Drop)

§void free() consumesource · definition

= drop()

§?&T find(const &T key, fn int(const &T, const &T) cmp) constsource · definition

cmp: <0, 0, >0 like strcmp; only == 0 matters here

§int contains(const &T key, fn int(const &T, const &T) cmp) constsource · definition
§int remove(const &T key, fn int(const &T, const &T) cmp)source · definition

drops the first match; 0 if none

§void foreach(fn void(&T) func)source · definition
§void reverse()source · definition