| 1241 | |
| 1242 | template <typename METRIC, typename PAYLOAD> |
| 1243 | void |
| 1244 | DiscreteSpace<METRIC, PAYLOAD>::insert_before(DiscreteSpace::Node *spot, DiscreteSpace::Node *node) { |
| 1245 | if (left(spot) == nullptr) { |
| 1246 | spot->set_child(node, Direction::LEFT); |
| 1247 | } else { |
| 1248 | // If there's a left child, there's a previous node, therefore spot->_prev is valid. |
| 1249 | // Further, the previous node must be the rightmost descendant node of the left subtree |
| 1250 | // and therefore has no current right child. |
| 1251 | spot->_prev->set_child(node, Direction::RIGHT); |
| 1252 | } |
| 1253 | |
| 1254 | _list.insert_before(spot, node); |
| 1255 | _root = static_cast<Node *>(node->rebalance_after_insert()); |
| 1256 | } |
| 1257 | |
| 1258 | template <typename METRIC, typename PAYLOAD> |
| 1259 | void |
no test coverage detected