diff options
Diffstat (limited to 'lib/libcxx/include/queue')
| -rw-r--r-- | lib/libcxx/include/queue | 124 |
1 files changed, 53 insertions, 71 deletions
diff --git a/lib/libcxx/include/queue b/lib/libcxx/include/queue index a2048c1e22..42470e3a10 100644 --- a/lib/libcxx/include/queue +++ b/lib/libcxx/include/queue @@ -179,10 +179,13 @@ template <class T, class Container, class Compare> */ #include <__config> +#include <__memory/uses_allocator.h> +#include <__utility/forward.h> +#include <algorithm> +#include <compare> #include <deque> -#include <vector> #include <functional> -#include <algorithm> +#include <vector> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header @@ -238,47 +241,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) + _EnableIf<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) + _EnableIf<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) + _EnableIf<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) + _EnableIf<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) + _EnableIf<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,7 +306,7 @@ public: 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();} @@ -335,15 +333,15 @@ public: #ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES template<class _Container, - class = typename enable_if<!__is_allocator<_Container>::value, nullptr_t>::type + class = _EnableIf<!__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 = _EnableIf<!__is_allocator<_Container>::value>, + class = _EnableIf<uses_allocator<_Container, _Alloc>::value> > queue(_Container, _Alloc) -> queue<typename _Container::value_type, _Container>; @@ -399,10 +397,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 +_EnableIf<__is_swappable<_Container>::value, void> swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y) _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) { @@ -458,7 +453,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) @@ -482,41 +477,35 @@ public: _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); + _EnableIf<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); + _EnableIf<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); + _EnableIf<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); + _EnableIf<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); + _EnableIf<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); -#endif // _LIBCPP_CXX03_LANG + _EnableIf<uses_allocator<container_type, _Alloc>::value>* = 0); +#endif // _LIBCPP_CXX03_LANG _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY bool empty() const {return c.empty();} @@ -533,7 +522,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(); @@ -546,28 +535,28 @@ public: #ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES 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 = _EnableIf<!__is_allocator<_Compare>::value>, + class = _EnableIf<!__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_cpp17_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 = _EnableIf<__is_cpp17_input_iterator<_InputIterator>::value>, + class = _EnableIf<!__is_allocator<_Compare>::value>, + class = _EnableIf<!__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 = _EnableIf<!__is_allocator<_Compare>::value>, + class = _EnableIf<!__is_allocator<_Container>::value>, + class = _EnableIf<uses_allocator<_Container, _Alloc>::value> > priority_queue(_Compare, _Container, _Alloc) -> priority_queue<typename _Container::value_type, _Container, _Compare>; @@ -595,7 +584,7 @@ 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> @@ -636,14 +625,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*) + _EnableIf<uses_allocator<container_type, _Alloc>::value>*) : c(__a) { } @@ -653,8 +641,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*) + _EnableIf<uses_allocator<container_type, _Alloc>::value>*) : c(__a), comp(__comp) { @@ -666,8 +653,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*) + _EnableIf<uses_allocator<container_type, _Alloc>::value>*) : c(__c, __a), comp(__comp) { @@ -679,8 +665,7 @@ 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*) + _EnableIf<uses_allocator<container_type, _Alloc>::value>*) : c(__q.c, __a), comp(__q.comp) { @@ -695,8 +680,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*) + _EnableIf<uses_allocator<container_type, _Alloc>::value>*) : c(_VSTD::move(__c), __a), comp(__comp) { @@ -708,15 +692,14 @@ 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*) + _EnableIf<uses_allocator<container_type, _Alloc>::value>*) : c(_VSTD::move(__q.c), __a), comp(_VSTD::move(__q.comp)) { _VSTD::make_heap(c.begin(), c.end(), comp); } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_CXX03_LANG template <class _Tp, class _Container, class _Compare> inline @@ -748,7 +731,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 @@ -773,11 +756,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, +_EnableIf< + __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))) @@ -793,4 +775,4 @@ struct _LIBCPP_TEMPLATE_VIS uses_allocator<priority_queue<_Tp, _Container, _Comp _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_QUEUE +#endif // _LIBCPP_QUEUE |
