package core:container/queue

Types

Queue ¶

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

Dynamically resizable double-ended queue/ring-buffer

Constants

DEFAULT_CAPACITY ¶

DEFAULT_CAPACITY :: 16

Variables

This section is empty.

Procedures

append_elem ¶

append_elem :: push_back
 

Push an element to the back of the queue

append_elems ¶

append_elems :: push_back_elems
 

Push multiple elements to the front of the queue

back ¶

back :: proc "odin" (q: ^$Q/Queue($T)) -> $ {…}

back_ptr ¶

back_ptr :: proc "odin" (q: ^$Q/Queue($T)) -> ^$ {…}

cap ¶

cap :: proc "odin" (q: $Q/Queue($T)) -> int {…}
 

The current capacity of the queue

clear ¶

clear :: proc "odin" (q: ^$Q/Queue($T)) {…}
 

Clear the contents of the queue

consume_back ¶

consume_back :: proc "odin" (q: ^$Q/Queue($T), n: int, loc := #caller_location) {…}
 

Consume n elements from the back of the queue

consume_front ¶

consume_front :: proc "odin" (q: ^$Q/Queue($T), n: int, loc := #caller_location) {…}
 

Consume n elements from the front of the queue

destroy ¶

destroy :: proc "odin" (q: ^$Q/Queue($T)) {…}
 

Procedure to destroy a queue

front ¶

front :: proc "odin" (q: ^$Q/Queue($T)) -> $ {…}

front_ptr ¶

front_ptr :: proc "odin" (q: ^$Q/Queue($T)) -> ^$ {…}

get ¶

get :: proc "odin" (q: ^$Q/Queue($T), #any_int i: int, loc := #caller_location) -> $ {…}

get_ptr ¶

get_ptr :: proc "odin" (q: ^$Q/Queue($T), #any_int i: int, loc := #caller_location) -> ^$ {…}

init ¶

init :: proc "odin" (q: ^$Q/Queue($T), capacity: int = DEFAULT_CAPACITY, allocator := context.allocator) -> bool {…}
 

Procedure to initialize a queue

init_from_slice ¶

init_from_slice :: proc "odin" (q: ^$Q/Queue($T), backing: []$) -> bool {…}
 

Procedure to initialize a queue from a fixed backing slice

len ¶

len :: proc "odin" (q: $Q/Queue($T)) -> int {…}
 

The length of the queue

peek_back ¶

peek_back :: proc "odin" (q: ^$Q/Queue($T), loc := #caller_location) -> ^$ {…}

peek_front ¶

peek_front :: proc "odin" (q: ^$Q/Queue($T), loc := #caller_location) -> ^$ {…}

pop_back ¶

pop_back :: proc "odin" (q: ^$Q/Queue($T), loc := #caller_location) -> (elem: $) {…}
 

Pop an element from the back of the queue

pop_back_safe ¶

pop_back_safe :: proc "odin" (q: ^$Q/Queue($T)) -> (elem: $, ok: bool) {…}
 

Safely pop an element from the back of the queue

pop_front ¶

pop_front :: proc "odin" (q: ^$Q/Queue($T), loc := #caller_location) -> (elem: $) {…}
 

Pop an element from the front of the queue

pop_front_safe ¶

pop_front_safe :: proc "odin" (q: ^$Q/Queue($T)) -> (elem: $, ok: bool) {…}
 

Safely pop an element from the front of the queue

push_back ¶

push_back :: proc "odin" (q: ^$Q/Queue($T), elem: $) -> bool {…}
 

Push an element to the back of the queue

push_back_elems ¶

push_back_elems :: proc "odin" (q: ^$Q/Queue($T), elems: ..$) -> bool {…}
 

Push multiple elements to the front of the queue

push_front ¶

push_front :: proc "odin" (q: ^$Q/Queue($T), elem: $) -> bool {…}
 

Push an element to the front of the queue

reserve ¶

reserve :: proc "odin" (q: ^$Q/Queue($T), capacity: int) -> bool {…}
 

Reserve enough space for at least the specified capacity

set ¶

set :: proc "odin" (q: ^$Q/Queue($T), #any_int i: int, val: $, loc := #caller_location) {…}

space ¶

space :: proc "odin" (q: $Q/Queue($T)) -> int {…}
 

Remaining space in the queue (cap-len)

Procedure Groups

Source Files

Generation Information

Generated with odin version dev-2022-12 (vendor "odin") Windows_amd64 @ 2022-12-06 21:08:55.192792400 +0000 UTC