package core:slice

⌘K
Ctrl+K
or
/

    Types

    Map_Entry ¶

    Map_Entry :: struct($Key: typeid, $Value: typeid) where intrinsics.type_is_valid_map_key(Key) {}

    Map_Entry_Info ¶

    Map_Entry_Info :: struct($Key: typeid, $Value: typeid) where intrinsics.type_is_valid_map_key(Key) {}

    Ordering ¶

    Ordering :: enum int {
    	Less    = -1, 
    	Equal   = 0, 
    	Greater = 1, 
    }
    Related Procedures With Returns

    Constants

    This section is empty.

    Variables

    This section is empty.

    Procedures

    all_of ¶

    all_of :: proc(s: $T/[]$T, value: $T) -> bool {…}

    all_of_proc ¶

    all_of_proc :: proc(s: $T/[]$T, f: proc(_: $T) -> bool) -> bool {…}

    any_of ¶

    any_of :: proc(s: $T/[]$T, value: $T) -> bool {…}

    any_of_proc ¶

    any_of_proc :: proc(s: $T/[]$T, f: proc(_: $T) -> bool) -> bool {…}

    as_ptr ¶

    as_ptr :: proc(array: $T/[]$T) -> [^]$T {…}
    binary_search :: proc(array: $T/[]$T, key: $T) -> (index: int, found: bool) {…}

    bytes_from_ptr ¶

    bytes_from_ptr :: proc "contextless" (ptr: rawptr, byte_count: int) -> []u8 {…}
     

    Turn a pointer and a length into a byte slice.

    clone ¶

    clone :: proc(a: $T/[]$T, allocator := context.allocator) -> ([]$T, runtime.Allocator_Error) #optional_ok {…}
     

    copies a slice into a new slice

    clone_to_dynamic ¶

    clone_to_dynamic :: proc(a: $T/[]$T, allocator := context.allocator) -> ([dynamic]$T, runtime.Allocator_Error) #optional_ok {…}
     

    copies slice into a new dynamic array

    cmp ¶

    cmp :: proc(a, b: $T) -> Ordering {…}

    cmp_proc ¶

    cmp_proc :: proc($E: typeid) -> proc(_: typeid, _: typeid) -> Ordering {…}

    concatenate ¶

    concatenate :: proc(a: []$T/[]$T, allocator := context.allocator) -> (res: $T/[]$T, err: runtime.Allocator_Error) #optional_ok {…}

    contains ¶

    contains :: proc(array: $T/[]$T, value: $T) -> bool {…}

    count ¶

    count :: proc(s: $T/[]$T, value: $T) -> (n: int) {…}

    count_proc ¶

    count_proc :: proc(s: $T/[]$T, f: proc(_: $T) -> bool) -> (n: int) {…}

    dot_product ¶

    dot_product :: proc(a, b: $T/[]$T) -> (r: $T, ok: bool) {…}

    enumerated_array ¶

    enumerated_array :: proc(ptr: ^$T) -> []$T {…}
     

    Convert a pointer to an enumerated array to a slice of the element type

    equal ¶

    equal :: proc(a, b: $T/[]$T) -> bool {…}

    fill ¶

    fill :: proc(array: $T/[]$T, value: $T) {…}

    filter ¶

    filter :: proc(s: $T/[]$T, f: proc(_: $T) -> bool, allocator := context.allocator) -> $T/[]$T {…}

    first ¶

    first :: proc(array: $T/[]$T) -> $T {…}

    first_ptr ¶

    first_ptr :: proc(array: $T/[]$T) -> ^$T {…}

    from_ptr ¶

    from_ptr :: proc "contextless" (ptr: ^$T, count: int) -> []$T {…}
     

    Turn a pointer and a length into a slice.

    get ¶

    get :: proc(array: $T/[]$T, index: int) -> (value: $T, ok: bool) {…}

    get_ptr ¶

    get_ptr :: proc(array: $T/[]$T, index: int) -> (value: ^$T, ok: bool) {…}

    has_prefix ¶

    has_prefix :: proc(array: $T/[]$T, needle: $T) -> bool {…}

    has_suffix ¶

    has_suffix :: proc(array: $T/[]$T, needle: $T) -> bool {…}

    into_dynamic ¶

    into_dynamic :: proc(a: $T/[]$T) -> [dynamic]$T {…}
     

    Converts slice into a dynamic array without cloning or allocating memory

    is_empty ¶

    is_empty :: proc(a: $T/[]$T) -> bool {…}

    is_sorted ¶

    is_sorted :: proc(array: $T/[]$T) -> bool {…}

    is_sorted_by ¶

    is_sorted_by :: proc(array: $T/[]$T, less: proc(i, j: $T) -> bool) -> bool {…}

    is_sorted_by_key ¶

    is_sorted_by_key :: proc(array: $T/[]$T, key: proc(_: $T) -> $T) -> bool {…}

    is_sorted_cmp ¶

    is_sorted_cmp :: proc(array: $T/[]$T, cmp: proc(i, j: $T) -> Ordering) -> bool {…}

    last ¶

    last :: proc(array: $T/[]$T) -> $T {…}

    last_ptr ¶

    last_ptr :: proc(array: $T/[]$T) -> ^$T {…}

    length ¶

    length :: proc(a: $T/[]$T) -> int {…}
    linear_search :: proc(array: $T/[]$T, key: $T) -> (index: int, found: bool) {…}

    linear_search_proc ¶

    linear_search_proc :: proc(array: $T/[]$T, f: proc(_: $T) -> bool) -> (index: int, found: bool) {…}

    map_entries ¶

    map_entries :: proc(m: $T/map[$T]$T, allocator := context.allocator) -> (entries: []Map_Entry($Key, $Value), err: runtime.Allocator_Error) {…}

    map_entry_infos ¶

    map_entry_infos :: proc(m: $T/map[$T]$T, allocator := context.allocator) -> (entries: []Map_Entry_Info($Key, $Value)) {…}

    map_keys ¶

    map_keys :: proc(m: $T/map[$T]$T, allocator := context.allocator) -> (keys: []$T, err: runtime.Allocator_Error) {…}

    map_values ¶

    map_values :: proc(m: $T/map[$T]$T, allocator := context.allocator) -> (values: []$T, err: runtime.Allocator_Error) {…}

    mapper ¶

    mapper :: proc(s: $T/[]$T, f: proc(_: $T) -> $T, allocator := context.allocator) -> (r: []$T, err: runtime.Allocator_Error) #optional_ok {…}

    max ¶

    max :: proc(s: $T/[]$T) -> (res: $T, ok: bool) #optional_ok {…}

    min ¶

    min :: proc(s: $T/[]$T) -> (res: $T, ok: bool) #optional_ok {…}

    min_max ¶

    min_max :: proc(s: $T/[]$T) -> (min, max: $T, ok: bool) {…}

    none_of ¶

    none_of :: proc(s: $T/[]$T, value: $T) -> bool {…}

    none_of_proc ¶

    none_of_proc :: proc(s: $T/[]$T, f: proc(_: $T) -> bool) -> bool {…}

    prefix_length ¶

    prefix_length :: proc(a, b: $T/[]$T) -> (n: int) {…}
     

    return the prefix length common between slices a and b.

    slice.prefix_length([]u8{1, 2, 3, 4}, []u8{1}) -> 1
    slice.prefix_length([]u8{1, 2, 3, 4}, []u8{1, 2, 3}) -> 3
    slice.prefix_length([]u8{1, 2, 3, 4}, []u8{2, 3, 4}) -> 0
    

    ptr_add ¶

    ptr_add :: proc(p: $P/^$T, x: int) -> ^$T {…}

    ptr_rotate ¶

    ptr_rotate :: proc(left: int, mid: ^$T, right: int) {…}

    ptr_sub ¶

    ptr_sub :: proc(p: $P/^$T, x: int) -> ^$T {…}

    ptr_swap_non_overlapping ¶

    ptr_swap_non_overlapping :: proc(x, y: rawptr, len: int) {…}

    ptr_swap_overlapping ¶

    ptr_swap_overlapping :: proc(x, y: rawptr, len: int) {…}

    reduce ¶

    reduce :: proc(s: $T/[]$T, initializer: $T, f: proc(_: $T, _: $T) -> $T) -> $T {…}

    reinterpret ¶

    reinterpret :: proc "contextless" ($T: typeid/[]T, s: []T) -> []T {…}
     

    Turn a slice of one type, into a slice of another type.

    Only converts the type and length of the slice itself.
    The length is rounded down to the nearest whole number of items.
    
    ```
    large_items := []i64{1, 2, 3, 4}
    small_items := slice.reinterpret([]i32, large_items)
    assert(len(small_items) == 8)
    ```
    ```
    small_items := []byte{1, 0, 0, 0, 0, 0, 0, 0,
                          2, 0, 0, 0}
    large_items := slice.reinterpret([]i64, small_items)
    assert(len(large_items) == 1) // only enough bytes to make 1 x i64; two would need at least 8 bytes.
    ```
    

    reverse ¶

    reverse :: proc(array: $T/[]$T) {…}

    reverse_sort ¶

    reverse_sort :: proc(data: $T/[]$T) {…}

    reverse_sort_by ¶

    reverse_sort_by :: proc(data: $T/[]$T, less: proc(i, j: $T) -> bool) {…}

    reverse_sort_by_cmp ¶

    reverse_sort_by_cmp :: proc(data: $T/[]$T, cmp: proc(i, j: $T) -> Ordering) {…}

    reverse_sort_by_key ¶

    reverse_sort_by_key :: proc(data: $T/[]$T, key: proc(_: $T) -> $T) {…}

    rotate_left ¶

    rotate_left :: proc(array: $T/[]$T, mid: int) {…}

    rotate_right ¶

    rotate_right :: proc(array: $T/[]$T, k: int) {…}

    scanner ¶

    scanner :: proc(s: $T/[]$T, initializer: $T, f: proc(_: $T, _: $T) -> $T, allocator := context.allocator) -> (res: []$T, err: runtime.Allocator_Error) #optional_ok {…}

    simple_equal ¶

    simple_equal :: proc(a, b: $T/[]$T) -> bool {…}

    sort ¶

    sort :: proc(data: $T/[]$T) {…}
     

    sort sorts a slice This sort is not guaranteed to be stable

    sort_by ¶

    sort_by :: proc(data: $T/[]$T, less: proc(i, j: $T) -> bool) {…}
     

    sort_by sorts a slice with a given procedure to test whether two values are ordered "i < j" This sort is not guaranteed to be stable

    sort_by_cmp ¶

    sort_by_cmp :: proc(data: $T/[]$T, cmp: proc(i, j: $T) -> Ordering) {…}

    sort_by_indices_allocate ¶

    sort_by_indices_allocate :: proc(data: $T/[]$T, indices: []int, allocator := context.allocator) -> (sorted: $T/[]$T) {…}

    sort_by_indices_overwrite ¶

    sort_by_indices_overwrite :: proc(data: $T/[]$T, indices: []int) {…}

    sort_by_key ¶

    sort_by_key :: proc(data: $T/[]$T, key: proc(_: $T) -> $T) {…}
     

    TODO(bill): Should sort_by_key exist or is sort_by more than enough?

    sort_by_with_indices ¶

    sort_by_with_indices :: proc(data: $T/[]$T, less: proc(i, j: $T) -> bool, allocator := context.allocator) -> (indices: []int) {…}
     

    sort_by sorts a slice with a given procedure to test whether two values are ordered "i < j" This sort is not guaranteed to be stable

    sort_with_indices ¶

    sort_with_indices :: proc(data: $T/[]$T, allocator := context.allocator) -> (indices: []int) {…}
     

    sort sorts a slice and returns a slice of the original indices This sort is not guaranteed to be stable

    split_at ¶

    split_at :: proc(array: $T/[]$T, index: int) -> (a, b: $T/[]$T) {…}

    split_first ¶

    split_first :: proc(array: $T/[]$T) -> (first: $T, rest: $T/[]$T) {…}

    split_last ¶

    split_last :: proc(array: $T/[]$T) -> (rest: $T/[]$T, last: $T) {…}

    stable_sort ¶

    stable_sort :: proc(data: $T/[]$T) {…}
     

    stable_sort sorts a slice

    stable_sort_by ¶

    stable_sort_by :: proc(data: $T/[]$T, less: proc(i, j: $T) -> bool) {…}
     

    stable_sort_by sorts a slice with a given procedure to test whether two values are ordered "i < j"

    stable_sort_by_cmp ¶

    stable_sort_by_cmp :: proc(data: $T/[]$T, cmp: proc(i, j: $T) -> Ordering) {…}

    swap ¶

    swap :: proc(array: $T/[]$T, a, b: int) {…}

    swap_between ¶

    swap_between :: proc(a, b: $T/[]$T) {…}

    swap_with_slice ¶

    swap_with_slice :: proc(a, b: $T/[]$T, loc := #caller_location) {…}

    to_bytes ¶

    to_bytes :: proc "contextless" (s: []$T) -> []u8 {…}
     

    Turn a slice into a byte slice.

    See `slice.reinterpret` to go the other way.
    

    to_dynamic ¶

    to_dynamic :: clone_to_dynamic
     

    copies slice into a new dynamic array

    zero ¶

    zero :: proc(array: $T/[]$T) {…}

    Procedure Groups

    Source Files

    Generation Information

    Generated with odin version dev-2023-10 (vendor "odin") Windows_amd64 @ 2023-10-03 21:09:46.887800800 +0000 UTC