summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/bits/stl_heap.h
diff options
context:
space:
mode:
authorEdward Smith-Rowland <3dw4rd@verizon.net>2019-08-14 17:54:15 +0000
committerEdward Smith-Rowland <emsr@gcc.gnu.org>2019-08-14 17:54:15 +0000
commit7a91c710999d274c188fc0c504732a6f0b9059c1 (patch)
tree524bc4d35333f8ba97b84400a1f5908d8d51c4d3 /libstdc++-v3/include/bits/stl_heap.h
parent0bdf9f92531932ff1bb238ed84bf90597d9be3d2 (diff)
downloadgcc-7a91c710999d274c188fc0c504732a6f0b9059c1.tar.gz
Implement C++20 p0879 - Constexpr for swap and swap related functions.
2019-08-14 Edward Smith-Rowland <3dw4rd@verizon.net> Implement C++20 p0879 - Constexpr for swap and swap related functions. * include/std/version (__cpp_lib_constexpr_swap_algorithms): New macro. * include/bits/algorithmfwd.h (__cpp_lib_constexpr_swap_algorithms): New macro. (iter_swap, make_heap, next_permutation, partial_sort_copy, pop_heap) (prev_permutation, push_heap, reverse, rotate, sort_heap, swap) (swap_ranges, nth_element, partial_sort, sort): Add constexpr. * include/bits/move.h (swap): Add constexpr. * include/bits/stl_algo.h (__move_median_to_first, __reverse, reverse) (__gcd, __rotate, rotate, __partition, __heap_select) (__partial_sort_copy, partial_sort_copy, __unguarded_partition) (__unguarded_partition_pivot, __partial_sort, __introsort_loop, __sort) (__introselect, __chunk_insertion_sort, next_permutation) (prev_permutation, partition, partial_sort, nth_element, sort) (__iter_swap::iter_swap, iter_swap, swap_ranges): Add constexpr. * include/bits/stl_algobase.h (__iter_swap::iter_swap, iter_swap) (swap_ranges): Add constexpr. * include/bits/stl_heap.h (__push_heap, push_heap, __adjust_heap, __pop_heap, pop_heap, __make_heap, make_heap, __sort_heap, sort_heap): Add constexpr. * include/std/type_traits (swap): Add constexpr. * testsuite/25_algorithms/headers/algorithm/synopsis.cc: Add constexpr. * testsuite/25_algorithms/iter_swap/constexpr.cc: New test. * testsuite/25_algorithms/make_heap/constexpr.cc: New test. * testsuite/25_algorithms/next_permutation/constexpr.cc: New test. * testsuite/25_algorithms/nth_element/constexpr.cc: New test. * testsuite/25_algorithms/partial_sort/constexpr.cc: New test. * testsuite/25_algorithms/partial_sort_copy/constexpr.cc: New test. * testsuite/25_algorithms/partition/constexpr.cc: New test. * testsuite/25_algorithms/pop_heap/constexpr.cc: New test. * testsuite/25_algorithms/prev_permutation/constexpr.cc: New test. * testsuite/25_algorithms/push_heap/constexpr.cc: New test. * testsuite/25_algorithms/reverse/constexpr.cc: New test. * testsuite/25_algorithms/rotate/constexpr.cc: New test. * testsuite/25_algorithms/sort/constexpr.cc: New test. * testsuite/25_algorithms/sort_heap/constexpr.cc: New test. * testsuite/25_algorithms/swap/constexpr.cc: New test. * testsuite/25_algorithms/swap_ranges/constexpr.cc: New test. From-SVN: r274488
Diffstat (limited to 'libstdc++-v3/include/bits/stl_heap.h')
-rw-r--r--libstdc++-v3/include/bits/stl_heap.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/libstdc++-v3/include/bits/stl_heap.h b/libstdc++-v3/include/bits/stl_heap.h
index d9530e66621..7eb12f04321 100644
--- a/libstdc++-v3/include/bits/stl_heap.h
+++ b/libstdc++-v3/include/bits/stl_heap.h
@@ -129,6 +129,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _RandomAccessIterator, typename _Distance, typename _Tp,
typename _Compare>
+ _GLIBCXX20_CONSTEXPR
void
__push_heap(_RandomAccessIterator __first,
_Distance __holeIndex, _Distance __topIndex, _Tp __value,
@@ -155,6 +156,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* [__first,__last) is a valid heap.
*/
template<typename _RandomAccessIterator>
+ _GLIBCXX20_CONSTEXPR
inline void
push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
{
@@ -190,6 +192,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* performed using comp.
*/
template<typename _RandomAccessIterator, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
inline void
push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
_Compare __comp)
@@ -215,6 +218,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _RandomAccessIterator, typename _Distance,
typename _Tp, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
void
__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex,
_Distance __len, _Tp __value, _Compare __comp)
@@ -244,6 +248,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
template<typename _RandomAccessIterator, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
inline void
__pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
_RandomAccessIterator __result, _Compare& __comp)
@@ -272,6 +277,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* heap.
*/
template<typename _RandomAccessIterator>
+ _GLIBCXX20_CONSTEXPR
inline void
pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
{
@@ -305,6 +311,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* heap. Comparisons are made using comp.
*/
template<typename _RandomAccessIterator, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
inline void
pop_heap(_RandomAccessIterator __first,
_RandomAccessIterator __last, _Compare __comp)
@@ -327,6 +334,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
template<typename _RandomAccessIterator, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
void
__make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
_Compare& __comp)
@@ -361,6 +369,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* This operation makes the elements in [__first,__last) into a heap.
*/
template<typename _RandomAccessIterator>
+ _GLIBCXX20_CONSTEXPR
inline void
make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
{
@@ -387,6 +396,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* Comparisons are made using __comp.
*/
template<typename _RandomAccessIterator, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
inline void
make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
_Compare __comp)
@@ -403,6 +413,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
template<typename _RandomAccessIterator, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
void
__sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
_Compare& __comp)
@@ -423,6 +434,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* This operation sorts the valid heap in the range [__first,__last).
*/
template<typename _RandomAccessIterator>
+ _GLIBCXX20_CONSTEXPR
inline void
sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
{
@@ -450,6 +462,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* Comparisons are made using __comp.
*/
template<typename _RandomAccessIterator, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
inline void
sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
_Compare __comp)