summaryrefslogtreecommitdiff
path: root/c++
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2023-12-04 01:37:11 +0100
committerClaudius "keldu" Holeksa <mail@keldu.de>2023-12-04 01:37:11 +0100
commit84ecdcbca9e55b1f57fbb832e12ff4fdbb86e7c9 (patch)
tree01f2dd97dec03218621ec766b0a95c149cd54d83 /c++
parent032409d34546a5e257a35fbfedb3e5aecaf08ebb (diff)
core: Fixed broken tree impl.
Diffstat (limited to 'c++')
-rw-r--r--c++/core/tree.h10
1 files changed, 4 insertions, 6 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));
}