[Zion/Glacier] Add a HashMap to store process capabilities.
This commit is contained in:
parent
6756d25e5c
commit
6e227e1cf6
5 changed files with 271 additions and 31 deletions
|
|
@ -23,6 +23,8 @@ class LinkedList {
|
|||
|
||||
T PopFront();
|
||||
|
||||
void Remove(const T& item);
|
||||
|
||||
void PushFront(const T& item);
|
||||
void PushFront(T&& item);
|
||||
|
||||
|
|
@ -53,7 +55,9 @@ class LinkedList {
|
|||
};
|
||||
|
||||
Iterator begin() { return {front_}; }
|
||||
const Iterator begin() const { return {front_}; }
|
||||
Iterator end() { return {nullptr}; }
|
||||
const Iterator end() const { return {nullptr}; }
|
||||
|
||||
private:
|
||||
uint64_t size_ = 0;
|
||||
|
|
@ -123,4 +127,21 @@ T LinkedList<T>::PopFront() {
|
|||
return Move(ret);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void LinkedList<T>::Remove(const T& item) {
|
||||
if (front_->item == item) {
|
||||
PopFront();
|
||||
return;
|
||||
}
|
||||
ListItem* iter = front_;
|
||||
while (iter != nullptr) {
|
||||
if (iter->next != nullptr && iter->next->item == item) {
|
||||
iter->next = iter->next->next;
|
||||
size_--;
|
||||
return;
|
||||
}
|
||||
iter = iter->next;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace glcr
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue