#ifndef _LIBCPP_QUEUE
#define _LIBCPP_QUEUE
#include <__algorithm/make_heap.h>
#include <__algorithm/pop_heap.h>
#include <__algorithm/push_heap.h>
#include <__algorithm/ranges_copy.h>
#include <__config>
#include <__functional/operations.h>
#include <__fwd/deque.h>
#include <__fwd/queue.h>
#include <__iterator/back_insert_iterator.h>
#include <__iterator/iterator_traits.h>
#include <__memory/uses_allocator.h>
#include <__ranges/access.h>
#include <__ranges/concepts.h>
#include <__ranges/container_compatible_range.h>
#include <__ranges/from_range.h>
#include <__utility/forward.h>
#include <deque>
#include <vector>
#include <version>
#include <compare>
#include <initializer_list>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Container>
_LIBCPP_HIDE_FROM_ABI bool operator==(const queue<_Tp, _Container>& __x, const queue<_Tp, _Container>& __y);
template <class _Tp, class _Container>
_LIBCPP_HIDE_FROM_ABI bool operator<(const queue<_Tp, _Container>& __x, const queue<_Tp, _Container>& __y);
template <class _Tp, class _Container >
class _LIBCPP_TEMPLATE_VIS queue { … };
#if _LIBCPP_STD_VER >= 17
template <class _Container, class = enable_if_t<!__is_allocator<_Container>::value> >
queue(_Container) -> queue<typename _Container::value_type, _Container>;
template <class _Container,
class _Alloc,
class = enable_if_t<!__is_allocator<_Container>::value>,
class = enable_if_t<uses_allocator<_Container, _Alloc>::value> >
queue(_Container, _Alloc) -> queue<typename _Container::value_type, _Container>;
#endif
#if _LIBCPP_STD_VER >= 23
template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0>
queue(_InputIterator, _InputIterator) -> queue<__iter_value_type<_InputIterator>>;
template <ranges::input_range _Range>
queue(from_range_t, _Range&&) -> queue<ranges::range_value_t<_Range>>;
template <class _InputIterator,
class _Alloc,
__enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0,
__enable_if_t<__is_allocator<_Alloc>::value, int> = 0>
queue(_InputIterator,
_InputIterator,
_Alloc) -> queue<__iter_value_type<_InputIterator>, deque<__iter_value_type<_InputIterator>, _Alloc>>;
template <ranges::input_range _Range, class _Alloc, __enable_if_t<__is_allocator<_Alloc>::value, int> = 0>
queue(from_range_t,
_Range&&,
_Alloc) -> queue<ranges::range_value_t<_Range>, deque<ranges::range_value_t<_Range>, _Alloc>>;
#endif
template <class _Tp, class _Container>
inline _LIBCPP_HIDE_FROM_ABI bool operator==(const queue<_Tp, _Container>& __x, const queue<_Tp, _Container>& __y) { … }
template <class _Tp, class _Container>
inline _LIBCPP_HIDE_FROM_ABI bool operator<(const queue<_Tp, _Container>& __x, const queue<_Tp, _Container>& __y) { … }
template <class _Tp, class _Container>
inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const queue<_Tp, _Container>& __x, const queue<_Tp, _Container>& __y) { … }
template <class _Tp, class _Container>
inline _LIBCPP_HIDE_FROM_ABI bool operator>(const queue<_Tp, _Container>& __x, const queue<_Tp, _Container>& __y) { … }
template <class _Tp, class _Container>
inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const queue<_Tp, _Container>& __x, const queue<_Tp, _Container>& __y) { … }
template <class _Tp, class _Container>
inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const queue<_Tp, _Container>& __x, const queue<_Tp, _Container>& __y) { … }
#if _LIBCPP_STD_VER >= 20
template <class _Tp, three_way_comparable _Container>
_LIBCPP_HIDE_FROM_ABI compare_three_way_result_t<_Container>
operator<=>(const queue<_Tp, _Container>& __x, const queue<_Tp, _Container>& __y) { … }
#endif
template <class _Tp, class _Container, __enable_if_t<__is_swappable_v<_Container>, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI void swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) { … }
uses_allocator<queue<_Tp, _Container>, _Alloc>;
template <class _Tp, class _Container, class _Compare>
class _LIBCPP_TEMPLATE_VIS priority_queue { … };
#if _LIBCPP_STD_VER >= 17
template <class _Compare,
class _Container,
class = enable_if_t<!__is_allocator<_Compare>::value>,
class = enable_if_t<!__is_allocator<_Container>::value> >
priority_queue(_Compare, _Container) -> priority_queue<typename _Container::value_type, _Container, _Compare>;
template <class _InputIterator,
class _Compare = less<__iter_value_type<_InputIterator>>,
class _Container = vector<__iter_value_type<_InputIterator>>,
class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
class = enable_if_t<!__is_allocator<_Compare>::value>,
class = enable_if_t<!__is_allocator<_Container>::value> >
priority_queue(_InputIterator, _InputIterator, _Compare = _Compare(), _Container = _Container())
-> priority_queue<__iter_value_type<_InputIterator>, _Container, _Compare>;
template <class _Compare,
class _Container,
class _Alloc,
class = enable_if_t<!__is_allocator<_Compare>::value>,
class = enable_if_t<!__is_allocator<_Container>::value>,
class = enable_if_t<uses_allocator<_Container, _Alloc>::value> >
priority_queue(_Compare, _Container, _Alloc) -> priority_queue<typename _Container::value_type, _Container, _Compare>;
template <class _InputIterator,
class _Allocator,
class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
class = enable_if_t<__is_allocator<_Allocator>::value> >
priority_queue(_InputIterator, _InputIterator, _Allocator)
-> priority_queue<__iter_value_type<_InputIterator>,
vector<__iter_value_type<_InputIterator>, _Allocator>,
less<__iter_value_type<_InputIterator>>>;
template <class _InputIterator,
class _Compare,
class _Allocator,
class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
class = enable_if_t<!__is_allocator<_Compare>::value>,
class = enable_if_t<__is_allocator<_Allocator>::value> >
priority_queue(_InputIterator, _InputIterator, _Compare, _Allocator)
-> priority_queue<__iter_value_type<_InputIterator>,
vector<__iter_value_type<_InputIterator>, _Allocator>,
_Compare>;
template <class _InputIterator,
class _Compare,
class _Container,
class _Alloc,
class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
class = enable_if_t<!__is_allocator<_Compare>::value>,
class = enable_if_t<!__is_allocator<_Container>::value>,
class = enable_if_t<uses_allocator<_Container, _Alloc>::value> >
priority_queue(_InputIterator, _InputIterator, _Compare, _Container, _Alloc)
-> priority_queue<typename _Container::value_type, _Container, _Compare>;
#endif
#if _LIBCPP_STD_VER >= 23
template <ranges::input_range _Range,
class _Compare = less<ranges::range_value_t<_Range>>,
class = enable_if_t<!__is_allocator<_Compare>::value>>
priority_queue(from_range_t, _Range&&, _Compare = _Compare())
-> priority_queue<ranges::range_value_t<_Range>, vector<ranges::range_value_t<_Range>>, _Compare>;
template <ranges::input_range _Range,
class _Compare,
class _Alloc,
class = enable_if_t<!__is_allocator<_Compare>::value>,
class = enable_if_t<__is_allocator<_Alloc>::value>>
priority_queue(from_range_t, _Range&&, _Compare, _Alloc)
-> priority_queue<ranges::range_value_t<_Range>, vector<ranges::range_value_t<_Range>, _Alloc>, _Compare>;
template <ranges::input_range _Range, class _Alloc, class = enable_if_t<__is_allocator<_Alloc>::value>>
priority_queue(from_range_t, _Range&&, _Alloc)
-> priority_queue<ranges::range_value_t<_Range>, vector<ranges::range_value_t<_Range>, _Alloc>>;
#endif
template <class _Tp, class _Container, class _Compare>
inline priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp, const container_type& __c)
: … { … }
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
inline priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp, container_type&& __c)
: … { … }
#endif
template <class _Tp, class _Container, class _Compare>
template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> >
inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
_InputIter __f, _InputIter __l, const value_compare& __comp)
: c(__f, __l), comp(__comp) { … }
template <class _Tp, class _Container, class _Compare>
template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> >
inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
_InputIter __f, _InputIter __l, const value_compare& __comp, const container_type& __c)
: c(__c), comp(__comp) { … }
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> >
inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
_InputIter __f, _InputIter __l, const value_compare& __comp, container_type&& __c)
: c(std::move(__c)), comp(__comp) { … }
#endif
template <class _Tp, class _Container, class _Compare>
template <class _Alloc, __enable_if_t<uses_allocator<_Container, _Alloc>::value, int> >
inline priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Alloc& __a) : c(__a) { … }
template <class _Tp, class _Container, class _Compare>
template <class _Alloc, __enable_if_t<uses_allocator<_Container, _Alloc>::value, int> >
inline priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp, const _Alloc& __a)
: c(__a), comp(__comp) { … }
template <class _Tp, class _Container, class _Compare>
template <class _Alloc, __enable_if_t<uses_allocator<_Container, _Alloc>::value, int> >
inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
const value_compare& __comp, const container_type& __c, const _Alloc& __a)
: c(__c, __a), comp(__comp) { … }
template <class _Tp, class _Container, class _Compare>
template <class _Alloc, __enable_if_t<uses_allocator<_Container, _Alloc>::value, int> >
inline priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue& __q, const _Alloc& __a)
: c(__q.c, __a), comp(__q.comp) { … }
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
template <class _Alloc, __enable_if_t<uses_allocator<_Container, _Alloc>::value, int> >
inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
const value_compare& __comp, container_type&& __c, const _Alloc& __a)
: c(std::move(__c), __a), comp(__comp) { … }
template <class _Tp, class _Container, class _Compare>
template <class _Alloc, __enable_if_t<uses_allocator<_Container, _Alloc>::value, int> >
inline priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q, const _Alloc& __a)
: c(std::move(__q.c), __a), comp(std::move(__q.comp)) { … }
#endif
template <class _Tp, class _Container, class _Compare>
template <
class _InputIter,
class _Alloc,
__enable_if_t<__has_input_iterator_category<_InputIter>::value && uses_allocator<_Container, _Alloc>::value, int> >
inline priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l, const _Alloc& __a)
: c(__f, __l, __a), comp() { … }
template <class _Tp, class _Container, class _Compare>
template <
class _InputIter,
class _Alloc,
__enable_if_t<__has_input_iterator_category<_InputIter>::value && uses_allocator<_Container, _Alloc>::value, int> >
inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
_InputIter __f, _InputIter __l, const value_compare& __comp, const _Alloc& __a)
: c(__f, __l, __a), comp(__comp) { … }
template <class _Tp, class _Container, class _Compare>
template <
class _InputIter,
class _Alloc,
__enable_if_t<__has_input_iterator_category<_InputIter>::value && uses_allocator<_Container, _Alloc>::value, int> >
inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
_InputIter __f, _InputIter __l, const value_compare& __comp, const container_type& __c, const _Alloc& __a)
: c(__c, __a), comp(__comp) { … }
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
template <
class _InputIter,
class _Alloc,
__enable_if_t<__has_input_iterator_category<_InputIter>::value && uses_allocator<_Container, _Alloc>::value, int> >
inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
_InputIter __f, _InputIter __l, const value_compare& __comp, container_type&& __c, const _Alloc& __a)
: c(std::move(__c), __a), comp(__comp) { … }
#endif
template <class _Tp, class _Container, class _Compare>
inline void priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v) { … }
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
inline void priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v) { … }
template <class _Tp, class _Container, class _Compare>
template <class... _Args>
inline void priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args) { … }
#endif
template <class _Tp, class _Container, class _Compare>
inline void priority_queue<_Tp, _Container, _Compare>::pop() { … }
template <class _Tp, class _Container, class _Compare>
inline void priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q)
_NOEXCEPT_(__is_nothrow_swappable_v<container_type>&& __is_nothrow_swappable_v<value_compare>) { … }
template <class _Tp,
class _Container,
class _Compare,
__enable_if_t<__is_swappable_v<_Container> && __is_swappable_v<_Compare>, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI void
swap(priority_queue<_Tp, _Container, _Compare>& __x, priority_queue<_Tp, _Container, _Compare>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) { … }
uses_allocator<priority_queue<_Tp, _Container, _Compare>, _Alloc>;
_LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <concepts>
# include <cstdlib>
# include <functional>
# include <type_traits>
#endif
#endif