summaryrefslogtreecommitdiff
path: root/c++/core/tree.h
diff options
context:
space:
mode:
Diffstat (limited to 'c++/core/tree.h')
-rw-r--r--c++/core/tree.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/c++/core/tree.h b/c++/core/tree.h
index 6316a5e..32572fc 100644
--- a/c++/core/tree.h
+++ b/c++/core/tree.h
@@ -25,7 +25,8 @@ private:
/**
* Object holding the treeed branch instances
*/
- std::vector<branch<T>> children_;
+ using branch = std::variant<T, tree<T>>;
+ std::vector<branch> children_;
public:
/**
* Default constructor
@@ -101,14 +102,14 @@ public:
/**
* Returns the branch at i
*/
- branch<T>& at(std::size_t i){
+ branch& at(std::size_t i){
return children_.at(i);
}
/**
* Returns the branch at i
*/
- const branch<T>& at(std::size_t i) const {
+ const branch& at(std::size_t i) const {
return children_.at(i);
}
};