util/IntrusiveSortedList: new class
This commit is contained in:
@@ -54,15 +54,7 @@ TimerList::~TimerList() noexcept
|
||||
void
|
||||
TimerList::Insert(FineTimerEvent &t) noexcept
|
||||
{
|
||||
#ifdef NO_BOOST
|
||||
auto i = std::find_if(timers.begin(), timers.end(), [due = t.GetDue()](const auto &other){
|
||||
return other.GetDue() >= due;
|
||||
});
|
||||
|
||||
timers.insert(i, t);
|
||||
#else
|
||||
timers.insert(t);
|
||||
#endif
|
||||
}
|
||||
|
||||
Event::Duration
|
||||
|
||||
@@ -34,9 +34,10 @@
|
||||
|
||||
#include "Chrono.hxx"
|
||||
#include "event/Features.h"
|
||||
#include "util/IntrusiveList.hxx"
|
||||
|
||||
#ifndef NO_BOOST
|
||||
#ifdef NO_BOOST
|
||||
#include "util/IntrusiveSortedList.hxx"
|
||||
#else
|
||||
#include <boost/intrusive/set.hpp>
|
||||
#endif
|
||||
|
||||
@@ -55,7 +56,7 @@ class TimerList final {
|
||||
/* when building without Boost, then this is just a sorted
|
||||
doubly-linked list - this doesn't scale well, but is good
|
||||
enough for most programs */
|
||||
IntrusiveList<FineTimerEvent> timers;
|
||||
IntrusiveSortedList<FineTimerEvent, Compare> timers;
|
||||
#else
|
||||
boost::intrusive::multiset<FineTimerEvent,
|
||||
boost::intrusive::base_hook<boost::intrusive::set_base_hook<boost::intrusive::link_mode<boost::intrusive::auto_unlink>>>,
|
||||
|
||||
Reference in New Issue
Block a user