mirror of
https://github.com/intel/llvm.git
synced 2026-01-16 05:32:28 +08:00
[libc++] constexpr priority_queue (#140634)
This patch makes `priority_queue` constexpr as part of P3372R3. Fixes #128671.
This commit is contained in:
@@ -422,6 +422,8 @@ Status
|
||||
---------------------------------------------------------- -----------------
|
||||
``__cpp_lib_constexpr_new`` ``202406L``
|
||||
---------------------------------------------------------- -----------------
|
||||
``__cpp_lib_constexpr_queue`` ``202502L``
|
||||
---------------------------------------------------------- -----------------
|
||||
``__cpp_lib_constrained_equality`` *unimplemented*
|
||||
---------------------------------------------------------- -----------------
|
||||
``__cpp_lib_copyable_function`` *unimplemented*
|
||||
|
||||
@@ -458,14 +458,12 @@ 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>>;
|
||||
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>>;
|
||||
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>
|
||||
@@ -533,24 +531,25 @@ protected:
|
||||
value_compare comp;
|
||||
|
||||
public:
|
||||
_LIBCPP_HIDE_FROM_ABI priority_queue() _NOEXCEPT_(
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI priority_queue() _NOEXCEPT_(
|
||||
is_nothrow_default_constructible<container_type>::value&& is_nothrow_default_constructible<value_compare>::value)
|
||||
: c(), comp() {}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI priority_queue(const priority_queue& __q) : c(__q.c), comp(__q.comp) {}
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI priority_queue(const priority_queue& __q)
|
||||
: c(__q.c), comp(__q.comp) {}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI priority_queue& operator=(const priority_queue& __q) {
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI priority_queue& operator=(const priority_queue& __q) {
|
||||
c = __q.c;
|
||||
comp = __q.comp;
|
||||
return *this;
|
||||
}
|
||||
|
||||
# ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_HIDE_FROM_ABI priority_queue(priority_queue&& __q) noexcept(
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI priority_queue(priority_queue&& __q) noexcept(
|
||||
is_nothrow_move_constructible<container_type>::value && is_nothrow_move_constructible<value_compare>::value)
|
||||
: c(std::move(__q.c)), comp(std::move(__q.comp)) {}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI priority_queue& operator=(priority_queue&& __q) noexcept(
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI priority_queue& operator=(priority_queue&& __q) noexcept(
|
||||
is_nothrow_move_assignable<container_type>::value && is_nothrow_move_assignable<value_compare>::value) {
|
||||
c = std::move(__q.c);
|
||||
comp = std::move(__q.comp);
|
||||
@@ -558,50 +557,56 @@ public:
|
||||
}
|
||||
# endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI explicit priority_queue(const value_compare& __comp) : c(), comp(__comp) {}
|
||||
_LIBCPP_HIDE_FROM_ABI priority_queue(const value_compare& __comp, const container_type& __c);
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit priority_queue(const value_compare& __comp)
|
||||
: c(), comp(__comp) {}
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI
|
||||
priority_queue(const value_compare& __comp, const container_type& __c);
|
||||
# ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_HIDE_FROM_ABI priority_queue(const value_compare& __comp, container_type&& __c);
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI priority_queue(const value_compare& __comp, container_type&& __c);
|
||||
# endif
|
||||
template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp = value_compare());
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI
|
||||
priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp = value_compare());
|
||||
|
||||
template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI
|
||||
priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp, const container_type& __c);
|
||||
|
||||
# ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI
|
||||
priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp, container_type&& __c);
|
||||
# endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
# if _LIBCPP_STD_VER >= 23
|
||||
template <_ContainerCompatibleRange<_Tp> _Range>
|
||||
_LIBCPP_HIDE_FROM_ABI priority_queue(from_range_t, _Range&& __range, const value_compare& __comp = value_compare())
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI
|
||||
priority_queue(from_range_t, _Range&& __range, const value_compare& __comp = value_compare())
|
||||
: c(from_range, std::forward<_Range>(__range)), comp(__comp) {
|
||||
std::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
# endif
|
||||
|
||||
template <class _Alloc, __enable_if_t<uses_allocator<container_type, _Alloc>::value, int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI explicit priority_queue(const _Alloc& __a);
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit priority_queue(const _Alloc& __a);
|
||||
|
||||
template <class _Alloc, __enable_if_t<uses_allocator<container_type, _Alloc>::value, int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI priority_queue(const value_compare& __comp, const _Alloc& __a);
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI priority_queue(const value_compare& __comp, const _Alloc& __a);
|
||||
|
||||
template <class _Alloc, __enable_if_t<uses_allocator<container_type, _Alloc>::value, int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI priority_queue(const value_compare& __comp, const container_type& __c, const _Alloc& __a);
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI
|
||||
priority_queue(const value_compare& __comp, const container_type& __c, const _Alloc& __a);
|
||||
|
||||
template <class _Alloc, __enable_if_t<uses_allocator<container_type, _Alloc>::value, int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI priority_queue(const priority_queue& __q, const _Alloc& __a);
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI priority_queue(const priority_queue& __q, const _Alloc& __a);
|
||||
|
||||
# ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Alloc, __enable_if_t<uses_allocator<container_type, _Alloc>::value, int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI priority_queue(const value_compare& __comp, container_type&& __c, const _Alloc& __a);
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI
|
||||
priority_queue(const value_compare& __comp, container_type&& __c, const _Alloc& __a);
|
||||
|
||||
template <class _Alloc, __enable_if_t<uses_allocator<container_type, _Alloc>::value, int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI priority_queue(priority_queue&& __q, const _Alloc& __a);
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI priority_queue(priority_queue&& __q, const _Alloc& __a);
|
||||
# endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <
|
||||
@@ -609,21 +614,22 @@ public:
|
||||
class _Alloc,
|
||||
__enable_if_t<__has_input_iterator_category<_InputIter>::value && uses_allocator<container_type, _Alloc>::value,
|
||||
int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI priority_queue(_InputIter __f, _InputIter __l, const _Alloc& __a);
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI priority_queue(_InputIter __f, _InputIter __l, const _Alloc& __a);
|
||||
|
||||
template <
|
||||
class _InputIter,
|
||||
class _Alloc,
|
||||
__enable_if_t<__has_input_iterator_category<_InputIter>::value && uses_allocator<container_type, _Alloc>::value,
|
||||
int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp, const _Alloc& __a);
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI
|
||||
priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp, const _Alloc& __a);
|
||||
|
||||
template <
|
||||
class _InputIter,
|
||||
class _Alloc,
|
||||
__enable_if_t<__has_input_iterator_category<_InputIter>::value && uses_allocator<container_type, _Alloc>::value,
|
||||
int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI priority_queue(
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI priority_queue(
|
||||
_InputIter __f, _InputIter __l, const value_compare& __comp, const container_type& __c, const _Alloc& __a);
|
||||
|
||||
# ifndef _LIBCPP_CXX03_LANG
|
||||
@@ -632,7 +638,7 @@ public:
|
||||
class _Alloc,
|
||||
__enable_if_t<__has_input_iterator_category<_InputIter>::value && uses_allocator<container_type, _Alloc>::value,
|
||||
int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI
|
||||
priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp, container_type&& __c, const _Alloc& __a);
|
||||
# endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
@@ -641,7 +647,8 @@ public:
|
||||
template <_ContainerCompatibleRange<_Tp> _Range,
|
||||
class _Alloc,
|
||||
class = enable_if_t<uses_allocator<_Container, _Alloc>::value>>
|
||||
_LIBCPP_HIDE_FROM_ABI priority_queue(from_range_t, _Range&& __range, const value_compare& __comp, const _Alloc& __a)
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI
|
||||
priority_queue(from_range_t, _Range&& __range, const value_compare& __comp, const _Alloc& __a)
|
||||
: c(from_range, std::forward<_Range>(__range), __a), comp(__comp) {
|
||||
std::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
@@ -649,24 +656,24 @@ public:
|
||||
template <_ContainerCompatibleRange<_Tp> _Range,
|
||||
class _Alloc,
|
||||
class = enable_if_t<uses_allocator<_Container, _Alloc>::value>>
|
||||
_LIBCPP_HIDE_FROM_ABI priority_queue(from_range_t, _Range&& __range, const _Alloc& __a)
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI priority_queue(from_range_t, _Range&& __range, const _Alloc& __a)
|
||||
: c(from_range, std::forward<_Range>(__range), __a), comp() {
|
||||
std::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
# endif
|
||||
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const { return c.empty(); }
|
||||
_LIBCPP_HIDE_FROM_ABI size_type size() const { return c.size(); }
|
||||
_LIBCPP_HIDE_FROM_ABI const_reference top() const { return c.front(); }
|
||||
[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI bool empty() const { return c.empty(); }
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI size_type size() const { return c.size(); }
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_reference top() const { return c.front(); }
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI void push(const value_type& __v);
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void push(const value_type& __v);
|
||||
# ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_HIDE_FROM_ABI void push(value_type&& __v);
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void push(value_type&& __v);
|
||||
|
||||
# if _LIBCPP_STD_VER >= 23
|
||||
template <_ContainerCompatibleRange<_Tp> _Range>
|
||||
_LIBCPP_HIDE_FROM_ABI void push_range(_Range&& __range) {
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void push_range(_Range&& __range) {
|
||||
if constexpr (requires(container_type& __c) { __c.append_range(std::forward<_Range>(__range)); }) {
|
||||
c.append_range(std::forward<_Range>(__range));
|
||||
} else {
|
||||
@@ -678,14 +685,16 @@ public:
|
||||
# endif
|
||||
|
||||
template <class... _Args>
|
||||
_LIBCPP_HIDE_FROM_ABI void emplace(_Args&&... __args);
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void emplace(_Args&&... __args);
|
||||
# endif // _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_HIDE_FROM_ABI void pop();
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void pop();
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI void swap(priority_queue& __q)
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void swap(priority_queue& __q)
|
||||
_NOEXCEPT_(__is_nothrow_swappable_v<container_type>&& __is_nothrow_swappable_v<value_compare>);
|
||||
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const { return c; }
|
||||
[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const {
|
||||
return c;
|
||||
}
|
||||
};
|
||||
|
||||
# if _LIBCPP_STD_VER >= 17
|
||||
@@ -767,7 +776,8 @@ priority_queue(from_range_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)
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
|
||||
const _Compare& __comp, const container_type& __c)
|
||||
: c(__c), comp(__comp) {
|
||||
std::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
@@ -775,7 +785,8 @@ inline priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare&
|
||||
# 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)
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
|
||||
const value_compare& __comp, container_type&& __c)
|
||||
: c(std::move(__c)), comp(__comp) {
|
||||
std::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
@@ -784,7 +795,7 @@ inline priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_com
|
||||
|
||||
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(
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
|
||||
_InputIter __f, _InputIter __l, const value_compare& __comp)
|
||||
: c(__f, __l), comp(__comp) {
|
||||
std::make_heap(c.begin(), c.end(), comp);
|
||||
@@ -792,7 +803,7 @@ inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
|
||||
|
||||
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(
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
|
||||
_InputIter __f, _InputIter __l, const value_compare& __comp, const container_type& __c)
|
||||
: c(__c), comp(__comp) {
|
||||
c.insert(c.end(), __f, __l);
|
||||
@@ -803,7 +814,7 @@ inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
|
||||
|
||||
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(
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 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) {
|
||||
c.insert(c.end(), __f, __l);
|
||||
@@ -814,16 +825,18 @@ inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
|
||||
|
||||
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) {}
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 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)
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 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(
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
|
||||
const value_compare& __comp, const container_type& __c, const _Alloc& __a)
|
||||
: c(__c, __a), comp(__comp) {
|
||||
std::make_heap(c.begin(), c.end(), comp);
|
||||
@@ -831,14 +844,15 @@ inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
|
||||
|
||||
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)
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 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(
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 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) {
|
||||
std::make_heap(c.begin(), c.end(), comp);
|
||||
@@ -846,7 +860,8 @@ inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
|
||||
|
||||
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)
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 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 // _LIBCPP_CXX03_LANG
|
||||
@@ -856,7 +871,8 @@ 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)
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
|
||||
_InputIter __f, _InputIter __l, const _Alloc& __a)
|
||||
: c(__f, __l, __a), comp() {
|
||||
std::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
@@ -866,7 +882,7 @@ 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(
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 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) {
|
||||
std::make_heap(c.begin(), c.end(), comp);
|
||||
@@ -877,7 +893,7 @@ 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(
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 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) {
|
||||
c.insert(c.end(), __f, __l);
|
||||
@@ -890,7 +906,7 @@ 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(
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 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) {
|
||||
c.insert(c.end(), __f, __l);
|
||||
@@ -899,7 +915,7 @@ inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
|
||||
# endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
inline void priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v) {
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 inline void priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v) {
|
||||
c.push_back(__v);
|
||||
std::push_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
@@ -907,14 +923,14 @@ inline void priority_queue<_Tp, _Container, _Compare>::push(const value_type& __
|
||||
# ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
inline void priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v) {
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 inline void priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v) {
|
||||
c.push_back(std::move(__v));
|
||||
std::push_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class... _Args>
|
||||
inline void priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args) {
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 inline void priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args) {
|
||||
c.emplace_back(std::forward<_Args>(__args)...);
|
||||
std::push_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
@@ -922,13 +938,13 @@ inline void priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args
|
||||
# endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
inline void priority_queue<_Tp, _Container, _Compare>::pop() {
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 inline void priority_queue<_Tp, _Container, _Compare>::pop() {
|
||||
std::pop_heap(c.begin(), c.end(), comp);
|
||||
c.pop_back();
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
inline void priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q)
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 inline void priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q)
|
||||
_NOEXCEPT_(__is_nothrow_swappable_v<container_type>&& __is_nothrow_swappable_v<value_compare>) {
|
||||
using std::swap;
|
||||
swap(c, __q.c);
|
||||
@@ -939,7 +955,7 @@ 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
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 inline _LIBCPP_HIDE_FROM_ABI void
|
||||
swap(priority_queue<_Tp, _Container, _Compare>& __x, priority_queue<_Tp, _Container, _Compare>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
|
||||
__x.swap(__y);
|
||||
|
||||
@@ -74,6 +74,7 @@ __cpp_lib_constexpr_memory 202202L <memory>
|
||||
201811L // C++20
|
||||
__cpp_lib_constexpr_new 202406L <new>
|
||||
__cpp_lib_constexpr_numeric 201911L <numeric>
|
||||
__cpp_lib_constexpr_queue 202502L <queue>
|
||||
__cpp_lib_constexpr_string 201907L <string>
|
||||
__cpp_lib_constexpr_string_view 201811L <string_view>
|
||||
__cpp_lib_constexpr_tuple 201811L <tuple>
|
||||
@@ -545,6 +546,7 @@ __cpp_lib_void_t 201411L <type_traits>
|
||||
# if !defined(_LIBCPP_ABI_VCRUNTIME)
|
||||
# define __cpp_lib_constexpr_new 202406L
|
||||
# endif
|
||||
# define __cpp_lib_constexpr_queue 202502L
|
||||
// # define __cpp_lib_constrained_equality 202403L
|
||||
// # define __cpp_lib_copyable_function 202306L
|
||||
// # define __cpp_lib_debugging 202311L
|
||||
|
||||
@@ -15,20 +15,20 @@
|
||||
#if TEST_STD_VER >= 11
|
||||
|
||||
class Emplaceable {
|
||||
Emplaceable(const Emplaceable&);
|
||||
Emplaceable& operator=(const Emplaceable&);
|
||||
TEST_CONSTEXPR Emplaceable(const Emplaceable&);
|
||||
TEST_CONSTEXPR_CXX14 Emplaceable& operator=(const Emplaceable&);
|
||||
|
||||
int int_;
|
||||
double double_;
|
||||
|
||||
public:
|
||||
Emplaceable() : int_(0), double_(0) {}
|
||||
Emplaceable(int i, double d) : int_(i), double_(d) {}
|
||||
Emplaceable(Emplaceable&& x) : int_(x.int_), double_(x.double_) {
|
||||
TEST_CONSTEXPR Emplaceable() : int_(0), double_(0) {}
|
||||
TEST_CONSTEXPR Emplaceable(int i, double d) : int_(i), double_(d) {}
|
||||
TEST_CONSTEXPR_CXX14 Emplaceable(Emplaceable&& x) : int_(x.int_), double_(x.double_) {
|
||||
x.int_ = 0;
|
||||
x.double_ = 0;
|
||||
}
|
||||
Emplaceable& operator=(Emplaceable&& x) {
|
||||
TEST_CONSTEXPR_CXX14 Emplaceable& operator=(Emplaceable&& x) {
|
||||
int_ = x.int_;
|
||||
x.int_ = 0;
|
||||
double_ = x.double_;
|
||||
@@ -36,10 +36,12 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator==(const Emplaceable& x) const { return int_ == x.int_ && double_ == x.double_; }
|
||||
bool operator<(const Emplaceable& x) const { return int_ < x.int_ || (int_ == x.int_ && double_ < x.double_); }
|
||||
TEST_CONSTEXPR bool operator==(const Emplaceable& x) const { return int_ == x.int_ && double_ == x.double_; }
|
||||
TEST_CONSTEXPR bool operator<(const Emplaceable& x) const {
|
||||
return int_ < x.int_ || (int_ == x.int_ && double_ < x.double_);
|
||||
}
|
||||
|
||||
int get() const { return int_; }
|
||||
TEST_CONSTEXPR int get() const { return int_; }
|
||||
};
|
||||
|
||||
template <>
|
||||
@@ -47,7 +49,7 @@ struct std::hash<Emplaceable> {
|
||||
typedef Emplaceable argument_type;
|
||||
typedef std::size_t result_type;
|
||||
|
||||
std::size_t operator()(const Emplaceable& x) const { return static_cast<std::size_t>(x.get()); }
|
||||
TEST_CONSTEXPR std::size_t operator()(const Emplaceable& x) const { return static_cast<std::size_t>(x.get()); }
|
||||
};
|
||||
|
||||
#endif // TEST_STD_VER >= 11
|
||||
|
||||
@@ -18,29 +18,38 @@
|
||||
#include "test_allocator.h"
|
||||
|
||||
template <class T>
|
||||
struct test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
|
||||
struct Test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
|
||||
typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
|
||||
typedef typename base::container_type container_type;
|
||||
typedef typename base::value_compare value_compare;
|
||||
|
||||
explicit test(const test_allocator<int>& a) : base(a) {}
|
||||
test(const value_compare& comp, const test_allocator<int>& a) : base(comp, c, a) {}
|
||||
test(const value_compare& comp, const container_type& container, const test_allocator<int>& a)
|
||||
TEST_CONSTEXPR_CXX26 explicit Test(const test_allocator<int>& a) : base(a) {}
|
||||
TEST_CONSTEXPR_CXX26 Test(const value_compare& comp, const test_allocator<int>& a) : base(comp, c, a) {}
|
||||
TEST_CONSTEXPR_CXX26 Test(const value_compare& comp, const container_type& container, const test_allocator<int>& a)
|
||||
: base(comp, container, a) {}
|
||||
#if TEST_STD_VER >= 11
|
||||
test(const value_compare& comp, container_type&& container, const test_allocator<int>& a)
|
||||
TEST_CONSTEXPR_CXX26 Test(const value_compare& comp, container_type&& container, const test_allocator<int>& a)
|
||||
: base(comp, std::move(container), a) {}
|
||||
test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
|
||||
TEST_CONSTEXPR_CXX26 Test(Test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
|
||||
#endif
|
||||
test_allocator<int> get_allocator() { return c.get_allocator(); }
|
||||
TEST_CONSTEXPR_CXX26 test_allocator<int> get_allocator() { return c.get_allocator(); }
|
||||
|
||||
using base::c;
|
||||
};
|
||||
|
||||
int main(int, char**) {
|
||||
test<int> q((test_allocator<int>(3)));
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
Test<int> q((test_allocator<int>(3)));
|
||||
assert(q.c.get_allocator() == test_allocator<int>(3));
|
||||
assert(q.c.size() == 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -18,29 +18,38 @@
|
||||
#include "test_allocator.h"
|
||||
|
||||
template <class T>
|
||||
struct test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
|
||||
struct Test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
|
||||
typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
|
||||
typedef typename base::container_type container_type;
|
||||
typedef typename base::value_compare value_compare;
|
||||
|
||||
explicit test(const test_allocator<int>& a) : base(a) {}
|
||||
test(const value_compare& compare, const test_allocator<int>& a) : base(compare, a) {}
|
||||
test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
|
||||
TEST_CONSTEXPR_CXX26 explicit Test(const test_allocator<int>& a) : base(a) {}
|
||||
TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, const test_allocator<int>& a) : base(compare, a) {}
|
||||
TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
|
||||
: base(compare, container, a) {}
|
||||
#if TEST_STD_VER >= 11
|
||||
test(const value_compare& compare, container_type&& container, const test_allocator<int>& a)
|
||||
TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, container_type&& container, const test_allocator<int>& a)
|
||||
: base(compare, std::move(container), a) {}
|
||||
test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
|
||||
TEST_CONSTEXPR_CXX26 Test(Test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
|
||||
#endif
|
||||
test_allocator<int> get_allocator() { return c.get_allocator(); }
|
||||
TEST_CONSTEXPR_CXX26 test_allocator<int> get_allocator() { return c.get_allocator(); }
|
||||
|
||||
using base::c;
|
||||
};
|
||||
|
||||
int main(int, char**) {
|
||||
test<int> q(std::less<int>(), test_allocator<int>(3));
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
Test<int> q(std::less<int>(), test_allocator<int>(3));
|
||||
assert(q.c.get_allocator() == test_allocator<int>(3));
|
||||
assert(q.c.size() == 0);
|
||||
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "test_allocator.h"
|
||||
|
||||
template <class C>
|
||||
C make(int n) {
|
||||
TEST_CONSTEXPR_CXX26 C make(int n) {
|
||||
C c;
|
||||
for (int i = 0; i < n; ++i)
|
||||
c.push_back(i);
|
||||
@@ -27,32 +27,41 @@ C make(int n) {
|
||||
}
|
||||
|
||||
template <class T>
|
||||
struct test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
|
||||
struct Test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
|
||||
typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
|
||||
typedef typename base::container_type container_type;
|
||||
typedef typename base::value_compare value_compare;
|
||||
|
||||
explicit test(const test_allocator<int>& a) : base(a) {}
|
||||
test(const value_compare& compare, const test_allocator<int>& a) : base(compare, a) {}
|
||||
test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
|
||||
TEST_CONSTEXPR_CXX26 explicit Test(const test_allocator<int>& a) : base(a) {}
|
||||
TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, const test_allocator<int>& a) : base(compare, a) {}
|
||||
TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
|
||||
: base(compare, container, a) {}
|
||||
#if TEST_STD_VER >= 11 // testing rvalue constructor
|
||||
test(const value_compare& compare, container_type&& container, const test_allocator<int>& a)
|
||||
TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, container_type&& container, const test_allocator<int>& a)
|
||||
: base(compare, std::move(container), a) {}
|
||||
test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
|
||||
TEST_CONSTEXPR_CXX26 Test(Test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
|
||||
#endif
|
||||
test_allocator<int> get_allocator() { return c.get_allocator(); }
|
||||
TEST_CONSTEXPR_CXX26 test_allocator<int> get_allocator() { return c.get_allocator(); }
|
||||
|
||||
using base::c;
|
||||
};
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
typedef std::vector<int, test_allocator<int> > C;
|
||||
C v = make<C>(5);
|
||||
test<int> q(std::less<int>(), v, test_allocator<int>(3));
|
||||
Test<int> q(std::less<int>(), v, test_allocator<int>(3));
|
||||
assert(q.c.get_allocator() == test_allocator<int>(3));
|
||||
assert(q.size() == 5);
|
||||
assert(q.top() == 4);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "test_allocator.h"
|
||||
|
||||
template <class C>
|
||||
C make(int n) {
|
||||
TEST_CONSTEXPR_CXX26 C make(int n) {
|
||||
C c;
|
||||
for (int i = 0; i < n; ++i)
|
||||
c.push_back(i);
|
||||
@@ -27,31 +27,40 @@ C make(int n) {
|
||||
}
|
||||
|
||||
template <class T>
|
||||
struct test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
|
||||
struct Test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
|
||||
typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
|
||||
typedef typename base::container_type container_type;
|
||||
typedef typename base::value_compare value_compare;
|
||||
|
||||
explicit test(const test_allocator<int>& a) : base(a) {}
|
||||
test(const value_compare& compare, const test_allocator<int>& a) : base(compare, a) {}
|
||||
test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
|
||||
TEST_CONSTEXPR_CXX26 explicit Test(const test_allocator<int>& a) : base(a) {}
|
||||
TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, const test_allocator<int>& a) : base(compare, a) {}
|
||||
TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
|
||||
: base(compare, container, a) {}
|
||||
#if TEST_STD_VER >= 11 // testing rvalue ctor
|
||||
test(const value_compare& compare, container_type&& container, const test_allocator<int>& a)
|
||||
TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, container_type&& container, const test_allocator<int>& a)
|
||||
: base(compare, std::move(container), a) {}
|
||||
test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
|
||||
TEST_CONSTEXPR_CXX26 Test(Test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
|
||||
#endif
|
||||
test_allocator<int> get_allocator() { return c.get_allocator(); }
|
||||
TEST_CONSTEXPR_CXX26 test_allocator<int> get_allocator() { return c.get_allocator(); }
|
||||
|
||||
using base::c;
|
||||
};
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
typedef std::vector<int, test_allocator<int> > C;
|
||||
test<int> q(std::less<int>(), make<C>(5), test_allocator<int>(3));
|
||||
Test<int> q(std::less<int>(), make<C>(5), test_allocator<int>(3));
|
||||
assert(q.c.get_allocator() == test_allocator<int>(3));
|
||||
assert(q.size() == 5);
|
||||
assert(q.top() == 4);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -14,8 +14,10 @@
|
||||
#include <queue>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
template <class C>
|
||||
C make(int n) {
|
||||
TEST_CONSTEXPR_CXX26 C make(int n) {
|
||||
C c;
|
||||
for (int i = 0; i < n; ++i)
|
||||
c.push_back(i);
|
||||
@@ -26,27 +28,36 @@ C make(int n) {
|
||||
#include "test_allocator.h"
|
||||
|
||||
template <class T>
|
||||
struct test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
|
||||
struct Test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
|
||||
typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
|
||||
typedef typename base::container_type container_type;
|
||||
typedef typename base::value_compare value_compare;
|
||||
|
||||
explicit test(const test_allocator<int>& a) : base(a) {}
|
||||
test(const value_compare& compare, const test_allocator<int>& a) : base(compare, c, a) {}
|
||||
test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
|
||||
TEST_CONSTEXPR_CXX26 explicit Test(const test_allocator<int>& a) : base(a) {}
|
||||
TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, const test_allocator<int>& a) : base(compare, c, a) {}
|
||||
TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
|
||||
: base(compare, container, a) {}
|
||||
test(const test& q, const test_allocator<int>& a) : base(q, a) {}
|
||||
test_allocator<int> get_allocator() { return c.get_allocator(); }
|
||||
TEST_CONSTEXPR_CXX26 Test(const Test& q, const test_allocator<int>& a) : base(q, a) {}
|
||||
TEST_CONSTEXPR_CXX26 test_allocator<int> get_allocator() { return c.get_allocator(); }
|
||||
|
||||
using base::c;
|
||||
};
|
||||
|
||||
int main(int, char**) {
|
||||
test<int> qo(std::less<int>(), make<std::vector<int, test_allocator<int> > >(5), test_allocator<int>(2));
|
||||
test<int> q(qo, test_allocator<int>(6));
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
Test<int> qo(std::less<int>(), make<std::vector<int, test_allocator<int> > >(5), test_allocator<int>(2));
|
||||
Test<int> q(qo, test_allocator<int>(6));
|
||||
assert(q.size() == 5);
|
||||
assert(q.c.get_allocator() == test_allocator<int>(6));
|
||||
assert(q.top() == int(4));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -23,12 +23,12 @@ struct PQ : std::priority_queue<T, Cont, Comp> {
|
||||
typedef std::priority_queue<T, Cont, Comp> base;
|
||||
|
||||
template <class It, class Alloc>
|
||||
explicit PQ(It first, It last, const Alloc& a) : base(first, last, a) {}
|
||||
TEST_CONSTEXPR_CXX26 explicit PQ(It first, It last, const Alloc& a) : base(first, last, a) {}
|
||||
|
||||
using base::c;
|
||||
};
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
int a[] = {3, 5, 2, 0, 6, 8, 1};
|
||||
typedef test_allocator<int> Alloc;
|
||||
PQ<int, std::vector<int, Alloc> > q(a, a + 7, Alloc(2));
|
||||
@@ -36,5 +36,14 @@ int main(int, char**) {
|
||||
assert(q.top() == 8);
|
||||
assert(q.c.get_allocator() == Alloc(2));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -24,12 +24,13 @@ struct PQ : std::priority_queue<T, Cont, Comp> {
|
||||
typedef std::priority_queue<T, Cont, Comp> base;
|
||||
|
||||
template <class It, class Alloc>
|
||||
explicit PQ(It first, It last, const Comp& compare, const Alloc& a) : base(first, last, compare, a) {}
|
||||
TEST_CONSTEXPR_CXX26 explicit PQ(It first, It last, const Comp& compare, const Alloc& a)
|
||||
: base(first, last, compare, a) {}
|
||||
|
||||
using base::c;
|
||||
};
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
int a[] = {3, 5, 2, 0, 6, 8, 1};
|
||||
typedef test_allocator<int> Alloc;
|
||||
PQ<int, std::vector<int, Alloc>, std::greater<int> > q(a, a + 7, std::greater<int>(), Alloc(2));
|
||||
@@ -37,5 +38,14 @@ int main(int, char**) {
|
||||
assert(q.top() == 0);
|
||||
assert(q.c.get_allocator() == Alloc(2));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -23,13 +23,13 @@ struct PQ : std::priority_queue<T, Cont, Comp> {
|
||||
typedef std::priority_queue<T, Cont, Comp> base;
|
||||
|
||||
template <class It, class Alloc>
|
||||
explicit PQ(It first, It last, const Comp& compare, const Cont& v, const Alloc& a)
|
||||
TEST_CONSTEXPR_CXX26 explicit PQ(It first, It last, const Comp& compare, const Cont& v, const Alloc& a)
|
||||
: base(first, last, compare, v, a) {}
|
||||
|
||||
using base::c;
|
||||
};
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
typedef test_allocator<int> Alloc;
|
||||
int a[] = {3, 5, 2, 0, 6, 8, 1};
|
||||
std::vector<int, Alloc> v(a, a + 3);
|
||||
@@ -38,5 +38,14 @@ int main(int, char**) {
|
||||
assert(q.top() == 8);
|
||||
assert(q.c.get_allocator() == Alloc(2));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -26,13 +26,13 @@ struct PQ : std::priority_queue<T, Cont, Comp> {
|
||||
typedef std::priority_queue<T, Cont, Comp> base;
|
||||
|
||||
template <class It, class Alloc>
|
||||
explicit PQ(It first, It last, const Comp& compare, Cont&& v, const Alloc& a)
|
||||
TEST_CONSTEXPR_CXX26 explicit PQ(It first, It last, const Comp& compare, Cont&& v, const Alloc& a)
|
||||
: base(first, last, compare, std::move(v), a) {}
|
||||
|
||||
using base::c;
|
||||
};
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
using Alloc = test_allocator<MoveOnly>;
|
||||
int a[] = {3, 5, 2, 0, 6, 8, 1};
|
||||
PQ<MoveOnly, std::vector<MoveOnly, Alloc>> q(
|
||||
@@ -41,5 +41,14 @@ int main(int, char**) {
|
||||
assert(q.top() == MoveOnly(8));
|
||||
assert(q.c.get_allocator() == Alloc(2));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "MoveOnly.h"
|
||||
|
||||
template <class C>
|
||||
C make(int n) {
|
||||
TEST_CONSTEXPR_CXX26 C make(int n) {
|
||||
C c;
|
||||
for (int i = 0; i < n; ++i)
|
||||
c.push_back(MoveOnly(i));
|
||||
@@ -30,30 +30,39 @@ C make(int n) {
|
||||
#include "test_allocator.h"
|
||||
|
||||
template <class T>
|
||||
struct test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
|
||||
struct Test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
|
||||
typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
|
||||
typedef typename base::container_type container_type;
|
||||
typedef typename base::value_compare value_compare;
|
||||
|
||||
explicit test(const test_allocator<int>& a) : base(a) {}
|
||||
test(const value_compare& compare, const test_allocator<int>& a) : base(compare, c, a) {}
|
||||
test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
|
||||
TEST_CONSTEXPR_CXX26 explicit Test(const test_allocator<int>& a) : base(a) {}
|
||||
TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, const test_allocator<int>& a) : base(compare, c, a) {}
|
||||
TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
|
||||
: base(compare, container, a) {}
|
||||
test(const value_compare& compare, container_type&& container, const test_allocator<int>& a)
|
||||
TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, container_type&& container, const test_allocator<int>& a)
|
||||
: base(compare, std::move(container), a) {}
|
||||
test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
|
||||
test_allocator<int> get_allocator() { return c.get_allocator(); }
|
||||
TEST_CONSTEXPR_CXX26 Test(Test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
|
||||
TEST_CONSTEXPR_CXX26 test_allocator<int> get_allocator() { return c.get_allocator(); }
|
||||
|
||||
using base::c;
|
||||
};
|
||||
|
||||
int main(int, char**) {
|
||||
test<MoveOnly> qo(
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
Test<MoveOnly> qo(
|
||||
std::less<MoveOnly>(), make<std::vector<MoveOnly, test_allocator<MoveOnly> > >(5), test_allocator<MoveOnly>(2));
|
||||
test<MoveOnly> q(std::move(qo), test_allocator<MoveOnly>(6));
|
||||
Test<MoveOnly> q(std::move(qo), test_allocator<MoveOnly>(6));
|
||||
assert(q.size() == 5);
|
||||
assert(q.c.get_allocator() == test_allocator<MoveOnly>(6));
|
||||
assert(q.top() == MoveOnly(4));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -17,14 +17,14 @@
|
||||
#include "test_macros.h"
|
||||
|
||||
template <class C>
|
||||
C make(int n) {
|
||||
TEST_CONSTEXPR_CXX26 C make(int n) {
|
||||
C c;
|
||||
for (int i = 0; i < n; ++i)
|
||||
c.push_back(i);
|
||||
return c;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
std::vector<int> v = make<std::vector<int> >(5);
|
||||
std::priority_queue<int, std::vector<int>, std::greater<int> > qo(std::greater<int>(), v);
|
||||
std::priority_queue<int, std::vector<int>, std::greater<int> > q;
|
||||
@@ -32,5 +32,14 @@ int main(int, char**) {
|
||||
assert(q.size() == 5);
|
||||
assert(q.top() == 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -19,19 +19,28 @@
|
||||
#include "MoveOnly.h"
|
||||
|
||||
template <class C>
|
||||
C make(int n) {
|
||||
TEST_CONSTEXPR_CXX26 C make(int n) {
|
||||
C c;
|
||||
for (int i = 0; i < n; ++i)
|
||||
c.push_back(MoveOnly(i));
|
||||
return c;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
std::priority_queue<MoveOnly> qo(std::less<MoveOnly>(), make<std::vector<MoveOnly> >(5));
|
||||
std::priority_queue<MoveOnly> q;
|
||||
q = std::move(qo);
|
||||
assert(q.size() == 5);
|
||||
assert(q.top() == MoveOnly(4));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
# include "test_convertible.h"
|
||||
#endif
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
typedef std::vector<int, limited_allocator<int, 10> > Container;
|
||||
typedef std::less<int> Compare;
|
||||
typedef std::priority_queue<int, Container> Q;
|
||||
@@ -34,5 +34,14 @@ int main(int, char**) {
|
||||
static_assert(!test_convertible<Q, const Compare&>(), "");
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -20,14 +20,14 @@
|
||||
#endif
|
||||
|
||||
template <class C>
|
||||
C make(int n) {
|
||||
TEST_CONSTEXPR_CXX26 C make(int n) {
|
||||
C c;
|
||||
for (int i = 0; i < n; ++i)
|
||||
c.push_back(i);
|
||||
return c;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
typedef std::vector<int> Container;
|
||||
typedef std::greater<int> Compare;
|
||||
typedef std::priority_queue<int, Container, Compare> Q;
|
||||
@@ -41,5 +41,14 @@ int main(int, char**) {
|
||||
static_assert(test_convertible<Q, const Compare&, const Container&>(), "");
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -21,22 +21,30 @@
|
||||
#include "test_convertible.h"
|
||||
|
||||
template <class C>
|
||||
C make(int n) {
|
||||
TEST_CONSTEXPR_CXX26 C make(int n) {
|
||||
C c;
|
||||
for (int i = 0; i < n; ++i)
|
||||
c.push_back(MoveOnly(i));
|
||||
return c;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
typedef std::vector<MoveOnly> Container;
|
||||
typedef std::less<MoveOnly> Compare;
|
||||
typedef std::priority_queue<MoveOnly> Q;
|
||||
Q q(Compare(), make<Container>(5));
|
||||
assert(q.size() == 5);
|
||||
assert(q.top() == MoveOnly(4));
|
||||
|
||||
static_assert(test_convertible<Q, const Compare&, Container&&>(), "");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -17,19 +17,28 @@
|
||||
#include "test_macros.h"
|
||||
|
||||
template <class C>
|
||||
C make(int n) {
|
||||
TEST_CONSTEXPR_CXX26 C make(int n) {
|
||||
C c;
|
||||
for (int i = 0; i < n; ++i)
|
||||
c.push_back(i);
|
||||
return c;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
std::vector<int> v = make<std::vector<int> >(5);
|
||||
std::priority_queue<int, std::vector<int>, std::greater<int> > qo(std::greater<int>(), v);
|
||||
std::priority_queue<int, std::vector<int>, std::greater<int> > q = qo;
|
||||
assert(q.size() == 5);
|
||||
assert(q.top() == 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
# include "test_convertible.h"
|
||||
#endif
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
typedef std::vector<int, limited_allocator<int, 10> > Container;
|
||||
typedef std::priority_queue<int, Container> Q;
|
||||
Q q;
|
||||
@@ -36,5 +36,14 @@ int main(int, char**) {
|
||||
static_assert(test_convertible<Q>(), "");
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -17,12 +17,21 @@
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
int a[] = {3, 5, 2, 0, 6, 8, 1};
|
||||
int* an = a + sizeof(a) / sizeof(a[0]);
|
||||
std::priority_queue<int> q(a, an);
|
||||
assert(q.size() == static_cast<std::size_t>(an - a));
|
||||
assert(q.top() == 8);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -18,12 +18,21 @@
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
int a[] = {3, 5, 2, 0, 6, 8, 1};
|
||||
int* an = a + sizeof(a) / sizeof(a[0]);
|
||||
std::priority_queue<int, std::vector<int>, std::greater<int> > q(a, an, std::greater<int>());
|
||||
assert(q.size() == static_cast<std::size_t>(an - a));
|
||||
assert(q.top() == 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
int a[] = {3, 5, 2, 0, 6, 8, 1};
|
||||
const int n = sizeof(a) / sizeof(a[0]);
|
||||
std::vector<int> v(a, a + n / 2);
|
||||
@@ -25,5 +25,14 @@ int main(int, char**) {
|
||||
assert(q.size() == n);
|
||||
assert(q.top() == 8);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -20,12 +20,21 @@
|
||||
#include "test_macros.h"
|
||||
#include "MoveOnly.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
int a[] = {3, 5, 2, 0, 6, 8, 1};
|
||||
const int n = sizeof(a) / sizeof(a[0]);
|
||||
std::priority_queue<MoveOnly> q(a + n / 2, a + n, std::less<MoveOnly>(), std::vector<MoveOnly>(a, a + n / 2));
|
||||
assert(q.size() == n);
|
||||
assert(q.top() == MoveOnly(8));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -19,18 +19,27 @@
|
||||
#include "MoveOnly.h"
|
||||
|
||||
template <class C>
|
||||
C make(int n) {
|
||||
TEST_CONSTEXPR_CXX26 C make(int n) {
|
||||
C c;
|
||||
for (int i = 0; i < n; ++i)
|
||||
c.push_back(MoveOnly(i));
|
||||
return c;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
std::priority_queue<MoveOnly> qo(std::less<MoveOnly>(), make<std::vector<MoveOnly> >(5));
|
||||
std::priority_queue<MoveOnly> q = std::move(qo);
|
||||
assert(q.size() == 5);
|
||||
assert(q.top() == MoveOnly(4));
|
||||
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "test_macros.h"
|
||||
#include "../../../Emplaceable.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
std::priority_queue<Emplaceable> q;
|
||||
q.emplace(1, 2.5);
|
||||
assert(q.top() == Emplaceable(1, 2.5));
|
||||
@@ -29,5 +29,14 @@ int main(int, char**) {
|
||||
q.emplace(2, 3.5);
|
||||
assert(q.top() == Emplaceable(3, 4.5));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
std::priority_queue<int> q;
|
||||
assert(q.empty());
|
||||
q.push(1);
|
||||
@@ -25,5 +25,14 @@ int main(int, char**) {
|
||||
q.pop();
|
||||
assert(q.empty());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
std::priority_queue<int> q;
|
||||
q.push(1);
|
||||
assert(q.top() == 1);
|
||||
@@ -32,5 +32,14 @@ int main(int, char**) {
|
||||
q.pop();
|
||||
assert(q.empty());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
std::priority_queue<int> q;
|
||||
q.push(1);
|
||||
assert(q.top() == 1);
|
||||
@@ -26,5 +26,14 @@ int main(int, char**) {
|
||||
q.push(2);
|
||||
assert(q.top() == 3);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "test_macros.h"
|
||||
#include "MoveOnly.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
std::priority_queue<MoveOnly> q;
|
||||
q.push(1);
|
||||
assert(q.top() == 1);
|
||||
@@ -29,5 +29,14 @@ int main(int, char**) {
|
||||
q.push(2);
|
||||
assert(q.top() == 3);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
std::priority_queue<int> q;
|
||||
assert(q.size() == 0);
|
||||
q.push(1);
|
||||
@@ -25,5 +25,14 @@ int main(int, char**) {
|
||||
q.pop();
|
||||
assert(q.size() == 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
std::priority_queue<int> q1;
|
||||
std::priority_queue<int> q2;
|
||||
q1.push(1);
|
||||
@@ -28,5 +28,14 @@ int main(int, char**) {
|
||||
assert(q2.size() == 3);
|
||||
assert(q2.top() == 3);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
std::priority_queue<int> q;
|
||||
q.push(1);
|
||||
assert(q.top() == 1);
|
||||
@@ -26,5 +26,14 @@ int main(int, char**) {
|
||||
q.push(2);
|
||||
assert(q.top() == 3);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
std::priority_queue<int> q1;
|
||||
std::priority_queue<int> q2;
|
||||
q1.push(1);
|
||||
@@ -30,5 +30,14 @@ int main(int, char**) {
|
||||
assert(q2.size() == 3);
|
||||
assert(q2.top() == 3);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
assert(test());
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
# error "__cpp_lib_adaptor_iterator_pair_constructor should not be defined before c++23"
|
||||
# endif
|
||||
|
||||
# ifdef __cpp_lib_constexpr_queue
|
||||
# error "__cpp_lib_constexpr_queue should not be defined before c++26"
|
||||
# endif
|
||||
|
||||
# ifdef __cpp_lib_containers_ranges
|
||||
# error "__cpp_lib_containers_ranges should not be defined before c++23"
|
||||
# endif
|
||||
@@ -34,6 +38,10 @@
|
||||
# error "__cpp_lib_adaptor_iterator_pair_constructor should not be defined before c++23"
|
||||
# endif
|
||||
|
||||
# ifdef __cpp_lib_constexpr_queue
|
||||
# error "__cpp_lib_constexpr_queue should not be defined before c++26"
|
||||
# endif
|
||||
|
||||
# ifdef __cpp_lib_containers_ranges
|
||||
# error "__cpp_lib_containers_ranges should not be defined before c++23"
|
||||
# endif
|
||||
@@ -44,6 +52,10 @@
|
||||
# error "__cpp_lib_adaptor_iterator_pair_constructor should not be defined before c++23"
|
||||
# endif
|
||||
|
||||
# ifdef __cpp_lib_constexpr_queue
|
||||
# error "__cpp_lib_constexpr_queue should not be defined before c++26"
|
||||
# endif
|
||||
|
||||
# ifdef __cpp_lib_containers_ranges
|
||||
# error "__cpp_lib_containers_ranges should not be defined before c++23"
|
||||
# endif
|
||||
@@ -54,6 +66,10 @@
|
||||
# error "__cpp_lib_adaptor_iterator_pair_constructor should not be defined before c++23"
|
||||
# endif
|
||||
|
||||
# ifdef __cpp_lib_constexpr_queue
|
||||
# error "__cpp_lib_constexpr_queue should not be defined before c++26"
|
||||
# endif
|
||||
|
||||
# ifdef __cpp_lib_containers_ranges
|
||||
# error "__cpp_lib_containers_ranges should not be defined before c++23"
|
||||
# endif
|
||||
@@ -67,6 +83,10 @@
|
||||
# error "__cpp_lib_adaptor_iterator_pair_constructor should have the value 202106L in c++23"
|
||||
# endif
|
||||
|
||||
# ifdef __cpp_lib_constexpr_queue
|
||||
# error "__cpp_lib_constexpr_queue should not be defined before c++26"
|
||||
# endif
|
||||
|
||||
# ifndef __cpp_lib_containers_ranges
|
||||
# error "__cpp_lib_containers_ranges should be defined in c++23"
|
||||
# endif
|
||||
@@ -83,6 +103,13 @@
|
||||
# error "__cpp_lib_adaptor_iterator_pair_constructor should have the value 202106L in c++26"
|
||||
# endif
|
||||
|
||||
# ifndef __cpp_lib_constexpr_queue
|
||||
# error "__cpp_lib_constexpr_queue should be defined in c++26"
|
||||
# endif
|
||||
# if __cpp_lib_constexpr_queue != 202502L
|
||||
# error "__cpp_lib_constexpr_queue should have the value 202502L in c++26"
|
||||
# endif
|
||||
|
||||
# ifndef __cpp_lib_containers_ranges
|
||||
# error "__cpp_lib_containers_ranges should be defined in c++26"
|
||||
# endif
|
||||
|
||||
@@ -216,6 +216,10 @@
|
||||
# error "__cpp_lib_constexpr_numeric should not be defined before c++20"
|
||||
# endif
|
||||
|
||||
# ifdef __cpp_lib_constexpr_queue
|
||||
# error "__cpp_lib_constexpr_queue should not be defined before c++26"
|
||||
# endif
|
||||
|
||||
# ifdef __cpp_lib_constexpr_string
|
||||
# error "__cpp_lib_constexpr_string should not be defined before c++20"
|
||||
# endif
|
||||
@@ -1100,6 +1104,10 @@
|
||||
# error "__cpp_lib_constexpr_numeric should not be defined before c++20"
|
||||
# endif
|
||||
|
||||
# ifdef __cpp_lib_constexpr_queue
|
||||
# error "__cpp_lib_constexpr_queue should not be defined before c++26"
|
||||
# endif
|
||||
|
||||
# ifdef __cpp_lib_constexpr_string
|
||||
# error "__cpp_lib_constexpr_string should not be defined before c++20"
|
||||
# endif
|
||||
@@ -2086,6 +2094,10 @@
|
||||
# error "__cpp_lib_constexpr_numeric should not be defined before c++20"
|
||||
# endif
|
||||
|
||||
# ifdef __cpp_lib_constexpr_queue
|
||||
# error "__cpp_lib_constexpr_queue should not be defined before c++26"
|
||||
# endif
|
||||
|
||||
# ifdef __cpp_lib_constexpr_string
|
||||
# error "__cpp_lib_constexpr_string should not be defined before c++20"
|
||||
# endif
|
||||
@@ -3324,6 +3336,10 @@
|
||||
# error "__cpp_lib_constexpr_numeric should have the value 201911L in c++20"
|
||||
# endif
|
||||
|
||||
# ifdef __cpp_lib_constexpr_queue
|
||||
# error "__cpp_lib_constexpr_queue should not be defined before c++26"
|
||||
# endif
|
||||
|
||||
# ifndef __cpp_lib_constexpr_string
|
||||
# error "__cpp_lib_constexpr_string should be defined in c++20"
|
||||
# endif
|
||||
@@ -4772,6 +4788,10 @@
|
||||
# error "__cpp_lib_constexpr_numeric should have the value 201911L in c++23"
|
||||
# endif
|
||||
|
||||
# ifdef __cpp_lib_constexpr_queue
|
||||
# error "__cpp_lib_constexpr_queue should not be defined before c++26"
|
||||
# endif
|
||||
|
||||
# ifndef __cpp_lib_constexpr_string
|
||||
# error "__cpp_lib_constexpr_string should be defined in c++23"
|
||||
# endif
|
||||
@@ -6448,6 +6468,13 @@
|
||||
# error "__cpp_lib_constexpr_numeric should have the value 201911L in c++26"
|
||||
# endif
|
||||
|
||||
# ifndef __cpp_lib_constexpr_queue
|
||||
# error "__cpp_lib_constexpr_queue should be defined in c++26"
|
||||
# endif
|
||||
# if __cpp_lib_constexpr_queue != 202502L
|
||||
# error "__cpp_lib_constexpr_queue should have the value 202502L in c++26"
|
||||
# endif
|
||||
|
||||
# ifndef __cpp_lib_constexpr_string
|
||||
# error "__cpp_lib_constexpr_string should be defined in c++26"
|
||||
# endif
|
||||
|
||||
@@ -384,6 +384,11 @@ feature_test_macros = [
|
||||
"values": {"c++20": 201911},
|
||||
"headers": ["numeric"],
|
||||
},
|
||||
{
|
||||
"name": "__cpp_lib_constexpr_queue",
|
||||
"values": {"c++26": 202502},
|
||||
"headers": ["queue"],
|
||||
},
|
||||
{
|
||||
"name": "__cpp_lib_constexpr_string",
|
||||
"values": {"c++20": 201907},
|
||||
|
||||
Reference in New Issue
Block a user