Changeset 7320ca6 in mainline
- Timestamp:
- 2018-07-05T21:41:21Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1d5424a
- Parents:
- f67b4ef
- git-author:
- Dzejrou <dzejrou@…> (2018-04-23 20:33:48)
- git-committer:
- Dzejrou <dzejrou@…> (2018-07-05 21:41:21)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/cpp/include/internal/hash_table.hpp
rf67b4ef r7320ca6 81 81 Size size() const noexcept 82 82 { 83 // TODO: implement 83 auto current = head; 84 Size res{}; 85 86 do 87 { 88 ++res; 89 current = current->next; 90 } 91 while (current != head); 92 93 return res; 84 94 } 85 95 … … 92 102 } 93 103 104 void clear() 105 { 106 auto current = head; 107 do 108 { 109 auto tmp = current; 110 current = current->next; 111 delete tmp; 112 } 113 while (current != head); 114 115 head = nullptr; 116 } 117 94 118 ~hash_table_bucket() 95 119 { 96 // TODO: deallocate the entire list120 clear(); 97 121 } 98 122 }; … … 758 782 void clear() noexcept 759 783 { 760 delete[] table_;761 784 for (size_type i = 0; i < bucket_count_; ++i) 785 table_[i].clear(); 762 786 size_ = size_type{}; 763 table_ = new hash_table_bucket<value_type, size_type>[bucket_count_];764 787 } 765 788
Note:
See TracChangeset
for help on using the changeset viewer.