diff --git a/core/container/intrusive/list/doc.odin b/core/container/intrusive/list/doc.odin index ff219e15f..1a5a12f49 100644 --- a/core/container/intrusive/list/doc.odin +++ b/core/container/intrusive/list/doc.odin @@ -8,6 +8,13 @@ An intrusive container requires a `Node` to be embedded in your own structure, l value: string, } +Embedding the members of a `list.Node` in your structure with the `using` keyword is also allowed: + + My_String :: struct { + using node: list.Node, + value: string, + } + Here is a full example: package test diff --git a/core/container/intrusive/list/intrusive_list.odin b/core/container/intrusive/list/intrusive_list.odin index e0df3ba72..5b29efb22 100644 --- a/core/container/intrusive/list/intrusive_list.odin +++ b/core/container/intrusive/list/intrusive_list.odin @@ -82,7 +82,7 @@ remove :: proc "contextless" (list: ^List, node: ^Node) { } } /* -Removes from the given list all elements that satisfy a condition. +Removes from the given list all elements that satisfy a condition with O(N) time complexity. **Inputs** - list: The container list @@ -109,7 +109,7 @@ remove_by_proc :: proc(list: ^List, to_erase: proc(^Node) -> bool) { } } /* -Removes from the given list all elements that satisfy a condition. +Removes from the given list all elements that satisfy a condition with O(N) time complexity. **Inputs** - list: The container list @@ -137,7 +137,7 @@ remove_by_proc_contextless :: proc(list: ^List, to_erase: proc "contextless" (^N } /* -Checks if the given list does not contain any element. +Checks whether the given list does not contain any element. **Inputs** - list: The container list