mirror of
https://github.com/momo5502/hypervisor.git
synced 2025-04-19 13:42:55 +00:00
Optimize list
This commit is contained in:
parent
129380419d
commit
dcab775bb9
@ -52,6 +52,24 @@ namespace utils
|
||||
return *this;
|
||||
}
|
||||
|
||||
iterator operator+(const size_t num) const
|
||||
{
|
||||
auto entry = this->entry_;
|
||||
|
||||
for (size_t i = 0; i < num; ++i)
|
||||
{
|
||||
if (!entry)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
entry = entry->next;
|
||||
}
|
||||
|
||||
|
||||
return {entry};
|
||||
}
|
||||
|
||||
private:
|
||||
ListEntry* entry_{nullptr};
|
||||
|
||||
@ -269,7 +287,7 @@ namespace utils
|
||||
this->object_allocator_.free(list_entry->entry_base);
|
||||
this->list_allocator_.free(list_entry->this_base);
|
||||
|
||||
return iterator(*inseration_point);
|
||||
return { *inseration_point };
|
||||
}
|
||||
|
||||
throw std::runtime_error("Bad iterator");
|
||||
|
Loading…
x
Reference in New Issue
Block a user