| 2107 | |
| 2108 | template <typename P> |
| 2109 | void btree<P>::erase_same_node(iterator begin, iterator end) { |
| 2110 | assert(begin.node == end.node); |
| 2111 | assert(end.position > begin.position); |
| 2112 | |
| 2113 | node_type *node = begin.node; |
| 2114 | size_type to_erase = end.position - begin.position; |
| 2115 | if (!node->leaf()) { |
| 2116 | // Delete all children between begin and end. |
| 2117 | for (size_type i = 0; i < to_erase; ++i) { |
| 2118 | internal_clear(node->child(begin.position + i + 1)); |
| 2119 | } |
| 2120 | // Rotate children after end into new positions. |
| 2121 | for (size_type i = begin.position + to_erase + 1; i <= node->count(); ++i) { |
| 2122 | node->set_child(i - to_erase, node->child(i)); |
| 2123 | node->clear_child(i); |
| 2124 | } |
| 2125 | } |
| 2126 | node->remove_values_ignore_children(begin.position, to_erase, |
| 2127 | mutable_allocator()); |
| 2128 | |
| 2129 | // Do not need to update rightmost_, because |
| 2130 | // * either end == this->end(), and therefore node == rightmost_, and still |
| 2131 | // exists |
| 2132 | // * or end != this->end(), and therefore rightmost_ hasn't been erased, since |
| 2133 | // it wasn't covered in [begin, end) |
| 2134 | } |
| 2135 | |
| 2136 | template <typename P> |
| 2137 | auto btree<P>::erase_from_leaf_node(iterator begin, size_type to_erase) |
nothing calls this directly
no test coverage detected