-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[libc++] constexpr priority_queue #140634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
winner245
wants to merge
1
commit into
llvm:main
Choose a base branch
from
winner245:constexpr-priority_queue
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+532
−170
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ae7d9e3
to
feb2591
Compare
@llvm/pr-subscribers-libcxx Author: Peng Liu (winner245) ChangesThis patch makes Fixies #128671. Patch is 74.13 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/140634.diff 38 Files Affected:
diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst
index 9b57b7c8eeb52..a89d4038785cd 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -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*
diff --git a/libcxx/include/queue b/libcxx/include/queue
index 7043a84390d02..c33afc892dda8 100644
--- a/libcxx/include/queue
+++ b/libcxx/include/queue
@@ -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<_Co...
[truncated]
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch makes
priority_queue
constexpr as part of P3372R3.Fixes #128671.