I created a function to convert an existing tree object to a string. Line format:
parent ( child1 ) ( child2 ( childOfChild2 ) )
The program displays the line correctly, performs some other work, but at the same time with errors
Segmentation fault (core dumped)
This function ( getTree(this->root) displays whole trees):
template <typename T> string Tree<T>::getTree(const Node<T>& node) { if (node.isLeaf()){ return to_string(node.value); } vector<future<string>> results;
Variable Information:
vector<shared_ptr<Node>> children;
Tell me if you need more information. The full source is tree.cpp and tree.h.
source share