From 4a431c43d104189a083b42b3e6312252893d5c33 Mon Sep 17 00:00:00 2001 From: Tristan Brice Velloza Kildaire Date: Fri, 26 Apr 2024 16:35:21 +0200 Subject: [PATCH] TreeNode - Added removal - Added indexing support --- source/niknaks/containers.d | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/source/niknaks/containers.d b/source/niknaks/containers.d index 0fc8883..1eaff9f 100644 --- a/source/niknaks/containers.d +++ b/source/niknaks/containers.d @@ -830,15 +830,25 @@ public class Tree(T) } } - // if(found) - // { - // this.children = this.children.removeResize(idx, true, true); - // return true; - // } + if(found) + { + this.children = this.children.removeResize(idx); + return true; + } return false; } + public T opIndex(size_t idx) + { + return idx < this.children.length ? this.children[idx].getValue() : T.init; + } + + public T getValue() + { + return this.value; + } + public T[] dfs ( InclusionStratergy!(T) strat = toDelegate(&Always!(T)),