package core:slice

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, 
}

Constants

This section is empty.

Variables

This section is empty.

Procedures

all_of ¶

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

all_of_proc ¶

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

any_of ¶

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

any_of_proc ¶

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

as_ptr ¶

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

bytes_from_ptr ¶

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

Turn a pointer and a length into a byte slice.

clone ¶

clone :: proc "odin" (a: $T/[]$, allocator := context.allocator) -> []$ {…}
 

copies a slice into a new slice

clone_to_dynamic ¶

clone_to_dynamic :: proc "odin" (a: $T/[]$, allocator := context.allocator) -> [dynamic]$ {…}
 

copies slice into a new dynamic array

cmp ¶

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

cmp_proc ¶

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

concatenate ¶

concatenate :: proc "odin" (a: []$T/[]$, allocator := context.allocator) -> (res: $T/[]$) {…}

contains ¶

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

count ¶

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

count_proc ¶

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

dot_product ¶

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

enumerated_array ¶

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

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

equal ¶

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

fill ¶

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

filter ¶

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

first ¶

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

first_ptr ¶

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

from_ptr ¶

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

Turn a pointer and a length into a slice.

get ¶

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

get_ptr ¶

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

has_prefix ¶

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

has_suffix ¶

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

into_dynamic ¶

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

Converts slice into a dynamic array without cloning or allocating memory

is_empty ¶

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

is_sorted ¶

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

is_sorted_by ¶

is_sorted_by :: proc "odin" (array: $T/[]$, less: proc "odin" (x, y: $) -> bool) -> bool {…}

is_sorted_by_key ¶

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

is_sorted_cmp ¶

is_sorted_cmp :: proc "odin" (array: $T/[]$, cmp: proc "odin" (a, b: $) -> Ordering) -> bool {…}

last ¶

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

last_ptr ¶

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

length ¶

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

linear_search_proc ¶

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

map_entries ¶

map_entries :: proc "odin" (m: $T/map[$]$, allocator := context.allocator) -> (entries: []Map_Entry(K, V)) {…}

map_entry_infos ¶

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

map_keys ¶

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

map_values ¶

map_values :: proc "odin" (m: $T/map[$]$, allocator := context.allocator) -> (keys: []$) {…}

mapper ¶

mapper :: proc "odin" (s: $T/[]$, f: proc "odin" (value: $) -> $, allocator := context.allocator) -> []$ {…}

max ¶

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

min ¶

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

min_max ¶

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

none_of ¶

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

none_of_proc ¶

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

prefix_length ¶

prefix_length :: proc "odin" (a, b: $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 "odin" (p: $P/^$, x: int) -> ^$ {…}

ptr_rotate ¶

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

ptr_sub ¶

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

ptr_swap_non_overlapping ¶

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

ptr_swap_overlapping ¶

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

reduce ¶

reduce :: proc "odin" (s: $T/[]$, initializer: $, f: proc "odin" (a, b: $) -> (out: $)) -> $ {…}

reinterpret ¶

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

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 "odin" (array: $T/[]$) {…}

reverse_sort ¶

reverse_sort :: proc "odin" (array: $T/[]$) {…}

reverse_sort_by ¶

reverse_sort_by :: proc "odin" (data: $T/[]$, less: proc "odin" (x, y: $) -> bool) {…}

reverse_sort_by_cmp ¶

reverse_sort_by_cmp :: proc "odin" (data: $T/[]$, cmp: proc "odin" (a, b: $) -> Ordering) {…}

reverse_sort_by_key ¶

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

rotate_left ¶

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

rotate_right ¶

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

scanner ¶

scanner :: proc "odin" (s: $T/[]$, initializer: $, f: proc "odin" (a, b: $) -> (out: $), allocator := context.allocator) -> []$ {…}

simple_equal ¶

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

sort ¶

sort :: proc "odin" (array: $T/[]$) {…}
 

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

sort_by ¶

sort_by :: proc "odin" (data: $T/[]$, less: proc "odin" (x, y: $) -> 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 "odin" (data: $T/[]$, cmp: proc "odin" (a, b: $) -> Ordering) {…}

sort_by_indices_allocate ¶

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

sort_by_indices_overwrite ¶

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

sort_by_key ¶

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

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

sort_by_with_indices ¶

sort_by_with_indices :: proc "odin" (data: $T/[]$, less: proc "odin" (x, y: $) -> 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 "odin" (data: $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 "odin" (array: $T/[]$, index: int) -> (a, b: $T/[]$) {…}

split_first ¶

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

split_last ¶

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

stable_sort ¶

stable_sort :: proc "odin" (array: $T/[]$) {…}
 

stable_sort sorts a slice

stable_sort_by ¶

stable_sort_by :: proc "odin" (data: $T/[]$, less: proc "odin" (x, y: $) -> 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 "odin" (data: $T/[]$, cmp: proc "odin" (a, b: $) -> Ordering) {…}

swap ¶

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

swap_between ¶

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

swap_with_slice ¶

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

to_bytes ¶

to_bytes :: proc "contextless" (s: []$) -> []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

Procedure Groups

Source Files

Generation Information

Generated with odin version dev-2022-10 (vendor "odin") Windows_amd64 @ 2022-10-05 21:11:47.508100000 +0000 UTC