mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2026-01-06 22:48:25 +01:00
intrusive_list: Add size querying
Since we store pointers and have an interface for iterators set up, the count is just the distance from the beginning to the end of the list. Nice thing is that because of this, basic blocks also get the ability to have a size count without needing to do anything directly.
This commit is contained in:
parent
2180a4be7a
commit
d5805cc6eb
2 changed files with 10 additions and 0 deletions
|
|
@ -216,6 +216,14 @@ public:
|
|||
return root->next == root.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the total number of elements within this list.
|
||||
* @return the number of elements in this list.
|
||||
*/
|
||||
size_type size() const {
|
||||
return static_cast<size_type>(std::distance(begin(), end()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a reference to the node at the front of the list.
|
||||
* @note Must not be called on an empty list.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue