core/container/handle_map

container_handle_map

Types

7

Handle16

Handle16 :: struct { idx: u8, gen: u8, }Source

Default 16-bit Handle type which can be used for handle maps which only need a maximum of 254 (1<<8 - 2) items

Handle32

Handle32 :: struct { idx: u16, gen: u16, }Source

Default 32-bit Handle type which can be used for handle maps which only need a maximum of 65534 (1<<16 - 2) items

Handle64

Handle64 :: struct { idx: u32, gen: u32, }Source

Default 64-bit Handle type which can be used for handle maps which only need a maximum of 4294967294 (1<<32 - 2) items

Procedures

20

dynamic_iterate

dynamic_iterate :: proc(it: ^DHI) -> (val: ^T, h: Handle_Type, ok: bool)Source

Iterate over a handle map. It will skip over unused item slots (e.g. handle.idx == 0).

Usage:
		it := hm.dynamic_iterator_make(&the_dynamic_handle_map)
		for item, handle in hm.iterate(&it) {
			...
		}

static_add

static_add :: proc(m: ^H, item: T) -> (handle: Handle_Type, ok: bool)Source

add a value of type T to the handle map. This will return a pointer to the item and an optional boolean to check for validity.

static_cap

static_cap :: proc(m: H) -> (uint)Source

Returns the capacity of the items in a handle map. This is equivalent to N-1 as the zero value is reserved for the zero-value sentinel.

static_get

static_get :: proc(m: ^H, h: Handle_Type) -> (^T, bool)Source

get a stable pointer of type ^T by resolving the handle h. If the handle is not valid, then nil, false is returned.

static_iterate

static_iterate :: proc(it: ^HI) -> (val: ^T, h: Handle_Type, ok: bool)Source

Iterate over a handle map. It will skip over unused item slots (e.g. handle.idx == 0).

Usage:
		it := hm.iterator_make(&the_handle_map)
		for item, handle in hm.iterate(&it) {
			...
		}

Procedure Groups

9

Reference search

Find anything

Documentation preferences

Settings

System theme variants

Used only while Theme is set to System.