diff options
-rw-r--r-- | c++/core/tree.h | 10 | ||||
-rw-r--r-- | 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<typename T> +template<typename T, typename Tree> 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<typename NT> error_or<NT> extract(){ - error_or<void> reserve(std::size_t siz){ if(!is<NT>()){ return make_error<err::invalid_state>(); } @@ -231,11 +229,11 @@ class tree { return data_.size(); } - error_or<void> add() { + error_or<size_t> add() { return data_.add(); } - error_or<void> add(T leaf){ + error_or<size_t> 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 <forstio/core/tree.h> namespace { -/* -SAW_TEST("Tree insert"){ - using namespace saw; - - branch<int> 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<int>{}); - - 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"); } } -*/ } |