Changeset 7452b155 in mainline for uspace/lib/cpp/include/impl/list.hpp
- Timestamp:
- 2018-07-05T21:41:24Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 91ac0bb
- Parents:
- c300bb5
- git-author:
- Dzejrou <dzejrou@…> (2018-05-17 16:51:33)
- git-committer:
- Dzejrou <dzejrou@…> (2018-07-05 21:41:24)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/cpp/include/impl/list.hpp
rc300bb5 r7452b155 71 71 72 72 list_const_iterator(const list_iterator<T>& other) 73 : current_{other.node()}, head_{other.head()} 73 : current_{other.node()}, head_{other.head()}, end_{other.end()} 74 74 { /* DUMMY BODY */ } 75 75 … … 307 307 template<class T> 308 308 bool operator!=(const list_iterator<T>& lhs, const list_iterator<T>& rhs) 309 { 310 return !(lhs == rhs); 311 } 312 313 template<class T> 314 bool operator==(const list_const_iterator<T>& lhs, const list_iterator<T>& rhs) 315 { 316 return (lhs.node() == rhs.node()) && (lhs.end() == rhs.end()); 317 } 318 319 template<class T> 320 bool operator!=(const list_const_iterator<T>& lhs, const list_iterator<T>& rhs) 321 { 322 return !(lhs == rhs); 323 } 324 325 template<class T> 326 bool operator==(const list_iterator<T>& lhs, const list_const_iterator<T>& rhs) 327 { 328 return (lhs.node() == rhs.node()) && (lhs.end() == rhs.end()); 329 } 330 331 template<class T> 332 bool operator!=(const list_iterator<T>& lhs, const list_const_iterator<T>& rhs) 309 333 { 310 334 return !(lhs == rhs); … … 874 898 return; 875 899 876 if (first .node() == other.head_ && !last.node())900 if (first == other.begin() && last == other.end()) 877 901 { // [first, last) is everything in other. 878 902 splice(position, other); … … 884 908 aux::list_node<value_type>* last_node{}; 885 909 886 if (first .node() == other.head_)910 if (first == other.begin()) 887 911 { // The range is a prefix of other. 888 912 other.head_ = last.node(); … … 893 917 last_node = last.node()->prev; 894 918 } 895 else if ( !last.node())919 else if (last == other.end()) 896 920 { // The range is a suffix of other. 897 921 auto new_last = first.node()->prev; … … 928 952 } 929 953 930 auto count = distance(iterator{first_node}, iterator{last_node}); 954 auto count = distance( 955 iterator{first_node, nullptr, false}, 956 iterator{last_node, nullptr, false} 957 ); 958 ++count; 959 931 960 size_ += count; 932 961 other.size_ -= count;
Note:
See TracChangeset
for help on using the changeset viewer.