util/IntrusiveList: add size()
This commit is contained in:
parent
1fb858e2d7
commit
e437cc4faf
@ -207,6 +207,8 @@ class IntrusiveList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
using size_type = std::size_t;
|
||||||
|
|
||||||
constexpr IntrusiveList() noexcept = default;
|
constexpr IntrusiveList() noexcept = default;
|
||||||
|
|
||||||
IntrusiveList(IntrusiveList &&src) noexcept {
|
IntrusiveList(IntrusiveList &&src) noexcept {
|
||||||
@ -255,6 +257,10 @@ public:
|
|||||||
return head.next == &head;
|
return head.next == &head;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr size_type size() const noexcept {
|
||||||
|
return std::distance(begin(), end());
|
||||||
|
}
|
||||||
|
|
||||||
void clear() noexcept {
|
void clear() noexcept {
|
||||||
if constexpr (std::is_base_of<SafeLinkIntrusiveListHook, T>::value) {
|
if constexpr (std::is_base_of<SafeLinkIntrusiveListHook, T>::value) {
|
||||||
/* for SafeLinkIntrusiveListHook, we need to
|
/* for SafeLinkIntrusiveListHook, we need to
|
||||||
|
Loading…
Reference in New Issue
Block a user