Lines Matching refs:__root

92 algorithms taking a parameter named __root should assume that __root
95 Each algorithm herein assumes that __root->__parent_ points to a non-null
96 structure which has a member __left_ which points back to __root. No other
97 member is read or written to at __root->__parent_.
99 __root->__parent_ will be referred to below (in comments only) as end_node.
100 end_node->__left_ is an externably accessible lvalue for __root, and can be
104 __root, have a non-null __parent_ field.
147 // Determines if the red black tree rooted at __root is a proper red black tree.
148 // __root == nullptr is a proper tree. Returns true is __root is a proper
151 _LIBCPP_HIDE_FROM_ABI bool __tree_invariant(_NodePtr __root) {
152 if (__root == nullptr)
155 if (__root->__parent_ == nullptr)
157 if (!std::__tree_is_left_child(__root))
160 if (!__root->__is_black_)
163 return std::__tree_sub_invariant(__root) != 0;
274 // Effects: Rebalances __root after attaching __x to a leaf.
276 // __x == __root or == a direct or indirect child of __root.
277 // If __x were to be unlinked from __root (setting __root to
278 // nullptr if __root == __x), __tree_invariant(__root) == true.
280 // may be different than the value passed in as __root.
282 _LIBCPP_HIDE_FROM_ABI void __tree_balance_after_insert(_NodePtr __root, _NodePtr __x) _NOEXCEPT {
283 _LIBCPP_ASSERT_INTERNAL(__root != nullptr, "Root of the tree shouldn't be null");
285 __x->__is_black_ = __x == __root;
286 while (__x != __root && !__x->__parent_unsafe()->__is_black_) {
287 // __x->__parent_ != __root because __x->__parent_->__is_black == false
294 __x->__is_black_ = __x == __root;
314 __x->__is_black_ = __x == __root;
332 // Precondition: __z == __root or == a direct or indirect child of __root.
333 // Effects: unlinks __z from the tree rooted at __root, rebalancing as needed.
336 // may be different than the value passed in as __root.
338 _LIBCPP_HIDE_FROM_ABI void __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT {
339 _LIBCPP_ASSERT_INTERNAL(__root != nullptr, "Root node should not be null");
341 _LIBCPP_ASSERT_INTERNAL(std::__tree_invariant(__root), "The tree invariants should hold");
356 if (__y != __root)
359 __root = __x; // __w == nullptr
381 if (__root == __z)
382 __root = __y;
386 if (__removed_black && __root != nullptr) {
390 // If __x is __root (in which case it can't be null), it is supposed
398 // if (__x == __root || __x != nullptr && !__x->__is_black_)
415 // reset __root only if necessary
416 if (__root == __w->__left_)
417 __root = __w;
427 if (__x == __root || !__x->__is_black_) {
458 // reset __root only if necessary
459 if (__root == __w->__right_)
460 __root = __w;
470 if (!__x->__is_black_ || __x == __root) {
971 _LIBCPP_HIDE_FROM_ABI __node_pointer __root() const _NOEXCEPT {
1199 return __lower_bound(__v, __root(), __end_node());
1202 …_LIBCPP_HIDE_FROM_ABI iterator __lower_bound(const _Key& __v, __node_pointer __root, __iter_pointe…
1205 return __lower_bound(__v, __root(), __end_node());
1209 __lower_bound(const _Key& __v, __node_pointer __root, __iter_pointer __result) const;
1212 return __upper_bound(__v, __root(), __end_node());
1215 …_LIBCPP_HIDE_FROM_ABI iterator __upper_bound(const _Key& __v, __node_pointer __root, __iter_pointe…
1218 return __upper_bound(__v, __root(), __end_node());
1222 __upper_bound(const _Key& __v, __node_pointer __root, __iter_pointer __result) const;
1539 destroy(__root());
1579 destroy(__root());
1591 __node_pointer __nd = __root();
1621 __node_pointer __nd = __root();
1683 __node_pointer __nd = __root();
2088 iterator __p = __lower_bound(__v, __root(), __end_node());
2098 const_iterator __p = __lower_bound(__v, __root(), __end_node());
2108 __node_pointer __rt = __root();
2125 __node_pointer __rt = __root();
2143 __tree<_Tp, _Compare, _Allocator>::__lower_bound(const _Key& __v, __node_pointer __root, __iter_poi…
2144 while (__root != nullptr) {
2145 if (!value_comp()(__root->__value_, __v)) {
2146 __result = static_cast<__iter_pointer>(__root);
2147 __root = static_cast<__node_pointer>(__root->__left_);
2149 __root = static_cast<__node_pointer>(__root->__right_);
2157 const _Key& __v, __node_pointer __root, __iter_pointer __result) const {
2158 while (__root != nullptr) {
2159 if (!value_comp()(__root->__value_, __v)) {
2160 __result = static_cast<__iter_pointer>(__root);
2161 __root = static_cast<__node_pointer>(__root->__left_);
2163 __root = static_cast<__node_pointer>(__root->__right_);
2171 __tree<_Tp, _Compare, _Allocator>::__upper_bound(const _Key& __v, __node_pointer __root, __iter_poi…
2172 while (__root != nullptr) {
2173 if (value_comp()(__v, __root->__value_)) {
2174 __result = static_cast<__iter_pointer>(__root);
2175 __root = static_cast<__node_pointer>(__root->__left_);
2177 __root = static_cast<__node_pointer>(__root->__right_);
2185 const _Key& __v, __node_pointer __root, __iter_pointer __result) const {
2186 while (__root != nullptr) {
2187 if (value_comp()(__v, __root->__value_)) {
2188 __result = static_cast<__iter_pointer>(__root);
2189 __root = static_cast<__node_pointer>(__root->__left_);
2191 __root = static_cast<__node_pointer>(__root->__right_);
2202 __node_pointer __rt = __root();
2224 __node_pointer __rt = __root();
2246 __node_pointer __rt = __root();
2267 __node_pointer __rt = __root();