diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm index c527860569b9..cea6b248c6fa 100644 --- a/libcxx/include/algorithm +++ b/libcxx/include/algorithm @@ -39,11 +39,11 @@ template InputIterator for_each_n(InputIterator first, Size n, Function f); // C++17 template - InputIterator + constexpr InputIterator // constexpr in C++20 find(InputIterator first, InputIterator last, const T& value); template - InputIterator + constexpr InputIterator // constexpr in C++20 find_if(InputIterator first, InputIterator last, Predicate pred); template @@ -127,22 +127,22 @@ template BinaryPredicate pred); // **C++14** template - bool + constexpr bool // constexpr in C++20 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2); template - bool + constexpr bool // constexpr in C++20 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2); // **C++14** template - bool + constexpr bool // constexpr in C++20 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, BinaryPredicate pred); template - bool + constexpr bool // constexpr in C++20 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred); // **C++14** @@ -302,7 +302,7 @@ template UniformRandomNumberGenerator&& g); template - bool + constexpr bool // constexpr in C++20 is_partitioned(InputIterator first, InputIterator last, Predicate pred); template @@ -325,7 +325,7 @@ template partition_point(ForwardIterator first, ForwardIterator last, Predicate pred); template - bool + constexpr bool // constexpr in C++20 is_sorted(ForwardIterator first, ForwardIterator last); template @@ -513,19 +513,19 @@ template sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); template - bool + constexpr bool // constexpr in C++20 is_heap(RandomAccessIterator first, RandomAccessiterator last); template - bool + constexpr bool // constexpr in C++20 is_heap(RandomAccessIterator first, RandomAccessiterator last, Compare comp); template - RandomAccessIterator + constexpr RandomAccessIterator // constexpr in C++20 is_heap_until(RandomAccessIterator first, RandomAccessiterator last); template - RandomAccessIterator + constexpr RandomAccessIterator // constexpr in C++20 is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp); template @@ -990,7 +990,7 @@ for_each_n(_InputIterator __first, _Size __orig_n, _Function __f) // find template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _InputIterator find(_InputIterator __first, _InputIterator __last, const _Tp& __value_) { @@ -1003,7 +1003,7 @@ find(_InputIterator __first, _InputIterator __last, const _Tp& __value_) // find_if template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _InputIterator find_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) { @@ -1395,17 +1395,18 @@ equal(_InputIterator1 __first1, _InputIterator1 __last1, // is_permutation template -bool +_LIBCPP_CONSTEXPR_AFTER_CXX17 bool is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _BinaryPredicate __pred) { - // shorten sequences as much as possible by lopping of any equal parts +// shorten sequences as much as possible by lopping of any equal prefix for (; __first1 != __last1; ++__first1, (void) ++__first2) if (!__pred(*__first1, *__first2)) - goto __not_done; - return true; -__not_done: - // __first1 != __last1 && *__first1 != *__first2 + break; + if (__first1 == __last1) + return true; + +// __first1 != __last1 && *__first1 != *__first2 typedef typename iterator_traits<_ForwardIterator1>::difference_type _D1; _D1 __l1 = _VSTD::distance(__first1, __last1); if (__l1 == _D1(1)) @@ -1415,11 +1416,8 @@ __not_done: // equal elements in [f2, l2) for (_ForwardIterator1 __i = __first1; __i != __last1; ++__i) { - // Have we already counted the number of *__i in [f1, l1)? - for (_ForwardIterator1 __j = __first1; __j != __i; ++__j) - if (__pred(*__j, *__i)) - goto __next_iter; - { + // Have we already counted the number of *__i in [f1, l1)? + if (find(__first1, __i, *__i) == __i) { // Count number of *__i in [f2, l2) _D1 __c2 = 0; for (_ForwardIterator2 __j = __first2; __j != __last2; ++__j) @@ -1435,13 +1433,12 @@ __not_done: if (__c1 != __c2) return false; } -__next_iter:; } return true; } template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2) @@ -1453,19 +1450,21 @@ is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, #if _LIBCPP_STD_VER > 11 template -bool +_LIBCPP_CONSTEXPR_AFTER_CXX17 bool __is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred, forward_iterator_tag, forward_iterator_tag ) { - // shorten sequences as much as possible by lopping of any equal parts +// shorten sequences as much as possible by lopping of any equal prefix for (; __first1 != __last1 && __first2 != __last2; ++__first1, (void) ++__first2) if (!__pred(*__first1, *__first2)) - goto __not_done; - return __first1 == __last1 && __first2 == __last2; -__not_done: - // __first1 != __last1 && __first2 != __last2 && *__first1 != *__first2 + break; + if (__first1 == __last1) + return __first2 == __last2; + else if (__first2 == __last2) + return false; + typedef typename iterator_traits<_ForwardIterator1>::difference_type _D1; _D1 __l1 = _VSTD::distance(__first1, __last1); @@ -1478,11 +1477,8 @@ __not_done: // equal elements in [f2, l2) for (_ForwardIterator1 __i = __first1; __i != __last1; ++__i) { - // Have we already counted the number of *__i in [f1, l1)? - for (_ForwardIterator1 __j = __first1; __j != __i; ++__j) - if (__pred(*__j, *__i)) - goto __next_iter; - { + // Have we already counted the number of *__i in [f1, l1)? + if (find(__first1, __i, *__i) == __i) { // Count number of *__i in [f2, l2) _D1 __c2 = 0; for (_ForwardIterator2 __j = __first2; __j != __last2; ++__j) @@ -1498,13 +1494,12 @@ __not_done: if (__c1 != __c2) return false; } -__next_iter:; } return true; } template -bool +_LIBCPP_CONSTEXPR_AFTER_CXX17 bool __is_permutation(_RandomAccessIterator1 __first1, _RandomAccessIterator2 __last1, _RandomAccessIterator1 __first2, _RandomAccessIterator2 __last2, _BinaryPredicate __pred, @@ -1518,7 +1513,7 @@ __is_permutation(_RandomAccessIterator1 __first1, _RandomAccessIterator2 __last1 } template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2, @@ -1531,7 +1526,7 @@ is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, } template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2) @@ -3231,7 +3226,7 @@ template } template -bool +_LIBCPP_CONSTEXPR_AFTER_CXX17 bool is_partitioned(_InputIterator __first, _InputIterator __last, _Predicate __pred) { for (; __first != __last; ++__first) @@ -3639,7 +3634,7 @@ stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate _ // is_sorted_until template -_ForwardIterator +_LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) { if (__first != __last) @@ -3656,7 +3651,7 @@ is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __co } template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator is_sorted_until(_ForwardIterator __first, _ForwardIterator __last) { @@ -3666,7 +3661,7 @@ is_sorted_until(_ForwardIterator __first, _ForwardIterator __last) // is_sorted template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool is_sorted(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) { @@ -3674,7 +3669,7 @@ is_sorted(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) } template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool is_sorted(_ForwardIterator __first, _ForwardIterator __last) { @@ -4834,7 +4829,7 @@ stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last) // is_heap_until template -_RandomAccessIterator +_LIBCPP_CONSTEXPR_AFTER_CXX17 _RandomAccessIterator is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { typedef typename _VSTD::iterator_traits<_RandomAccessIterator>::difference_type difference_type; @@ -4861,7 +4856,7 @@ is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp } template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _RandomAccessIterator is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last) { @@ -4871,7 +4866,7 @@ is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last) // is_heap template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { @@ -4879,7 +4874,7 @@ is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __ } template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) { diff --git a/libcxx/test/std/algorithms/alg.modifying.operations/alg.partitions/is_partitioned.pass.cpp b/libcxx/test/std/algorithms/alg.modifying.operations/alg.partitions/is_partitioned.pass.cpp index 8597b08da8cf..eb9be71c2b57 100644 --- a/libcxx/test/std/algorithms/alg.modifying.operations/alg.partitions/is_partitioned.pass.cpp +++ b/libcxx/test/std/algorithms/alg.modifying.operations/alg.partitions/is_partitioned.pass.cpp @@ -10,7 +10,7 @@ // // template -// bool +// constpexr bool // constexpr after C++17 // is_partitioned(InputIterator first, InputIterator last, Predicate pred); #include @@ -18,13 +18,24 @@ #include #include +#include "test_macros.h" #include "test_iterators.h" #include "counting_predicates.hpp" struct is_odd { - bool operator()(const int &i) const { return i & 1; } + TEST_CONSTEXPR bool operator()(const int &i) const { return i & 1; } }; +#if TEST_STD_VER > 17 +TEST_CONSTEXPR int test_constexpr() { + int ia[] = {1, 3, 5, 2, 4, 6}; + int ib[] = {1, 2, 3, 4, 5, 6}; + return std::is_partitioned(std::begin(ia), std::end(ia), is_odd()) + && !std::is_partitioned(std::begin(ib), std::end(ib), is_odd()); + } +#endif + + int main() { { const int ia[] = {1, 2, 3, 4, 5, 6}; @@ -80,4 +91,8 @@ int main() { assert(static_cast(pred.count()) <= std::distance(std::begin(ia), std::end(ia))); } + +#if TEST_STD_VER > 17 + static_assert(test_constexpr()); +#endif } diff --git a/libcxx/test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation.pass.cpp b/libcxx/test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation.pass.cpp index e3f7c3cd87db..cde76d5ca069 100644 --- a/libcxx/test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation.pass.cpp +++ b/libcxx/test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation.pass.cpp @@ -10,7 +10,7 @@ // // template -// bool +// constexpr bool // constexpr after C++17 // is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, // ForwardIterator2 first2); @@ -21,6 +21,21 @@ #include "test_macros.h" +#if TEST_STD_VER > 17 +TEST_CONSTEXPR int test_constexpr() { + int ia[] = {0, 0, 0}; + int ib[] = {1, 1, 0}; + int ic[] = {1, 0, 1}; + int id[] = {1}; + return !std::is_permutation(std::begin(ia), std::end(ia), std::begin(ib)) + && !std::is_permutation(std::begin(ia), std::end(ia), std::begin(ib), std::end(ib)) + && std::is_permutation(std::begin(ib), std::end(ib), std::begin(ic)) + && std::is_permutation(std::begin(ib), std::end(ib), std::begin(ic), std::end(ic)) + && !std::is_permutation(std::begin(ic), std::end(ic), std::begin(id), std::end(id)) + ; + } +#endif + int main() { { @@ -600,4 +615,8 @@ int main() forward_iterator(ib + sa)) == false); #endif } + +#if TEST_STD_VER > 17 + static_assert(test_constexpr()); +#endif } diff --git a/libcxx/test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation_pred.pass.cpp b/libcxx/test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation_pred.pass.cpp index 6e9cdaabd308..13129289629e 100644 --- a/libcxx/test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation_pred.pass.cpp +++ b/libcxx/test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation_pred.pass.cpp @@ -10,7 +10,7 @@ // // template -// bool +// constexpr bool // constexpr after C++17 // is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, // ForwardIterator2 first2, BinaryPredicate pred); @@ -28,6 +28,21 @@ bool counting_equals ( const T &a, const T &b ) { return a == b; } +#if TEST_STD_VER > 17 +TEST_CONSTEXPR int test_constexpr() { + int ia[] = {0, 0, 0}; + int ib[] = {1, 1, 0}; + int ic[] = {1, 0, 1}; + int id[] = {1}; + std::equal_to c; + return !std::is_permutation(std::begin(ia), std::end(ia), std::begin(ib) , c) + && !std::is_permutation(std::begin(ia), std::end(ia), std::begin(ib), std::end(ib), c) + && std::is_permutation(std::begin(ib), std::end(ib), std::begin(ic) , c) + && std::is_permutation(std::begin(ib), std::end(ib), std::begin(ic), std::end(ic), c) + && !std::is_permutation(std::begin(ic), std::end(ic), std::begin(id), std::end(id), c) + ; + } +#endif int main() { @@ -723,4 +738,8 @@ int main() std::equal_to()) == false); #endif } + +#if TEST_STD_VER > 17 + static_assert(test_constexpr()); +#endif } diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/is.heap/is_heap.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/is.heap/is_heap.pass.cpp index f16b2c3c61ae..8df07dad1a51 100644 --- a/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/is.heap/is_heap.pass.cpp +++ b/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/is.heap/is_heap.pass.cpp @@ -11,12 +11,23 @@ // template // requires LessThanComparable -// bool +// constexpr bool // constexpr after C++17 // is_heap(Iter first, Iter last); #include #include +#include "test_macros.h" + +#if TEST_STD_VER > 17 +TEST_CONSTEXPR int test_constexpr() { + int ia[] = {1, 1, 1, 1, 0, 1, 1}; + int ib[] = {0, 0, 1, 0, 0, 0, 0}; + return std::is_heap(std::begin(ia), std::end(ia)) + && !std::is_heap(std::begin(ib), std::end(ib)); + } +#endif + void test() { int i1[] = {0, 0}; @@ -518,4 +529,8 @@ void test() int main() { test(); + +#if TEST_STD_VER > 17 + static_assert(test_constexpr()); +#endif } diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/is.heap/is_heap_comp.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/is.heap/is_heap_comp.pass.cpp index af55cc499eda..80b5cd36f20c 100644 --- a/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/is.heap/is_heap_comp.pass.cpp +++ b/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/is.heap/is_heap_comp.pass.cpp @@ -11,13 +11,24 @@ // template // requires LessThanComparable -// bool +// constexpr bool // constexpr after C++17 // is_heap(Iter first, Iter last); #include #include #include +#include "test_macros.h" + +#if TEST_STD_VER > 17 +TEST_CONSTEXPR int test_constexpr() { + int ia[] = {0, 0, 1, 1, 1}; + int ib[] = {1, 0, 4, 1, 0}; + return std::is_heap(std::begin(ia), std::end(ia), std::greater()) + && !std::is_heap(std::begin(ib), std::end(ib), std::greater()); + } +#endif + void test() { int i1[] = {0, 0}; @@ -519,4 +530,8 @@ void test() int main() { test(); + +#if TEST_STD_VER > 17 + static_assert(test_constexpr()); +#endif } diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/is.heap/is_heap_until.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/is.heap/is_heap_until.pass.cpp index 082c04451825..5616401da79c 100644 --- a/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/is.heap/is_heap_until.pass.cpp +++ b/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/is.heap/is_heap_until.pass.cpp @@ -11,12 +11,23 @@ // template // requires LessThanComparable -// Iter +// constexpr bool // constexpr after C++17 // is_heap_until(Iter first, Iter last); #include #include +#include "test_macros.h" + +#if TEST_STD_VER > 17 +TEST_CONSTEXPR int test_constexpr() { + int ia[] = {0, 0, 0, 0, 1, 0}; + int ib[] = {0, 0, 0, 1, 1, 1}; + return (std::is_heap_until(std::begin(ia), std::end(ia)) == ia+4) + && (std::is_heap_until(std::begin(ib), std::end(ib)) == ib+3); + } +#endif + void test() { int i1[] = {0, 0}; @@ -518,4 +529,8 @@ void test() int main() { test(); + +#if TEST_STD_VER > 17 + static_assert(test_constexpr()); +#endif } diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/is.heap/is_heap_until_comp.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/is.heap/is_heap_until_comp.pass.cpp index 657c177fee56..dba4a0c7ffe1 100644 --- a/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/is.heap/is_heap_until_comp.pass.cpp +++ b/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/is.heap/is_heap_until_comp.pass.cpp @@ -11,13 +11,24 @@ // template Compare> // requires CopyConstructible -// Iter +// constexpr bool // constexpr after C++17 // is_heap_until(Iter first, Iter last, Compare comp); #include #include #include +#include "test_macros.h" + +#if TEST_STD_VER > 17 +TEST_CONSTEXPR int test_constexpr() { + int ia[] = {1, 0, 0, 0}; + int ib[] = {0, 1, 1, 0}; + return (std::is_heap_until(std::begin(ia), std::end(ia), std::greater()) == ia+1) + && (std::is_heap_until(std::begin(ib), std::end(ib), std::greater()) == ib+3); + } +#endif + void test() { int i1[] = {0, 0}; @@ -519,4 +530,8 @@ void test() int main() { test(); + +#if TEST_STD_VER > 17 + static_assert(test_constexpr()); +#endif } diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted.pass.cpp index dd6b5c1766ad..e50aae8ef180 100644 --- a/libcxx/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted.pass.cpp +++ b/libcxx/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted.pass.cpp @@ -19,6 +19,15 @@ #include "test_iterators.h" +#if TEST_STD_VER > 17 +TEST_CONSTEXPR int test_constexpr() { + int ia[] = {0, 0, 1, 1}; + int ib[] = {1, 1, 0, 0}; + return std::is_sorted(std::begin(ia), std::end(ia)) + && !std::is_sorted(std::begin(ib), std::end(ib)); + } +#endif + template void test() @@ -180,4 +189,8 @@ int main() test >(); test >(); test(); + +#if TEST_STD_VER > 17 + static_assert(test_constexpr()); +#endif } diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted_comp.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted_comp.pass.cpp index d5a34e2f2cb3..a1562d7c1ed1 100644 --- a/libcxx/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted_comp.pass.cpp +++ b/libcxx/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted_comp.pass.cpp @@ -20,6 +20,15 @@ #include "test_iterators.h" +#if TEST_STD_VER > 17 +TEST_CONSTEXPR int test_constexpr() { + int ia[] = {1, 1, 0, 0}; + int ib[] = {0, 0, 1, 1}; + return std::is_sorted(std::begin(ia), std::end(ia), std::greater()) + && !std::is_sorted(std::begin(ib), std::end(ib), std::greater()); + } +#endif + template void test() @@ -181,4 +190,8 @@ int main() test >(); test >(); test(); + +#if TEST_STD_VER > 17 + static_assert(test_constexpr()); +#endif } diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted_until.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted_until.pass.cpp index bef01027472c..5d30532c8254 100644 --- a/libcxx/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted_until.pass.cpp +++ b/libcxx/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted_until.pass.cpp @@ -19,6 +19,15 @@ #include "test_iterators.h" +#if TEST_STD_VER > 17 +TEST_CONSTEXPR int test_constexpr() { + int ia[] = {0, 1, 0}; + int ib[] = {0, 1, 1}; + return (std::is_sorted_until(std::begin(ia), std::end(ia)) == ia+2) + && (std::is_sorted_until(std::begin(ib), std::end(ib)) == ib+3); + } +#endif + template void test() @@ -180,4 +189,8 @@ int main() test >(); test >(); test(); + +#if TEST_STD_VER > 17 + static_assert(test_constexpr()); +#endif } diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted_until_comp.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted_until_comp.pass.cpp index 68ed29c6f4b8..37b5e44da358 100644 --- a/libcxx/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted_until_comp.pass.cpp +++ b/libcxx/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted_until_comp.pass.cpp @@ -20,6 +20,15 @@ #include "test_iterators.h" +#if TEST_STD_VER > 17 +TEST_CONSTEXPR int test_constexpr() { + int ia[] = {1, 0, 1}; + int ib[] = {1, 1, 0}; + return (std::is_sorted_until(std::begin(ia), std::end(ia), std::greater()) == ia+2) + && (std::is_sorted_until(std::begin(ib), std::end(ib), std::greater()) == ib+3); + } +#endif + template void test() @@ -181,4 +190,8 @@ int main() test >(); test >(); test(); + +#if TEST_STD_VER > 17 + static_assert(test_constexpr()); +#endif } diff --git a/libcxx/www/cxx2a_status.html b/libcxx/www/cxx2a_status.html index 1ff36a70e1e9..2c8d173378dc 100644 --- a/libcxx/www/cxx2a_status.html +++ b/libcxx/www/cxx2a_status.html @@ -60,12 +60,12 @@ P0020R6LWGFloating Point AtomicAlbuquerque P0053R7LWGC++ Synchronized Buffered OstreamAlbuquerque - P0202R3LWGAdd constexpr modifiers to functions in <algorithm> and <utility> HeadersAlbuquerque + P0202R3LWGAdd constexpr modifiers to functions in <algorithm> and <utility> HeadersAlbuquerqueIn Progress7.0 P0415R1LWGConstexpr for std::complexAlbuquerque P0439R0LWGMake std::memory_order a scoped enumerationAlbuquerque P0457R2LWGString Prefix and Suffix CheckingAlbuquerqueComplete6.0 P0550R2LWGTransformation Trait remove_cvrefAlbuquerqueComplete6.0 - P0600R1LWGnodiscard in the LibraryAlbuquerqueIn Progress + P0600R1LWGnodiscard in the LibraryAlbuquerqueIn Progress7.0 P0616R0LWGde-pessimize legacy algorithms with std::moveAlbuquerque P0653R2LWGUtility to convert a pointer to a raw pointerAlbuquerqueComplete6.0 P0718R2LWGAtomic shared_ptrAlbuquerque @@ -132,7 +132,7 @@ -

Last Updated: 16-Jul-2017

+

Last Updated: 15-Jan-2018