From 63276a85badc0a4ef2f5482592d33f6cf989de15 Mon Sep 17 00:00:00 2001 From: NicknEma <62065135+NicknEma@users.noreply.github.com> Date: Sun, 14 Jul 2024 18:18:12 +0200 Subject: [PATCH] Fixed grammar and expanded info Fixed points made by Jeroen. --- core/container/intrusive/list/doc.odin | 7 +++++++ core/container/intrusive/list/intrusive_list.odin | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) 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