]>
Dogcows Code - chaz/openbox/blob - timerqueue.hh
5a531ebe0723601af5dd5861950a39a88d068c57
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef __timerqueue_hh
3 #define __timerqueue_hh
15 template <class _Tp
, class _Sequence
, class _Compare
>
16 class _timer_queue
: protected std::priority_queue
<_Tp
, _Sequence
, _Compare
> {
18 typedef std::priority_queue
<_Tp
, _Sequence
, _Compare
> _Base
;
20 _timer_queue(): _Base() {}
23 void release(const _Tp
& value
) {
24 c
.erase(std::remove(c
.begin(), c
.end(), value
), c
.end());
25 // after removing the item we need to make the heap again
26 std::make_heap(c
.begin(), c
.end(), comp
);
28 bool empty() const { return _Base::empty(); }
29 size_t size() const { return _Base::size(); }
30 void push(const _Tp
& value
) { _Base::push(value
); }
31 void pop() { _Base::pop(); }
32 const _Tp
& top() const { return _Base::top(); }
35 _timer_queue(const _timer_queue
&) {}
36 _timer_queue
& operator=(const _timer_queue
&) {}
39 struct TimerLessThan
{
40 bool operator()(const Timer
* const l
, const Timer
* const r
) const {
45 typedef _timer_queue
<Timer
*, std::vector
<Timer
*>, TimerLessThan
> TimerQueue
;
49 #endif // DOXYGEN_IGNORE
51 #endif // __timerqueue_hh
This page took 0.035959 seconds and 3 git commands to generate.