diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2025-10-07 11:49:56 +0100 |
|---|---|---|
| committer | gingerBill <gingerBill@users.noreply.github.com> | 2025-10-07 11:49:56 +0100 |
| commit | 1a90b06fac6a2e8370b8d74c8f0dfb34e445a436 (patch) | |
| tree | 1df7652fac588a8cc4977ca64df890605ced106f /core/reflect/iterator.odin | |
| parent | a4a74442cec9cd8c8956032d0e910862e944f9bf (diff) | |
Improve documentation for `core:reflect`
Diffstat (limited to 'core/reflect/iterator.odin')
| -rw-r--r-- | core/reflect/iterator.odin | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/reflect/iterator.odin b/core/reflect/iterator.odin index 090fe04cc..e96019f68 100644 --- a/core/reflect/iterator.odin +++ b/core/reflect/iterator.odin @@ -2,6 +2,10 @@ package reflect import "base:runtime" +// An iterator to dynamically iterate across something that is array-like (or pointer-to-array-like) +// Example: +// it: int // used as a tracking value +// for elem, idx in iterate_array(any_array_val, &it) { ... } @(require_results) iterate_array :: proc(val: any, it: ^int) -> (elem: any, index: int, ok: bool) { if val == nil || it == nil { @@ -45,6 +49,10 @@ iterate_array :: proc(val: any, it: ^int) -> (elem: any, index: int, ok: bool) { return } +// An iterator to dynamically iterate across map (or pointer-to-map) +// Example: +// it: int // used as a tracking value +// for key, val in iterate_map(any_map_val, &it) { ... } @(require_results) iterate_map :: proc(val: any, it: ^int) -> (key, value: any, ok: bool) { if val == nil || it == nil { |