aboutsummaryrefslogtreecommitdiff
path: root/core/container
diff options
context:
space:
mode:
authorNicknEma <62065135+NicknEma@users.noreply.github.com>2024-07-12 15:48:47 +0200
committerNicknEma <62065135+NicknEma@users.noreply.github.com>2024-07-12 15:48:47 +0200
commitd10694901f9243b72a7b9837b1f54cceb81c6288 (patch)
treedf9e2c310bde8617fa735376c4e4ac1d23537dce /core/container
parentc75a872909191631f5e5282d37014b51a34a9724 (diff)
Simplify and fix doc examples
Remove unnecessary examples; fix compilation errors in the remaining ones
Diffstat (limited to 'core/container')
-rw-r--r--core/container/intrusive/list/intrusive_list.odin32
1 files changed, 6 insertions, 26 deletions
diff --git a/core/container/intrusive/list/intrusive_list.odin b/core/container/intrusive/list/intrusive_list.odin
index 6989dfa21..e0df3ba72 100644
--- a/core/container/intrusive/list/intrusive_list.odin
+++ b/core/container/intrusive/list/intrusive_list.odin
@@ -212,7 +212,7 @@ Iterator :: struct($T: typeid) {
}
/*
-Creates an iterator pointing at the head of the given list.
+Creates an iterator pointing at the head of the given list. For an example, see `iterate_next`.
**Inputs**
- list: The container list
@@ -221,16 +221,6 @@ Creates an iterator pointing at the head of the given list.
**Returns** An iterator pointing at the head of `list`
-Example:
-
- My_Struct :: struct {
- node : list.Node,
- value: int,
- }
-
- l: list.List
- it := list.iterator_head(l, My_Struct, "node")
-
*/
iterator_head :: proc "contextless" (list: List, $T: typeid, $field_name: string) -> Iterator(T)
where intrinsics.type_has_field(T, field_name),
@@ -238,7 +228,7 @@ iterator_head :: proc "contextless" (list: List, $T: typeid, $field_name: string
return {list.head, offset_of_by_string(T, field_name)}
}
/*
-Creates an iterator pointing at the tail of the given list.
+Creates an iterator pointing at the tail of the given list. For an example, see `iterate_prev`.
**Inputs**
- list: The container list
@@ -247,16 +237,6 @@ Creates an iterator pointing at the tail of the given list.
**Returns** An iterator pointing at the tail of `list`
-Example:
-
- My_Struct :: struct {
- node : list.Node,
- value: int,
- }
-
- l: list.List
- it := list.iterator_tail(l, My_Struct, "node")
-
*/
iterator_tail :: proc "contextless" (list: List, $T: typeid, $field_name: string) -> Iterator(T)
where intrinsics.type_has_field(T, field_name),
@@ -304,9 +284,9 @@ Example:
list.push_back(&l, &one.node)
list.push_back(&l, &two.node)
- it := list.iterator_head(&l, My_Struct, "node")
+ it := list.iterator_head(l, My_Struct, "node")
for num in list.iterate_next(&it) {
- fmt.println(num)
+ fmt.println(num.value)
}
}
@@ -354,9 +334,9 @@ Example:
list.push_back(&l, &one.node)
list.push_back(&l, &two.node)
- it := list.iterator_tail(&l, My_Struct, "node")
+ it := list.iterator_tail(l, My_Struct, "node")
for num in list.iterate_prev(&it) {
- fmt.println(num)
+ fmt.println(num.value)
}
}