Changeset 4f22d0c3 in mainline
- Timestamp:
- 2018-07-05T21:41:23Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- cf573ec
- Parents:
- 27f1bc0
- git-author:
- Dzejrou <dzejrou@…> (2018-05-13 23:27:05)
- git-committer:
- Dzejrou <dzejrou@…> (2018-07-05 21:41:23)
- Location:
- uspace/lib/cpp/include/internal
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/cpp/include/internal/rbtree.hpp
r27f1bc0 r4f22d0c3 125 125 iterator end() 126 126 { 127 return iterator{find_largest_(), true}; 127 /** 128 * In case we have lists of nodes 129 * we need to get the actual end 130 * from the largest node. 131 */ 132 auto res = find_largest_(); 133 if (res) 134 return iterator{res->get_end(), true}; 135 else 136 return iterator{res, true}; 128 137 } 129 138 … … 160 169 const_iterator cend() const 161 170 { 162 return const_iterator{find_largest_(), true}; 171 auto res = find_largest_(); 172 if (res) 173 return const_iterator{res->get_end(), true}; 174 else 175 return const_iterator{res, true}; 163 176 } 164 177 -
uspace/lib/cpp/include/internal/rbtree_node.hpp
r27f1bc0 r4f22d0c3 401 401 } 402 402 403 rbtree_single_node* get_end() 404 { 405 return this; 406 } 407 408 const rbtree_single_node* get_end() const 409 { 410 return this; 411 } 412 403 413 ~rbtree_single_node() 404 414 { … … 428 438 rbtree_multi_node(Args&&... args) 429 439 : value{forward<Args>(args)...}, color{rbcolor::red}, 430 parent_{}, left_{}, right_{}, next_{}, first_{this} 431 { /* DUMMY BODY */ } 440 parent_{}, left_{}, right_{}, next_{}, first_{} 441 { 442 first_ = this; 443 } 432 444 433 445 rbtree_multi_node* parent() const … … 615 627 } 616 628 629 rbtree_multi_node* get_end() 630 { 631 return const_cast<rbtree_multi_node*>( 632 const_cast<const rbtree_multi_node*>(this)->get_end() 633 ); 634 } 635 636 const rbtree_multi_node* get_end() const 637 { 638 if (!next_) 639 return this; 640 else 641 { 642 auto tmp = next_; 643 while (tmp->next_) 644 tmp = tmp->next_; 645 646 return tmp; 647 } 648 } 649 617 650 ~rbtree_multi_node() 618 651 { … … 620 653 if (left_) 621 654 delete left_; 622 if (right )655 if (right_) 623 656 delete right_; 624 657
Note:
See TracChangeset
for help on using the changeset viewer.