5#ifndef WPIUTIL_WPI_PRIORITY_QUEUE_H_
6#define WPIUTIL_WPI_PRIORITY_QUEUE_H_
23template <
typename T,
typename Sequence = std::vector<T>,
24 typename Compare = std::less<
typename Sequence::value_type>>
27 static_assert(std::is_same_v<T, typename Sequence::value_type>,
28 "value_type must be the same as the underlying container");
39 std::is_default_constructible<Compare>{} &&
40 std::is_default_constructible<Seq>{}>>
44 std::make_heap(
c.begin(),
c.end(),
comp);
49 std::make_heap(
c.begin(),
c.end(),
comp);
52 template <
typename InputIterator>
57 std::make_heap(
c.begin(),
c.end(),
comp);
60 template <
typename InputIterator>
65 std::make_heap(
c.begin(),
c.end(),
comp);
68 [[nodiscard]]
bool empty()
const {
return c.empty(); }
76 std::push_heap(
c.begin(),
c.end(),
comp);
80 c.push_back(std::move(
value));
81 std::push_heap(
c.begin(),
c.end(),
comp);
84 template <
typename... Args>
86 c.emplace_back(std::forward<Args>(args)...);
87 std::push_heap(
c.begin(),
c.end(),
comp);
91 std::pop_heap(
c.begin(),
c.end(),
comp);
92 auto ret = std::move(
c.back());
99 if (it != this->c.end()) {
101 std::make_heap(
c.begin(),
c.end(),
comp);
This class is the same as std::priority_queue with two changes:
Definition: priority_queue.h:25
typename Sequence::size_type size_type
Definition: priority_queue.h:33
void emplace(Args &&... args)
Definition: priority_queue.h:85
typename Sequence::value_type value_type
Definition: priority_queue.h:30
typename Sequence::const_reference const_reference
Definition: priority_queue.h:32
priority_queue(const Compare &comp, const Sequence &c)
Definition: priority_queue.h:43
bool remove(const T &value)
Definition: priority_queue.h:97
void push(const value_type &value)
Definition: priority_queue.h:74
priority_queue(InputIterator first, InputIterator last, const Compare &comp=Compare{}, Sequence &&c=Sequence{})
Definition: priority_queue.h:61
T pop()
Definition: priority_queue.h:90
priority_queue()
Definition: priority_queue.h:41
bool empty() const
Definition: priority_queue.h:68
Sequence c
Definition: priority_queue.h:109
Compare value_compare
Definition: priority_queue.h:35
Compare comp
Definition: priority_queue.h:110
void push(value_type &&value)
Definition: priority_queue.h:79
priority_queue(InputIterator first, InputIterator last, const Compare &comp, const Sequence &c)
Definition: priority_queue.h:53
const_reference top() const
Definition: priority_queue.h:72
priority_queue(const Compare &comp, Sequence &&c=Sequence{})
Definition: priority_queue.h:47
size_type size() const
Definition: priority_queue.h:70
typename Sequence::reference reference
Definition: priority_queue.h:31
Sequence container_type
Definition: priority_queue.h:34
typename std::enable_if< B, T >::type enable_if_t
Definition: core.h:298
FMT_CONSTEXPR auto find(Ptr first, Ptr last, T value, Ptr &out) -> bool
Definition: core.h:2318
static const symbolic::SymbolExpr< internal::symbolic_last_tag > last
Can be used as a parameter to Eigen::seq and Eigen::seqN functions to symbolically reference the last...
Definition: IndexedViewHelper.h:38
EIGEN_CONSTEXPR Index first(const T &x) EIGEN_NOEXCEPT
Definition: IndexedViewHelper.h:81
CommandPtr Sequence(std::vector< CommandPtr > &&commands)
Runs a group of commands in series, one after the other.
/file This file defines the SmallVector class.
Definition: AprilTagFieldLayout.h:18