mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 10:27:34 +00:00
IntrusiveList: Make Iterator::operator* return a T&
This makes iteration a little more pleasant :^)
This commit is contained in:
parent
6b81d8de70
commit
e3f3c980bf
2 changed files with 7 additions and 7 deletions
|
@ -32,7 +32,7 @@ public:
|
||||||
Iterator();
|
Iterator();
|
||||||
Iterator(T* value);
|
Iterator(T* value);
|
||||||
|
|
||||||
T* operator*() const;
|
T& operator*() const;
|
||||||
T* operator->() const;
|
T* operator->() const;
|
||||||
bool operator==(const Iterator& other) const;
|
bool operator==(const Iterator& other) const;
|
||||||
bool operator!=(const Iterator& other) const { return !(*this == other); }
|
bool operator!=(const Iterator& other) const { return !(*this == other); }
|
||||||
|
@ -78,9 +78,9 @@ inline IntrusiveList<T, member>::Iterator::Iterator(T* value)
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, IntrusiveListNode T::*member>
|
template<class T, IntrusiveListNode T::*member>
|
||||||
inline T* IntrusiveList<T, member>::Iterator::operator*() const
|
inline T& IntrusiveList<T, member>::Iterator::operator*() const
|
||||||
{
|
{
|
||||||
return m_value;
|
return *m_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, IntrusiveListNode T::*member>
|
template<class T, IntrusiveListNode T::*member>
|
||||||
|
|
|
@ -405,9 +405,9 @@ inline IterationDecision Scheduler::for_each_runnable(Callback callback)
|
||||||
ASSERT_INTERRUPTS_DISABLED();
|
ASSERT_INTERRUPTS_DISABLED();
|
||||||
auto& tl = g_scheduler_data->m_runnable_threads;
|
auto& tl = g_scheduler_data->m_runnable_threads;
|
||||||
for (auto it = tl.begin(); it != tl.end();) {
|
for (auto it = tl.begin(); it != tl.end();) {
|
||||||
auto thread = *it;
|
auto& thread = *it;
|
||||||
it = ++it;
|
it = ++it;
|
||||||
if (callback(*thread) == IterationDecision::Break)
|
if (callback(thread) == IterationDecision::Break)
|
||||||
return IterationDecision::Break;
|
return IterationDecision::Break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -420,9 +420,9 @@ inline IterationDecision Scheduler::for_each_nonrunnable(Callback callback)
|
||||||
ASSERT_INTERRUPTS_DISABLED();
|
ASSERT_INTERRUPTS_DISABLED();
|
||||||
auto& tl = g_scheduler_data->m_nonrunnable_threads;
|
auto& tl = g_scheduler_data->m_nonrunnable_threads;
|
||||||
for (auto it = tl.begin(); it != tl.end();) {
|
for (auto it = tl.begin(); it != tl.end();) {
|
||||||
auto thread = *it;
|
auto& thread = *it;
|
||||||
it = ++it;
|
it = ++it;
|
||||||
if (callback(*thread) == IterationDecision::Break)
|
if (callback(thread) == IterationDecision::Break)
|
||||||
return IterationDecision::Break;
|
return IterationDecision::Break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue