List
Parameters
[DType = Dynamic]
Represents a list of items of type DType. Memory is a contiguous block of memory enough to hold the number of items in the list or more. Items can be added to and removed from the list and the underlying memory will be adjusted accordingly. This list is not thread safe.
graph BT
N1["List[DType]"] -->|inherits| N2["RandomModifiableIterable[DType]"];
Characteristics
Quality | Value |
---|---|
Inherits | RandomModifiableIterable[DType] |
Extends | N/A |
Decorators | #sealed; |
Is enum | false |
Is sealed | true |
Is extern | false |
Subscript
[s Self, index Len] -> @DType
access the item at index
. If index
is out of bounds an exception of type IndexOutOfRangeException
will be raised.
Methods
construct
construct (s Self, capacity Len = 0) -> Self
copy
copy (s Self) -> strictly SelfType
get_element_ptr
#Gambol.function.alwaysinline
get_element_ptr (s Self, index Len) -> PointerToVariable[DType]
index
. if index is out of bounds an exception of type IndexOutOfRangeException
will be raised
get_element_ptr_unchecked
#Gambol.function.alwaysinline
get_element_ptr_unchecked (s Self, index ULen) -> PointerToVariable[DType]
index
without checking if index
is in bounds
len
#Gambol.function.alwaysinline
#strict
len (s Self) -> Len
get_iterator
get_iterator (s Self) -> ListBidirectionalModifiableIterator[Self]
get_reverse_iterator
get_reverse_iterator (s Self) -> ListBidirectionalModifiableIterator[Self, -1]
get_random_iterator
get_random_iterator (s Self) -> ListRandomModifiableIterator[Self]
get_unchecked
#Gambol.function.alwaysinline
get_unchecked (s Self, index ULen) -> @DType
index
without bounds checking
set_unchecked
#Gambol.function.alwaysinline
set_unchecked (s Self, value @DType, index ULen) -> Nil
index
without bounds checking
slice
slice (s Self, range IndexRange) -> SelfType
range
fill_with
fill_with (s Self, value @DType, range IndexRange) -> Nil
range
to the given value
push
push (s Self, value @DType, count: ULen = 1) -> Nil
add
add
add (s Self, value @DType, count: ULen = 1) -> Nil
value
count
number of items to the end of the list
extend
extend (s Self, other nom Iterable[DType]) -> Nil
other
to the end of this list
insert
insert (s Self, value @DType, index Len, count: ULen = 1) -> Nil
count
number of value
s at the specified index pushing other elements aside
insert_all
insert_all (s Self, other nom Unpackable[DType], index Len) -> Nil
other
at the specified index pushing other elements aside
swap_unchecked
#Gambol.function.alwaysinline
swap_unchecked (s Self, a_index Len, b_index Len) -> Nil
erase
erase (s Self, index Len, count: Len = 1) -> Nil
count
number of elements at index
and resize the list
remove
remove (s Self, val DType, range: IndexRange = IndexRange(), count: Len = 1) -> Nil
val
within the specified range
up to count
number of times
pop
pop (s Self, count: Len = 1) -> DType
count
items from the list
clear
clear (s Self) -> Nil
str
str (s Self, delimiter: String = `, `, quote_begin: String = ```, quote_end: String = ```, enclose_begin: String = `[`, enclose_end: String = `]`) -> String
__list_init
__list_init (s Self, capacity Len = 0) -> Self
__list_drop
__list_drop (s Self) -> Nil
__resize
__resize (s Self, new_len Len) -> Nil
__allocate
__allocate (s Self, len Len) -> Nil
Binary Operators
is in
is in (s Self, value @DType) -> Bool
==
== (s Self, o Self) -> Bool
Properties
kMinCapacity
const global kMinCapacity Len = 10
__1_ptr
__1_ptr PointerToVariable[DType]
__2_len
__2_len Len
__3_capacity
__3_capacity Len
__has_atomic_memory
__has_atomic_memory Bool