Upgrade to 2022-era LLVM LIBCXX

This commit is contained in:
Justine Tunney 2024-05-27 02:12:27 -07:00
parent 2f4ca71f26
commit 8e68384e15
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
2078 changed files with 165657 additions and 65010 deletions

View file

@ -1,5 +1,5 @@
// -*- C++ -*-
//===--------------------------- queue ------------------------------------===//
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@ -10,18 +10,6 @@
#ifndef _LIBCPP_QUEUE
#define _LIBCPP_QUEUE
#include "third_party/libcxx/__config"
#include "third_party/libcxx/deque"
#include "third_party/libcxx/vector"
#include "third_party/libcxx/functional"
#include "third_party/libcxx/algorithm"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
/*
queue synopsis
@ -53,6 +41,8 @@ public:
explicit queue(const container_type& c);
explicit queue(container_type&& c)
template<class InputIterator>
queue(InputIterator first, InputIterator last); // since C++23
template <class Alloc>
explicit queue(const Alloc& a);
template <class Alloc>
@ -63,6 +53,8 @@ public:
queue(const queue& q, const Alloc& a);
template <class Alloc>
queue(queue&& q, const Alloc& a);
template <class InputIterator, class Alloc>
queue(InputIterator first, InputIterator last, const Alloc&); // since C++23
bool empty() const;
size_type size() const;
@ -83,9 +75,17 @@ public:
template<class Container>
queue(Container) -> queue<typename Container::value_type, Container>; // C++17
template<class InputIterator>
queue(InputIterator, InputIterator) -> queue<iter-value-type<InputIterator>>; // since C++23
template<class Container, class Allocator>
queue(Container, Allocator) -> queue<typename Container::value_type, Container>; // C++17
template<class InputIterator, class Allocator>
queue(InputIterator, InputIterator, Allocator)
-> queue<iter-value-type<InputIterator>,
deque<iter-value-type<InputIterator>, Allocator>>; // since C++23
template <class T, class Container>
bool operator==(const queue<T, Container>& x,const queue<T, Container>& y);
@ -124,37 +124,42 @@ protected:
Compare comp;
public:
priority_queue() = default;
~priority_queue() = default;
priority_queue(const priority_queue& q) = default;
priority_queue(priority_queue&& q) = default;
priority_queue& operator=(const priority_queue& q) = default;
priority_queue& operator=(priority_queue&& q) = default;
explicit priority_queue(const Compare& comp);
priority_queue(const Compare& comp, const container_type& c);
explicit priority_queue(const Compare& comp, container_type&& c);
priority_queue() : priority_queue(Compare()) {} // C++20
explicit priority_queue(const Compare& x) : priority_queue(x, Container()) {}
priority_queue(const Compare& x, const Container&);
explicit priority_queue(const Compare& x = Compare(), Container&& = Container()); // before C++20
priority_queue(const Compare& x, Container&&); // C++20
template <class InputIterator>
priority_queue(InputIterator first, InputIterator last,
const Compare& comp = Compare());
template <class InputIterator>
priority_queue(InputIterator first, InputIterator last,
const Compare& comp, const container_type& c);
const Compare& comp, const Container& c);
template <class InputIterator>
priority_queue(InputIterator first, InputIterator last,
const Compare& comp, container_type&& c);
const Compare& comp, Container&& c);
template <class Alloc>
explicit priority_queue(const Alloc& a);
template <class Alloc>
priority_queue(const Compare& comp, const Alloc& a);
template <class Alloc>
priority_queue(const Compare& comp, const container_type& c,
priority_queue(const Compare& comp, const Container& c,
const Alloc& a);
template <class Alloc>
priority_queue(const Compare& comp, container_type&& c,
priority_queue(const Compare& comp, Container&& c,
const Alloc& a);
template <class InputIterator>
priority_queue(InputIterator first, InputIterator last,
const Alloc& a);
template <class InputIterator>
priority_queue(InputIterator first, InputIterator last,
const Compare& comp, const Alloc& a);
template <class InputIterator>
priority_queue(InputIterator first, InputIterator last,
const Compare& comp, const Container& c, const Alloc& a);
template <class InputIterator>
priority_queue(InputIterator first, InputIterator last,
const Compare& comp, Container&& c, const Alloc& a);
template <class Alloc>
priority_queue(const priority_queue& q, const Alloc& a);
template <class Alloc>
@ -179,15 +184,30 @@ priority_queue(Compare, Container)
-> priority_queue<typename Container::value_type, Container, Compare>; // C++17
template<class InputIterator,
class Compare = less<typename iterator_traits<InputIterator>::value_type>,
class Container = vector<typename iterator_traits<InputIterator>::value_type>>
class Compare = less<iter-value-type<InputIterator>>,
class Container = vector<iter-value-type<InputIterator>>>
priority_queue(InputIterator, InputIterator, Compare = Compare(), Container = Container())
-> priority_queue<typename iterator_traits<InputIterator>::value_type, Container, Compare>; // C++17
-> priority_queue<iter-value-type<InputIterator>, Container, Compare>; // C++17
template<class Compare, class Container, class Allocator>
priority_queue(Compare, Container, Allocator)
-> priority_queue<typename Container::value_type, Container, Compare>; // C++17
template<class InputIterator, class Allocator>
priority_queue(InputIterator, InputIterator, Allocator)
-> priority_queue<iter-value-type<InputIterator>,
vector<iter-value-type<InputIterator>, Allocator>,
less<iter-value-type<InputIterator>>>; // C++17
template<class InputIterator, class Compare, class Allocator>
priority_queue(InputIterator, InputIterator, Compare, Allocator)
-> priority_queue<iter-value-type<InputIterator>,
vector<iter-value-type<InputIterator>, Allocator>, Compare>; // C++17
template<class InputIterator, class Compare, class Container, class Allocator>
priority_queue(InputIterator, InputIterator, Compare, Container, Allocator)
-> priority_queue<typename Container::value_type, Container, Compare>; // C++17
template <class T, class Container, class Compare>
void swap(priority_queue<T, Container, Compare>& x,
priority_queue<T, Container, Compare>& y)
@ -197,6 +217,31 @@ template <class T, class Container, class Compare>
*/
#include <__algorithm/make_heap.h>
#include <__algorithm/pop_heap.h>
#include <__algorithm/push_heap.h>
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
#include <__functional/operations.h>
#include <__iterator/iterator_traits.h>
#include <__memory/uses_allocator.h>
#include <__utility/forward.h>
#include <deque>
#include <vector>
#include <version>
// standard-mandated includes
// [queue.syn]
#include <compare>
#include <initializer_list>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Container = deque<_Tp> > class _LIBCPP_TEMPLATE_VIS queue;
template <class _Tp, class _Container>
@ -232,6 +277,20 @@ public:
_LIBCPP_INLINE_VISIBILITY
queue(const queue& __q) : c(__q.c) {}
#if _LIBCPP_STD_VER >= 23
template <class _InputIterator,
class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>>
_LIBCPP_HIDE_FROM_ABI
queue(_InputIterator __first, _InputIterator __last) : c(__first, __last) {}
template <class _InputIterator,
class _Alloc,
class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
class = __enable_if_t<uses_allocator<container_type, _Alloc>::value>>
_LIBCPP_HIDE_FROM_ABI
queue(_InputIterator __first, _InputIterator __second, const _Alloc& __alloc) : c(__first, __second, __alloc) {}
#endif
_LIBCPP_INLINE_VISIBILITY
queue& operator=(const queue& __q) {c = __q.c; return *this;}
@ -245,47 +304,42 @@ public:
queue& operator=(queue&& __q)
_NOEXCEPT_(is_nothrow_move_assignable<container_type>::value)
{c = _VSTD::move(__q.c); return *this;}
#endif // _LIBCPP_CXX03_LANG
#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
explicit queue(const container_type& __c) : c(__c) {}
#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
explicit queue(container_type&& __c) : c(_VSTD::move(__c)) {}
#endif // _LIBCPP_CXX03_LANG
#endif // _LIBCPP_CXX03_LANG
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
explicit queue(const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
__enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
: c(__a) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
queue(const queue& __q, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
__enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
: c(__q.c, __a) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
queue(const container_type& __c, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
__enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
: c(__c, __a) {}
#ifndef _LIBCPP_CXX03_LANG
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
queue(container_type&& __c, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
__enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
: c(_VSTD::move(__c), __a) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
queue(queue&& __q, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
__enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
: c(_VSTD::move(__q.c), __a) {}
#endif // _LIBCPP_CXX03_LANG
#endif // _LIBCPP_CXX03_LANG
_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
bool empty() const {return c.empty();}
@ -308,14 +362,14 @@ public:
void push(value_type&& __v) {c.push_back(_VSTD::move(__v));}
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
#if _LIBCPP_STD_VER > 14
#if _LIBCPP_STD_VER >= 17
decltype(auto) emplace(_Args&&... __args)
{ return c.emplace_back(_VSTD::forward<_Args>(__args)...);}
#else
void emplace(_Args&&... __args)
{ c.emplace_back(_VSTD::forward<_Args>(__args)...);}
#endif
#endif // _LIBCPP_CXX03_LANG
#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
void pop() {c.pop_front();}
@ -327,6 +381,8 @@ public:
swap(c, __q.c);
}
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const { return c; }
template <class _T1, class _C1>
friend
_LIBCPP_INLINE_VISIBILITY
@ -340,22 +396,36 @@ public:
operator< (const queue<_T1, _C1>& __x,const queue<_T1, _C1>& __y);
};
#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
#if _LIBCPP_STD_VER >= 17
template<class _Container,
class = typename enable_if<!__is_allocator<_Container>::value, nullptr_t>::type
class = enable_if_t<!__is_allocator<_Container>::value>
>
queue(_Container)
-> queue<typename _Container::value_type, _Container>;
template<class _Container,
class _Alloc,
class = typename enable_if<!__is_allocator<_Container>::value, nullptr_t>::type,
class = typename enable_if< __is_allocator<_Alloc>::value, nullptr_t>::type
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,
class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>>
queue(_InputIterator, _InputIterator)
-> queue<__iter_value_type<_InputIterator>>;
template <class _InputIterator,
class _Alloc,
class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
class = __enable_if_t<__is_allocator<_Alloc>::value>>
queue(_InputIterator, _InputIterator, _Alloc)
-> queue<__iter_value_type<_InputIterator>, deque<__iter_value_type<_InputIterator>, _Alloc>>;
#endif
template <class _Tp, class _Container>
inline _LIBCPP_INLINE_VISIBILITY
bool
@ -406,10 +476,7 @@ operator<=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
template <class _Tp, class _Container>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<
__is_swappable<_Container>::value,
void
>::type
__enable_if_t<__is_swappable<_Container>::value, void>
swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
{
@ -465,7 +532,7 @@ public:
_NOEXCEPT_(is_nothrow_move_assignable<container_type>::value &&
is_nothrow_move_assignable<value_compare>::value)
{c = _VSTD::move(__q.c); comp = _VSTD::move(__q.comp); return *this;}
#endif // _LIBCPP_CXX03_LANG
#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
explicit priority_queue(const value_compare& __comp)
@ -474,55 +541,74 @@ public:
priority_queue(const value_compare& __comp, const container_type& __c);
#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
explicit priority_queue(const value_compare& __comp, container_type&& __c);
priority_queue(const value_compare& __comp, container_type&& __c);
#endif
template <class _InputIter>
template <class _InputIter, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
_LIBCPP_INLINE_VISIBILITY
priority_queue(_InputIter __f, _InputIter __l,
const value_compare& __comp = value_compare());
template <class _InputIter>
template <class _InputIter, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
_LIBCPP_INLINE_VISIBILITY
priority_queue(_InputIter __f, _InputIter __l,
const value_compare& __comp, const container_type& __c);
#ifndef _LIBCPP_CXX03_LANG
template <class _InputIter>
template <class _InputIter, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
_LIBCPP_INLINE_VISIBILITY
priority_queue(_InputIter __f, _InputIter __l,
const value_compare& __comp, container_type&& __c);
#endif // _LIBCPP_CXX03_LANG
#endif // _LIBCPP_CXX03_LANG
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
explicit priority_queue(const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0);
__enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
priority_queue(const value_compare& __comp, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0);
__enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
priority_queue(const value_compare& __comp, const container_type& __c,
const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0);
__enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
priority_queue(const priority_queue& __q, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0);
__enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
#ifndef _LIBCPP_CXX03_LANG
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
priority_queue(const value_compare& __comp, container_type&& __c,
const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0);
__enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
priority_queue(priority_queue&& __q, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0);
__enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
#endif // _LIBCPP_CXX03_LANG
template <class _InputIter, class _Alloc, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
_LIBCPP_INLINE_VISIBILITY
priority_queue(_InputIter __f, _InputIter __l, const _Alloc& __a,
__enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
template <class _InputIter, class _Alloc, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
_LIBCPP_INLINE_VISIBILITY
priority_queue(_InputIter __f, _InputIter __l,
const value_compare& __comp, const _Alloc& __a,
__enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
template <class _InputIter, class _Alloc, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
_LIBCPP_INLINE_VISIBILITY
priority_queue(_InputIter __f, _InputIter __l,
const value_compare& __comp, const container_type& __c, const _Alloc& __a,
__enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
#ifndef _LIBCPP_CXX03_LANG
template <class _InputIter, class _Alloc, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
_LIBCPP_INLINE_VISIBILITY
priority_queue(_InputIter __f, _InputIter __l,
const value_compare& __comp, container_type&& __c, const _Alloc& __a,
__enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
#endif // _LIBCPP_CXX03_LANG
_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
@ -540,7 +626,7 @@ public:
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
void emplace(_Args&&... __args);
#endif // _LIBCPP_CXX03_LANG
#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
void pop();
@ -548,36 +634,65 @@ public:
void swap(priority_queue& __q)
_NOEXCEPT_(__is_nothrow_swappable<container_type>::value &&
__is_nothrow_swappable<value_compare>::value);
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const { return c; }
};
#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
#if _LIBCPP_STD_VER >= 17
template <class _Compare,
class _Container,
class = typename enable_if<!__is_allocator<_Compare>::value, nullptr_t>::type,
class = typename enable_if<!__is_allocator<_Container>::value, nullptr_t>::type
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<typename iterator_traits<_InputIterator>::value_type>,
class _Container = vector<typename iterator_traits<_InputIterator>::value_type>,
class = typename enable_if< __is_input_iterator<_InputIterator>::value, nullptr_t>::type,
class = typename enable_if<!__is_allocator<_Compare>::value, nullptr_t>::type,
class = typename enable_if<!__is_allocator<_Container>::value, nullptr_t>::type
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<typename iterator_traits<_InputIterator>::value_type, _Container, _Compare>;
-> priority_queue<__iter_value_type<_InputIterator>, _Container, _Compare>;
template<class _Compare,
class _Container,
class _Alloc,
class = typename enable_if<!__is_allocator<_Compare>::value, nullptr_t>::type,
class = typename enable_if<!__is_allocator<_Container>::value, nullptr_t>::type,
class = typename enable_if< __is_allocator<_Alloc>::value, nullptr_t>::type
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
template <class _Tp, class _Container, class _Compare>
@ -602,10 +717,10 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _
_VSTD::make_heap(c.begin(), c.end(), comp);
}
#endif // _LIBCPP_CXX03_LANG
#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
template <class _InputIter>
template <class _InputIter, class>
inline
priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
const value_compare& __comp)
@ -616,7 +731,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input
}
template <class _Tp, class _Container, class _Compare>
template <class _InputIter>
template <class _InputIter, class>
inline
priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
const value_compare& __comp,
@ -631,7 +746,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
template <class _InputIter>
template <class _InputIter, class>
inline
priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
const value_compare& __comp,
@ -643,14 +758,13 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input
_VSTD::make_heap(c.begin(), c.end(), comp);
}
#endif // _LIBCPP_CXX03_LANG
#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
inline
priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type*)
__enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
: c(__a)
{
}
@ -660,8 +774,7 @@ template <class _Alloc>
inline
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type*)
__enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
: c(__a),
comp(__comp)
{
@ -673,8 +786,7 @@ inline
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
const container_type& __c,
const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type*)
__enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
: c(__c, __a),
comp(__comp)
{
@ -686,12 +798,10 @@ template <class _Alloc>
inline
priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue& __q,
const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type*)
__enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
: c(__q.c, __a),
comp(__q.comp)
{
_VSTD::make_heap(c.begin(), c.end(), comp);
}
#ifndef _LIBCPP_CXX03_LANG
@ -702,8 +812,7 @@ inline
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
container_type&& __c,
const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type*)
__enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
: c(_VSTD::move(__c), __a),
comp(__comp)
{
@ -715,14 +824,67 @@ template <class _Alloc>
inline
priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q,
const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type*)
__enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
: c(_VSTD::move(__q.c), __a),
comp(_VSTD::move(__q.comp))
{
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
template <class _InputIter, class _Alloc, class>
inline
priority_queue<_Tp, _Container, _Compare>::priority_queue(
_InputIter __f, _InputIter __l, const _Alloc& __a,
__enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
: c(__f, __l, __a),
comp()
{
_VSTD::make_heap(c.begin(), c.end(), comp);
}
template <class _Tp, class _Container, class _Compare>
template <class _InputIter, class _Alloc, class>
inline
priority_queue<_Tp, _Container, _Compare>::priority_queue(
_InputIter __f, _InputIter __l,
const value_compare& __comp, const _Alloc& __a,
__enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
: c(__f, __l, __a),
comp(__comp)
{
_VSTD::make_heap(c.begin(), c.end(), comp);
}
template <class _Tp, class _Container, class _Compare>
template <class _InputIter, class _Alloc, class>
inline
priority_queue<_Tp, _Container, _Compare>::priority_queue(
_InputIter __f, _InputIter __l,
const value_compare& __comp, const container_type& __c, const _Alloc& __a,
__enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
: c(__c, __a),
comp(__comp)
{
c.insert(c.end(), __f, __l);
_VSTD::make_heap(c.begin(), c.end(), comp);
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
template <class _InputIter, class _Alloc, class>
inline
priority_queue<_Tp, _Container, _Compare>::priority_queue(
_InputIter __f, _InputIter __l, const value_compare& __comp,
container_type&& __c, const _Alloc& __a,
__enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
: c(_VSTD::move(__c), __a),
comp(__comp)
{
c.insert(c.end(), __f, __l);
_VSTD::make_heap(c.begin(), c.end(), comp);
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
@ -755,7 +917,7 @@ priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args)
_VSTD::push_heap(c.begin(), c.end(), comp);
}
#endif // _LIBCPP_CXX03_LANG
#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
inline
@ -780,11 +942,10 @@ priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q)
template <class _Tp, class _Container, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<
__is_swappable<_Container>::value
&& __is_swappable<_Compare>::value,
__enable_if_t<
__is_swappable<_Container>::value && __is_swappable<_Compare>::value,
void
>::type
>
swap(priority_queue<_Tp, _Container, _Compare>& __x,
priority_queue<_Tp, _Container, _Compare>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
@ -800,4 +961,11 @@ struct _LIBCPP_TEMPLATE_VIS uses_allocator<priority_queue<_Tp, _Container, _Comp
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_QUEUE
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <concepts>
# include <cstdlib>
# include <functional>
# include <type_traits>
#endif
#endif // _LIBCPP_QUEUE