From 84ecdcbca9e55b1f57fbb832e12ff4fdbb86e7c9 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Mon, 4 Dec 2023 01:37:11 +0100 Subject: core: Fixed broken tree impl. --- c++/core/tree.h | 10 ++++------ tests/tree.cpp | 20 -------------------- 2 files changed, 4 insertions(+), 26 deletions(-) diff --git a/c++/core/tree.h b/c++/core/tree.h index 43f6c2c..68fa20a 100644 --- a/c++/core/tree.h +++ b/c++/core/tree.h @@ -9,7 +9,7 @@ namespace saw { /** * Container with a simplistic approach to a branch */ -template +template class branch; /** @@ -81,7 +81,7 @@ public: std::size_t index = size(); try { - children_.emplace_back(tree{}); + children_.emplace_back(Tree{}); }catch(const std::exception& e){ (void)e; @@ -123,7 +123,6 @@ private: * We're friend classing the tree since it's way easier this way and the branch and tree * class are intertwined heavily anyway. */ - friend class Tree; public: /** * @@ -178,7 +177,6 @@ public: template error_or extract(){ - error_or reserve(std::size_t siz){ if(!is()){ return make_error(); } @@ -231,11 +229,11 @@ class tree { return data_.size(); } - error_or add() { + error_or add() { return data_.add(); } - error_or add(T leaf){ + error_or add(T leaf){ return data_.add(std::move(leaf)); } diff --git a/tests/tree.cpp b/tests/tree.cpp index a33f0b1..2515ee9 100644 --- a/tests/tree.cpp +++ b/tests/tree.cpp @@ -2,25 +2,6 @@ #include namespace { -/* -SAW_TEST("Tree insert"){ - using namespace saw; - - branch troi; - { - // Replace with value - auto eor = troi.replace_tree(5); - - SAW_EXPECT(eor.is_value(), "Didn't manage to replace with value"); - } - { - // Replace with tree again - auto eor = troi.replace_value(tree{}); - - SAW_EXPECT(eor.is_value(), "Not a value"); - } -} - SAW_TEST("Tree add child"){ using namespace saw; @@ -40,5 +21,4 @@ SAW_TEST("Tree add child"){ SAW_EXPECT(eov2.is_value(), "Didn't manage to add to inner tree"); } } -*/ } -- cgit v1.2.3