Create one new node in the tree, return its index in the pool */
| 50 | |
| 51 | /** Create one new node in the tree, return its index in the pool */ |
| 52 | size_t AddNode(const T &element) |
| 53 | { |
| 54 | if (this->free_list.empty()) { |
| 55 | this->nodes.emplace_back(element); |
| 56 | return this->nodes.size() - 1; |
| 57 | } else { |
| 58 | size_t newidx = this->free_list.back(); |
| 59 | this->free_list.pop_back(); |
| 60 | this->nodes[newidx] = node{ element }; |
| 61 | return newidx; |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | /** Find a coordinate value to split a range of elements at */ |
| 66 | template <typename It> |
no test coverage detected