5#ifndef WPIUTIL_WPI_PRIORITY_QUEUE_H_
6#define WPIUTIL_WPI_PRIORITY_QUEUE_H_
24template <
typename T,
typename Sequence = std::vector<T>,
25 typename Compare = std::less<
typename Sequence::value_type>>
26 requires std::same_as<T, typename Sequence::value_type>
36 template <
typename Seq = Sequence>
37 requires std::default_initializable<Compare> &&
38 std::default_initializable<Seq>
42 std::make_heap(
c.begin(),
c.end(),
comp);
47 std::make_heap(
c.begin(),
c.end(),
comp);
50 template <
typename InputIterator>
55 std::make_heap(
c.begin(),
c.end(),
comp);
58 template <
typename InputIterator>
63 std::make_heap(
c.begin(),
c.end(),
comp);
77 std::push_heap(
c.begin(),
c.end(),
comp);
81 c.push_back(std::move(value));
82 std::push_heap(
c.begin(),
c.end(),
comp);
85 template <
typename... Args>
87 c.emplace_back(std::forward<Args>(args)...);
88 std::push_heap(
c.begin(),
c.end(),
comp);
92 std::pop_heap(
c.begin(),
c.end(),
comp);
93 auto ret = std::move(
c.back());
100 if (it != this->c.end()) {
102 std::make_heap(
c.begin(),
c.end(),
comp);
This class is the same as std::priority_queue with two changes:
Definition: priority_queue.h:27
typename Sequence::size_type size_type
Definition: priority_queue.h:32
void emplace(Args &&... args)
Definition: priority_queue.h:86
typename Sequence::value_type value_type
Definition: priority_queue.h:29
typename Sequence::const_reference const_reference
Definition: priority_queue.h:31
priority_queue(const Compare &comp, const Sequence &c)
Definition: priority_queue.h:41
bool remove(const T &value)
Definition: priority_queue.h:98
void push(const value_type &value)
Definition: priority_queue.h:75
priority_queue(InputIterator first, InputIterator last, const Compare &comp=Compare{}, Sequence &&c=Sequence{})
Definition: priority_queue.h:59
T pop()
Definition: priority_queue.h:91
bool empty() const
Definition: priority_queue.h:67
Sequence c
Definition: priority_queue.h:110
priority_queue()
Definition: priority_queue.h:39
Compare value_compare
Definition: priority_queue.h:34
Compare comp
Definition: priority_queue.h:111
void push(value_type &&value)
Definition: priority_queue.h:80
priority_queue(InputIterator first, InputIterator last, const Compare &comp, const Sequence &c)
Definition: priority_queue.h:51
const_reference top() const
Definition: priority_queue.h:73
priority_queue(const Compare &comp, Sequence &&c=Sequence{})
Definition: priority_queue.h:45
size_type size() const
Definition: priority_queue.h:71
typename Sequence::reference reference
Definition: priority_queue.h:30
Sequence container_type
Definition: priority_queue.h:33
FMT_CONSTEXPR auto find(Ptr first, Ptr last, T value, Ptr &out) -> bool
Definition: core.h:2120
const T & first(const T &value, const Tail &...)
Definition: compile.h:60
CommandPtr Sequence(std::vector< CommandPtr > &&commands)
Runs a group of commands in series, one after the other.
Definition: ntcore_cpp.h:26