+2019-08-01 Edward Smith-Rowland <3dw4rd@verizon.net>
+
+ Implement C++20 p0202 - Add Constexpr Modifiers to Functions
+ in <algorithm> and <utility> Headers.
+ Implement C++20 p1023 - constexpr comparison operators for std::array.
+ * include/bits/algorithmfwd.h (all_of, any_of, binary_search, copy,
+ copy_backward, copy_if, copy_n, equal_range, fill, find_end,
+ find_if_not, includes, is_heap, is_heap_until, is_partitioned,
+ is_permutation, is_sorted, is_sorted_until, iter_swap, lower_bound,
+ none_of, partition_copy, partition_point, remove, remove_if,
+ remove_copy, remove_copy_if, replace_copy, replace_copy_if,
+ reverse_copy, rotate_copy, uunique, upper_bound, adjacent_find, count,
+ count_if, equal, find, find_first_of, find_if, for_each, generate,
+ generate_n, lexicographical_compare, merge, mismatch, replace,
+ replace_if, search, search_n, set_difference, set_intersection,
+ set_symmetric_difference, set_union, transform, unique_copy):
+ Mark constexpr.
+ * include/bits/cpp_type_traits.h (__miter_base): Mark constexpr.
+ * include/bits/predefined_ops.h (_Iter_less_val::operator(),
+ _Val_less_iter::operator(), _Iter_equal_to_iter::operator(),
+ _Iter_equal_to_val::operator(), _Iter_equals_val::operator()):
+ Use const ref instead of ref arg;
+ (_Iter_less_val, __iter_less_val, _Val_less_iter, __val_less_iter,
+ __iter_equal_to_iter, __iter_equal_to_val, __iter_comp_val,
+ _Iter_comp_val, _Val_comp_iter, __val_comp_iter, __iter_equals_val,
+ _Iter_equals_iter, __iter_comp_iter, _Iter_pred, __pred_iter,
+ _Iter_comp_to_val, __iter_comp_val, _Iter_comp_to_iter,
+ __iter_comp_iter): Mark constexpr.
+ * include/bits/stl_algo.h (__find_if, __find_if_not, __find_if_not_n,
+ __search, __search_n_aux, __search_n, __find_end, find_end, all_of,
+ none_of, any_of, find_if_not, is_partitioned, partition_point,
+ __remove_copy_if, remove_copy, remove_copy_if, copy_if, __copy_n,
+ copy_n, partition_copy, __remove_if, remove, remove_if, __adjacent_find,
+ __unique, unique, __unique_copy, reverse_copy, rotate_copy,
+ __unguarded_linear_insert, __insertion_sort, __unguarded_insertion_sort,
+ __final_insertion_sort, lower_bound, __upper_bound, upper_bound,
+ __equal_range, equal_range, binary_search, __includes, includes,
+ __next_permutation, __prev_permutation, __replace_copy_if, replace_copy,
+ replace_copy_if, __count_if, is_sorted, __is_sorted_until,
+ is_sorted_until, __is_permutation, is_permutation, for_each, find,
+ find_if, find_first_of, adjacent_find, count, count_if, search,
+ search_n, transform, replace, replace_if, generate, generate_n,
+ unique_copy, __merge, merge, __set_union, set_union, __set_intersection,
+ set_intersection, __set_difference, set_difference,
+ __set_symmetric_difference, set_symmetric_difference): Mark constexpr.
+ * include/bits/stl_algobase.h (__memmove, __memcmp): New maybe constexpr
+ wrappers around __builtin_memmove and __builtin_memcmp
+ respectively;
+ (__niter_base, __niter_wrap, __copy_m, __copy_move_a, __copy_move_a2,
+ copy, move, __copy_move_b, __copy_move_backward_a,
+ __copy_move_backward_a2, copy_backward, move_backward, __fill_a, fill,
+ __fill_n_a, fill_n, equal, __lc_rai::__newlast1, __lc_rai::__cnd2,
+ __lexicographical_compare_impl, __lexicographical_compare,
+ __lexicographical_compare<true>::__lc, __lexicographical_compare_aux,
+ __lower_bound, lower_bound, equal, __equal4, lexicographical_compare,
+ __mismatch, mismatch, __is_heap_until, __is_heap, is_heap_until,
+ is_heap): Mark constexpr.
+ * include/bits/stl_heap.h (__is_heap_until, __is_heap, is_heap_until,
+ is_heap): Mark constexpr.
+ * include/bits/stl_iterator.h (__niter_base, __miter_base): Mark constexpr.
+ * include/std/array: Make comparison ops constexpr.
+ * include/std/utility: Make exchange constexpr.
+ * include/std/version (__cpp_lib_constexpr_algorithms): New macro.
+ * testsuite/23_containers/array/tuple_interface/get_neg.cc: Adjust.
+ * testsuite/23_containers/array/tuple_interface/
+ tuple_element_neg.cc: Adjust.
+ * testsuite/20_util/exchange/constexpr.cc: New.
+ * testsuite/23_containers/array/comparison_operators/constexpr.cc: New.
+ * testsuite/25_algorithms/constexpr_macro.cc: New.
+ * testsuite/25_algorithms/adjacent_find/constexpr.cc: New.
+ * testsuite/25_algorithms/all_of/constexpr.cc: New.
+ * testsuite/25_algorithms/any_of/constexpr.cc: New.
+ * testsuite/25_algorithms/binary_search/constexpr.cc: New.
+ * testsuite/25_algorithms/copy/constexpr.cc: New.
+ * testsuite/25_algorithms/copy_backward/constexpr.cc: New.
+ * testsuite/25_algorithms/copy_if/constexpr.cc: New.
+ * testsuite/25_algorithms/copy_n/constexpr.cc: New.
+ * testsuite/25_algorithms/count/constexpr.cc: New.
+ * testsuite/25_algorithms/count_if/constexpr.cc: New.
+ * testsuite/25_algorithms/equal/constexpr.cc: New.
+ * testsuite/25_algorithms/equal_range/constexpr.cc: New.
+ * testsuite/25_algorithms/fill/constexpr.cc: New.
+ * testsuite/25_algorithms/fill_n/constexpr.cc: New.
+ * testsuite/25_algorithms/find/constexpr.cc: New.
+ * testsuite/25_algorithms/find_end/constexpr.cc: New.
+ * testsuite/25_algorithms/find_first_of/constexpr.cc: New.
+ * testsuite/25_algorithms/find_if/constexpr.cc: New.
+ * testsuite/25_algorithms/find_if_not/constexpr.cc: New.
+ * testsuite/25_algorithms/for_each/constexpr.cc: New.
+ * testsuite/25_algorithms/generate/constexpr.cc: New.
+ * testsuite/25_algorithms/generate_n/constexpr.cc: New.
+ * testsuite/25_algorithms/is_heap/constexpr.cc: New.
+ * testsuite/25_algorithms/is_heap_until/constexpr.cc: New.
+ * testsuite/25_algorithms/is_partitioned/constexpr.cc: New.
+ * testsuite/25_algorithms/is_permutation/constexpr.cc: New.
+ * testsuite/25_algorithms/is_sorted/constexpr.cc: New.
+ * testsuite/25_algorithms/is_sorted_until/constexpr.cc: New.
+ * testsuite/25_algorithms/lexicographical_compare/constexpr.cc: New.
+ * testsuite/25_algorithms/lower_bound/constexpr.cc: New.
+ * testsuite/25_algorithms/merge/constexpr.cc: New.
+ * testsuite/25_algorithms/mismatch/constexpr.cc: New.
+ * testsuite/25_algorithms/none_of/constexpr.cc: New.
+ * testsuite/25_algorithms/partition_copy/constexpr.cc: New.
+ * testsuite/25_algorithms/partition_point/constexpr.cc: New.
+ * testsuite/25_algorithms/remove/constexpr.cc: New.
+ * testsuite/25_algorithms/remove_copy/constexpr.cc: New.
+ * testsuite/25_algorithms/remove_copy_if/constexpr.cc: New.
+ * testsuite/25_algorithms/remove_if/constexpr.cc: New.
+ * testsuite/25_algorithms/replace_copy/constexpr.cc: New.
+ * testsuite/25_algorithms/replace_copy_if/constexpr.cc: New.
+ * testsuite/25_algorithms/replace_if/constexpr.cc: New.
+ * testsuite/25_algorithms/reverse_copy/constexpr.cc: New.
+ * testsuite/25_algorithms/rotate_copy/constexpr.cc: New.
+ * testsuite/25_algorithms/search/constexpr.cc: New.
+ * testsuite/25_algorithms/search_n/constexpr.cc: New.
+ * testsuite/25_algorithms/set_difference/constexpr.cc: New.
+ * testsuite/25_algorithms/set_intersection/constexpr.cc: New.
+ * testsuite/25_algorithms/set_symmetric_difference/constexpr.cc: New.
+ * testsuite/25_algorithms/set_union/constexpr.cc: New.
+ * testsuite/25_algorithms/transform/constexpr.cc: New.
+ * testsuite/25_algorithms/unique/constexpr.cc: New.
+ * testsuite/25_algorithms/unique_copy/constexpr.cc: New.
+ * testsuite/25_algorithms/upper_bound/constexpr.cc: New.
+
2019-07-31 Jonathan Wakely <jwakely@redhat.com>
* include/std/memory (make_obj_using_allocator): Qualify call to
// adjacent_find
+#if __cplusplus > 201703L
+# define __cpp_lib_constexpr_algorithms 201711L
+#endif
+
#if __cplusplus >= 201103L
template<typename _IIter, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
bool
all_of(_IIter, _IIter, _Predicate);
template<typename _IIter, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
bool
any_of(_IIter, _IIter, _Predicate);
#endif
template<typename _FIter, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
bool
binary_search(_FIter, _FIter, const _Tp&);
template<typename _FIter, typename _Tp, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
bool
binary_search(_FIter, _FIter, const _Tp&, _Compare);
#endif
template<typename _IIter, typename _OIter>
+ _GLIBCXX20_CONSTEXPR
_OIter
copy(_IIter, _IIter, _OIter);
template<typename _BIter1, typename _BIter2>
+ _GLIBCXX20_CONSTEXPR
_BIter2
copy_backward(_BIter1, _BIter1, _BIter2);
#if __cplusplus >= 201103L
template<typename _IIter, typename _OIter, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
_OIter
copy_if(_IIter, _IIter, _OIter, _Predicate);
template<typename _IIter, typename _Size, typename _OIter>
+ _GLIBCXX20_CONSTEXPR
_OIter
copy_n(_IIter, _Size, _OIter);
#endif
// count_if
template<typename _FIter, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
pair<_FIter, _FIter>
equal_range(_FIter, _FIter, const _Tp&);
template<typename _FIter, typename _Tp, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
pair<_FIter, _FIter>
equal_range(_FIter, _FIter, const _Tp&, _Compare);
template<typename _FIter, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
void
fill(_FIter, _FIter, const _Tp&);
template<typename _OIter, typename _Size, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
_OIter
fill_n(_OIter, _Size, const _Tp&);
// find
template<typename _FIter1, typename _FIter2>
+ _GLIBCXX20_CONSTEXPR
_FIter1
find_end(_FIter1, _FIter1, _FIter2, _FIter2);
template<typename _FIter1, typename _FIter2, typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
_FIter1
find_end(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate);
#if __cplusplus >= 201103L
template<typename _IIter, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
_IIter
find_if_not(_IIter, _IIter, _Predicate);
#endif
// generate_n
template<typename _IIter1, typename _IIter2>
+ _GLIBCXX20_CONSTEXPR
bool
includes(_IIter1, _IIter1, _IIter2, _IIter2);
template<typename _IIter1, typename _IIter2, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
bool
includes(_IIter1, _IIter1, _IIter2, _IIter2, _Compare);
#if __cplusplus >= 201103L
template<typename _RAIter>
+ _GLIBCXX20_CONSTEXPR
bool
is_heap(_RAIter, _RAIter);
template<typename _RAIter, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
bool
is_heap(_RAIter, _RAIter, _Compare);
template<typename _RAIter>
+ _GLIBCXX20_CONSTEXPR
_RAIter
is_heap_until(_RAIter, _RAIter);
template<typename _RAIter, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
_RAIter
is_heap_until(_RAIter, _RAIter, _Compare);
template<typename _IIter, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
bool
is_partitioned(_IIter, _IIter, _Predicate);
template<typename _FIter1, typename _FIter2>
+ _GLIBCXX20_CONSTEXPR
bool
is_permutation(_FIter1, _FIter1, _FIter2);
template<typename _FIter1, typename _FIter2,
typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
bool
is_permutation(_FIter1, _FIter1, _FIter2, _BinaryPredicate);
template<typename _FIter>
+ _GLIBCXX20_CONSTEXPR
bool
is_sorted(_FIter, _FIter);
template<typename _FIter, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
bool
is_sorted(_FIter, _FIter, _Compare);
template<typename _FIter>
+ _GLIBCXX20_CONSTEXPR
_FIter
is_sorted_until(_FIter, _FIter);
template<typename _FIter, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
_FIter
is_sorted_until(_FIter, _FIter, _Compare);
#endif
iter_swap(_FIter1, _FIter2);
template<typename _FIter, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
_FIter
lower_bound(_FIter, _FIter, const _Tp&);
template<typename _FIter, typename _Tp, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
_FIter
lower_bound(_FIter, _FIter, const _Tp&, _Compare);
#if __cplusplus >= 201103L
template<typename _IIter, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
bool
none_of(_IIter, _IIter, _Predicate);
#endif
#if __cplusplus >= 201103L
template<typename _IIter, typename _OIter1,
typename _OIter2, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
pair<_OIter1, _OIter2>
partition_copy(_IIter, _IIter, _OIter1, _OIter2, _Predicate);
template<typename _FIter, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
_FIter
partition_point(_FIter, _FIter, _Predicate);
#endif
// random_shuffle
template<typename _FIter, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
_FIter
remove(_FIter, _FIter, const _Tp&);
template<typename _FIter, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
_FIter
remove_if(_FIter, _FIter, _Predicate);
template<typename _IIter, typename _OIter, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
_OIter
remove_copy(_IIter, _IIter, _OIter, const _Tp&);
template<typename _IIter, typename _OIter, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
_OIter
remove_copy_if(_IIter, _IIter, _OIter, _Predicate);
// replace
template<typename _IIter, typename _OIter, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
_OIter
replace_copy(_IIter, _IIter, _OIter, const _Tp&, const _Tp&);
template<typename _Iter, typename _OIter, typename _Predicate, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
_OIter
replace_copy_if(_Iter, _Iter, _OIter, _Predicate, const _Tp&);
reverse(_BIter, _BIter);
template<typename _BIter, typename _OIter>
+ _GLIBCXX20_CONSTEXPR
_OIter
reverse_copy(_BIter, _BIter, _OIter);
}
template<typename _FIter, typename _OIter>
+ _GLIBCXX20_CONSTEXPR
_OIter
rotate_copy(_FIter, _FIter, _FIter, _OIter);
// transform
template<typename _FIter>
+ _GLIBCXX20_CONSTEXPR
_FIter
unique(_FIter, _FIter);
template<typename _FIter, typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
_FIter
unique(_FIter, _FIter, _BinaryPredicate);
// unique_copy
template<typename _FIter, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
_FIter
upper_bound(_FIter, _FIter, const _Tp&);
template<typename _FIter, typename _Tp, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
_FIter
upper_bound(_FIter, _FIter, const _Tp&, _Compare);
_GLIBCXX_BEGIN_NAMESPACE_ALGO
template<typename _FIter>
+ _GLIBCXX20_CONSTEXPR
_FIter
adjacent_find(_FIter, _FIter);
template<typename _FIter, typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
_FIter
adjacent_find(_FIter, _FIter, _BinaryPredicate);
template<typename _IIter, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
typename iterator_traits<_IIter>::difference_type
count(_IIter, _IIter, const _Tp&);
template<typename _IIter, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
typename iterator_traits<_IIter>::difference_type
count_if(_IIter, _IIter, _Predicate);
template<typename _IIter1, typename _IIter2>
+ _GLIBCXX20_CONSTEXPR
bool
equal(_IIter1, _IIter1, _IIter2);
template<typename _IIter1, typename _IIter2, typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
bool
equal(_IIter1, _IIter1, _IIter2, _BinaryPredicate);
template<typename _IIter, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
_IIter
find(_IIter, _IIter, const _Tp&);
template<typename _FIter1, typename _FIter2>
+ _GLIBCXX20_CONSTEXPR
_FIter1
find_first_of(_FIter1, _FIter1, _FIter2, _FIter2);
template<typename _FIter1, typename _FIter2, typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
_FIter1
find_first_of(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate);
template<typename _IIter, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
_IIter
find_if(_IIter, _IIter, _Predicate);
template<typename _IIter, typename _Funct>
+ _GLIBCXX20_CONSTEXPR
_Funct
for_each(_IIter, _IIter, _Funct);
template<typename _FIter, typename _Generator>
+ _GLIBCXX20_CONSTEXPR
void
generate(_FIter, _FIter, _Generator);
template<typename _OIter, typename _Size, typename _Generator>
+ _GLIBCXX20_CONSTEXPR
_OIter
generate_n(_OIter, _Size, _Generator);
template<typename _IIter1, typename _IIter2>
+ _GLIBCXX20_CONSTEXPR
bool
lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2);
template<typename _IIter1, typename _IIter2, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
bool
lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2, _Compare);
max_element(_FIter, _FIter, _Compare);
template<typename _IIter1, typename _IIter2, typename _OIter>
+ _GLIBCXX20_CONSTEXPR
_OIter
merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
template<typename _IIter1, typename _IIter2, typename _OIter,
typename _Compare>
+ _GLIBCXX20_CONSTEXPR
_OIter
merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);
min_element(_FIter, _FIter, _Compare);
template<typename _IIter1, typename _IIter2>
+ _GLIBCXX20_CONSTEXPR
pair<_IIter1, _IIter2>
mismatch(_IIter1, _IIter1, _IIter2);
template<typename _IIter1, typename _IIter2, typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
pair<_IIter1, _IIter2>
mismatch(_IIter1, _IIter1, _IIter2, _BinaryPredicate);
#endif
template<typename _FIter, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
void
replace(_FIter, _FIter, const _Tp&, const _Tp&);
template<typename _FIter, typename _Predicate, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
void
replace_if(_FIter, _FIter, _Predicate, const _Tp&);
template<typename _FIter1, typename _FIter2>
+ _GLIBCXX20_CONSTEXPR
_FIter1
search(_FIter1, _FIter1, _FIter2, _FIter2);
template<typename _FIter1, typename _FIter2, typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
_FIter1
search(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate);
template<typename _FIter, typename _Size, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
_FIter
search_n(_FIter, _FIter, _Size, const _Tp&);
template<typename _FIter, typename _Size, typename _Tp,
typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
_FIter
search_n(_FIter, _FIter, _Size, const _Tp&, _BinaryPredicate);
template<typename _IIter1, typename _IIter2, typename _OIter>
+ _GLIBCXX20_CONSTEXPR
_OIter
set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
template<typename _IIter1, typename _IIter2, typename _OIter,
typename _Compare>
+ _GLIBCXX20_CONSTEXPR
_OIter
set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);
template<typename _IIter1, typename _IIter2, typename _OIter>
+ _GLIBCXX20_CONSTEXPR
_OIter
set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
template<typename _IIter1, typename _IIter2, typename _OIter,
typename _Compare>
+ _GLIBCXX20_CONSTEXPR
_OIter
set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);
template<typename _IIter1, typename _IIter2, typename _OIter>
+ _GLIBCXX20_CONSTEXPR
_OIter
set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
template<typename _IIter1, typename _IIter2, typename _OIter,
typename _Compare>
+ _GLIBCXX20_CONSTEXPR
_OIter
set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2,
_OIter, _Compare);
template<typename _IIter1, typename _IIter2, typename _OIter>
+ _GLIBCXX20_CONSTEXPR
_OIter
set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
template<typename _IIter1, typename _IIter2, typename _OIter,
typename _Compare>
+ _GLIBCXX20_CONSTEXPR
_OIter
set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);
stable_sort(_RAIter, _RAIter, _Compare);
template<typename _IIter, typename _OIter, typename _UnaryOperation>
+ _GLIBCXX20_CONSTEXPR
_OIter
transform(_IIter, _IIter, _OIter, _UnaryOperation);
template<typename _IIter1, typename _IIter2, typename _OIter,
typename _BinaryOperation>
+ _GLIBCXX20_CONSTEXPR
_OIter
transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation);
template<typename _IIter, typename _OIter>
+ _GLIBCXX20_CONSTEXPR
_OIter
unique_copy(_IIter, _IIter, _OIter);
template<typename _IIter, typename _OIter, typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
_OIter
unique_copy(_IIter, _IIter, _OIter, _BinaryPredicate);
// Fallback implementation of the function in bits/stl_iterator.h used to
// remove the move_iterator wrapper.
template<typename _Iterator>
+ _GLIBCXX20_CONSTEXPR
inline _Iterator
__miter_base(_Iterator __it)
{ return __it; }
// C++11 version of std::exchange for internal use.
template <typename _Tp, typename _Up = _Tp>
+ _GLIBCXX20_CONSTEXPR
inline _Tp
__exchange(_Tp& __obj, _Up&& __new_val)
{
_Iter_less_val() { }
#endif
+ _GLIBCXX20_CONSTEXPR
explicit
_Iter_less_val(_Iter_less_iter) { }
template<typename _Iterator, typename _Value>
+ _GLIBCXX20_CONSTEXPR
bool
operator()(_Iterator __it, _Value& __val) const
{ return *__it < __val; }
};
+ _GLIBCXX20_CONSTEXPR
inline _Iter_less_val
__iter_less_val()
{ return _Iter_less_val(); }
+ _GLIBCXX20_CONSTEXPR
inline _Iter_less_val
__iter_comp_val(_Iter_less_iter)
{ return _Iter_less_val(); }
_Val_less_iter() { }
#endif
+ _GLIBCXX20_CONSTEXPR
explicit
_Val_less_iter(_Iter_less_iter) { }
template<typename _Value, typename _Iterator>
+ _GLIBCXX20_CONSTEXPR
bool
operator()(_Value& __val, _Iterator __it) const
{ return __val < *__it; }
};
+ _GLIBCXX20_CONSTEXPR
inline _Val_less_iter
__val_less_iter()
{ return _Val_less_iter(); }
+ _GLIBCXX20_CONSTEXPR
inline _Val_less_iter
__val_comp_iter(_Iter_less_iter)
{ return _Val_less_iter(); }
struct _Iter_equal_to_iter
{
template<typename _Iterator1, typename _Iterator2>
+ _GLIBCXX20_CONSTEXPR
bool
operator()(_Iterator1 __it1, _Iterator2 __it2) const
{ return *__it1 == *__it2; }
};
+ _GLIBCXX20_CONSTEXPR
inline _Iter_equal_to_iter
__iter_equal_to_iter()
{ return _Iter_equal_to_iter(); }
struct _Iter_equal_to_val
{
template<typename _Iterator, typename _Value>
+ _GLIBCXX20_CONSTEXPR
bool
operator()(_Iterator __it, _Value& __val) const
{ return *__it == __val; }
};
+ _GLIBCXX20_CONSTEXPR
inline _Iter_equal_to_val
__iter_equal_to_val()
{ return _Iter_equal_to_val(); }
+ _GLIBCXX20_CONSTEXPR
inline _Iter_equal_to_val
__iter_comp_val(_Iter_equal_to_iter)
{ return _Iter_equal_to_val(); }
{
_Compare _M_comp;
+ _GLIBCXX20_CONSTEXPR
explicit
_Iter_comp_val(_Compare __comp)
: _M_comp(_GLIBCXX_MOVE(__comp))
{ }
+ _GLIBCXX20_CONSTEXPR
explicit
_Iter_comp_val(const _Iter_comp_iter<_Compare>& __comp)
: _M_comp(__comp._M_comp)
{ }
#if __cplusplus >= 201103L
+ _GLIBCXX20_CONSTEXPR
explicit
_Iter_comp_val(_Iter_comp_iter<_Compare>&& __comp)
: _M_comp(std::move(__comp._M_comp))
#endif
template<typename _Iterator, typename _Value>
+ _GLIBCXX20_CONSTEXPR
bool
operator()(_Iterator __it, _Value& __val)
{ return bool(_M_comp(*__it, __val)); }
};
template<typename _Compare>
- inline _Iter_comp_val<_Compare>
+ _GLIBCXX20_CONSTEXPR
+ inline _Iter_comp_val<_Compare>
__iter_comp_val(_Compare __comp)
{ return _Iter_comp_val<_Compare>(_GLIBCXX_MOVE(__comp)); }
template<typename _Compare>
+ _GLIBCXX20_CONSTEXPR
inline _Iter_comp_val<_Compare>
__iter_comp_val(_Iter_comp_iter<_Compare> __comp)
{ return _Iter_comp_val<_Compare>(_GLIBCXX_MOVE(__comp)); }
{
_Compare _M_comp;
+ _GLIBCXX20_CONSTEXPR
explicit
_Val_comp_iter(_Compare __comp)
: _M_comp(_GLIBCXX_MOVE(__comp))
{ }
+ _GLIBCXX20_CONSTEXPR
explicit
_Val_comp_iter(const _Iter_comp_iter<_Compare>& __comp)
: _M_comp(__comp._M_comp)
{ }
#if __cplusplus >= 201103L
+ _GLIBCXX20_CONSTEXPR
explicit
_Val_comp_iter(_Iter_comp_iter<_Compare>&& __comp)
: _M_comp(std::move(__comp._M_comp))
#endif
template<typename _Value, typename _Iterator>
+ _GLIBCXX20_CONSTEXPR
bool
operator()(_Value& __val, _Iterator __it)
{ return bool(_M_comp(__val, *__it)); }
};
template<typename _Compare>
+ _GLIBCXX20_CONSTEXPR
inline _Val_comp_iter<_Compare>
__val_comp_iter(_Compare __comp)
{ return _Val_comp_iter<_Compare>(_GLIBCXX_MOVE(__comp)); }
template<typename _Compare>
+ _GLIBCXX20_CONSTEXPR
inline _Val_comp_iter<_Compare>
__val_comp_iter(_Iter_comp_iter<_Compare> __comp)
{ return _Val_comp_iter<_Compare>(_GLIBCXX_MOVE(__comp)); }
{
_Value& _M_value;
+ _GLIBCXX20_CONSTEXPR
explicit
_Iter_equals_val(_Value& __value)
: _M_value(__value)
{ }
template<typename _Iterator>
+ _GLIBCXX20_CONSTEXPR
bool
operator()(_Iterator __it)
{ return *__it == _M_value; }
};
template<typename _Value>
+ _GLIBCXX20_CONSTEXPR
inline _Iter_equals_val<_Value>
__iter_equals_val(_Value& __val)
{ return _Iter_equals_val<_Value>(__val); }
{
_Iterator1 _M_it1;
+ _GLIBCXX20_CONSTEXPR
explicit
_Iter_equals_iter(_Iterator1 __it1)
: _M_it1(__it1)
{ }
template<typename _Iterator2>
+ _GLIBCXX20_CONSTEXPR
bool
operator()(_Iterator2 __it2)
{ return *__it2 == *_M_it1; }
};
template<typename _Iterator>
+ _GLIBCXX20_CONSTEXPR
inline _Iter_equals_iter<_Iterator>
__iter_comp_iter(_Iter_equal_to_iter, _Iterator __it)
{ return _Iter_equals_iter<_Iterator>(__it); }
{
_Predicate _M_pred;
+ _GLIBCXX20_CONSTEXPR
explicit
_Iter_pred(_Predicate __pred)
: _M_pred(_GLIBCXX_MOVE(__pred))
{ }
template<typename _Iterator>
+ _GLIBCXX20_CONSTEXPR
bool
operator()(_Iterator __it)
{ return bool(_M_pred(*__it)); }
};
template<typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
inline _Iter_pred<_Predicate>
__pred_iter(_Predicate __pred)
{ return _Iter_pred<_Predicate>(_GLIBCXX_MOVE(__pred)); }
_Compare _M_comp;
_Value& _M_value;
+ _GLIBCXX20_CONSTEXPR
_Iter_comp_to_val(_Compare __comp, _Value& __value)
: _M_comp(_GLIBCXX_MOVE(__comp)), _M_value(__value)
{ }
template<typename _Iterator>
+ _GLIBCXX20_CONSTEXPR
bool
operator()(_Iterator __it)
{ return bool(_M_comp(*__it, _M_value)); }
template<typename _Compare, typename _Value>
_Iter_comp_to_val<_Compare, _Value>
+ _GLIBCXX20_CONSTEXPR
__iter_comp_val(_Compare __comp, _Value &__val)
{
return _Iter_comp_to_val<_Compare, _Value>(_GLIBCXX_MOVE(__comp), __val);
_Compare _M_comp;
_Iterator1 _M_it1;
+ _GLIBCXX20_CONSTEXPR
_Iter_comp_to_iter(_Compare __comp, _Iterator1 __it1)
: _M_comp(_GLIBCXX_MOVE(__comp)), _M_it1(__it1)
{ }
template<typename _Iterator2>
+ _GLIBCXX20_CONSTEXPR
bool
operator()(_Iterator2 __it2)
{ return bool(_M_comp(*__it2, *_M_it1)); }
};
template<typename _Compare, typename _Iterator>
+ _GLIBCXX20_CONSTEXPR
inline _Iter_comp_to_iter<_Compare, _Iterator>
__iter_comp_iter(_Iter_comp_iter<_Compare> __comp, _Iterator __it)
{
{
_Predicate _M_pred;
+ _GLIBCXX20_CONSTEXPR
explicit
_Iter_negate(_Predicate __pred)
: _M_pred(_GLIBCXX_MOVE(__pred))
{ }
template<typename _Iterator>
+ _GLIBCXX20_CONSTEXPR
bool
operator()(_Iterator __it)
{ return !bool(_M_pred(*__it)); }
};
template<typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
inline _Iter_negate<_Predicate>
__negate(_Iter_pred<_Predicate> __pred)
{ return _Iter_negate<_Predicate>(_GLIBCXX_MOVE(__pred._M_pred)); }
/// This is an overload used by find algos for the Input Iterator case.
template<typename _InputIterator, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
inline _InputIterator
__find_if(_InputIterator __first, _InputIterator __last,
_Predicate __pred, input_iterator_tag)
/// This is an overload used by find algos for the RAI case.
template<typename _RandomAccessIterator, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
_RandomAccessIterator
__find_if(_RandomAccessIterator __first, _RandomAccessIterator __last,
_Predicate __pred, random_access_iterator_tag)
}
template<typename _Iterator, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
inline _Iterator
__find_if(_Iterator __first, _Iterator __last, _Predicate __pred)
{
/// Provided for stable_partition to use.
template<typename _InputIterator, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
inline _InputIterator
__find_if_not(_InputIterator __first, _InputIterator __last,
_Predicate __pred)
/// remaining range length instead of comparing against an end
/// iterator.
template<typename _InputIterator, typename _Predicate, typename _Distance>
+ _GLIBCXX20_CONSTEXPR
_InputIterator
__find_if_not_n(_InputIterator __first, _Distance& __len, _Predicate __pred)
{
template<typename _ForwardIterator1, typename _ForwardIterator2,
typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
_ForwardIterator1
__search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2,
__gnu_cxx::__ops::__iter_comp_iter(__predicate, __first2));
// General case.
- _ForwardIterator2 __p;
_ForwardIterator1 __current = __first1;
for (;;)
if (__first1 == __last1)
return __last1;
- __p = __p1;
+ _ForwardIterator2 __p = __p1;
__current = __first1;
if (++__current == __last1)
return __last1;
*/
template<typename _ForwardIterator, typename _Integer,
typename _UnaryPredicate>
+ _GLIBCXX20_CONSTEXPR
_ForwardIterator
__search_n_aux(_ForwardIterator __first, _ForwardIterator __last,
_Integer __count, _UnaryPredicate __unary_pred,
*/
template<typename _RandomAccessIter, typename _Integer,
typename _UnaryPredicate>
+ _GLIBCXX20_CONSTEXPR
_RandomAccessIter
__search_n_aux(_RandomAccessIter __first, _RandomAccessIter __last,
_Integer __count, _UnaryPredicate __unary_pred,
template<typename _ForwardIterator, typename _Integer,
typename _UnaryPredicate>
+ _GLIBCXX20_CONSTEXPR
_ForwardIterator
__search_n(_ForwardIterator __first, _ForwardIterator __last,
_Integer __count,
// find_end for forward iterators.
template<typename _ForwardIterator1, typename _ForwardIterator2,
typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
_ForwardIterator1
__find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2,
// find_end for bidirectional iterators (much faster).
template<typename _BidirectionalIterator1, typename _BidirectionalIterator2,
typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
_BidirectionalIterator1
__find_end(_BidirectionalIterator1 __first1,
_BidirectionalIterator1 __last1,
* [__first1,__last1-(__last2-__first2))
*/
template<typename _ForwardIterator1, typename _ForwardIterator2>
+ _GLIBCXX20_CONSTEXPR
inline _ForwardIterator1
find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2)
*/
template<typename _ForwardIterator1, typename _ForwardIterator2,
typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
inline _ForwardIterator1
find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2,
* @p [__first,__last), and false otherwise.
*/
template<typename _InputIterator, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
inline bool
all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
{ return __last == std::find_if_not(__first, __last, __pred); }
* @p [__first,__last), and false otherwise.
*/
template<typename _InputIterator, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
inline bool
none_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
{ return __last == _GLIBCXX_STD_A::find_if(__first, __last, __pred); }
* otherwise.
*/
template<typename _InputIterator, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
inline bool
any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
{ return !std::none_of(__first, __last, __pred); }
* such that @p __pred(*i) is false, or @p __last if no such iterator exists.
*/
template<typename _InputIterator, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
inline _InputIterator
find_if_not(_InputIterator __first, _InputIterator __last,
_Predicate __pred)
* do not.
*/
template<typename _InputIterator, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
inline bool
is_partitioned(_InputIterator __first, _InputIterator __last,
_Predicate __pred)
* and @p none_of(mid, __last, __pred) are both true.
*/
template<typename _ForwardIterator, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
_ForwardIterator
partition_point(_ForwardIterator __first, _ForwardIterator __last,
_Predicate __pred)
_DistanceType;
_DistanceType __len = std::distance(__first, __last);
- _DistanceType __half;
- _ForwardIterator __middle;
while (__len > 0)
{
- __half = __len >> 1;
- __middle = __first;
+ _DistanceType __half = __len >> 1;
+ _ForwardIterator __middle = __first;
std::advance(__middle, __half);
if (__pred(*__middle))
{
template<typename _InputIterator, typename _OutputIterator,
typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
_OutputIterator
__remove_copy_if(_InputIterator __first, _InputIterator __last,
_OutputIterator __result, _Predicate __pred)
* are copied is unchanged.
*/
template<typename _InputIterator, typename _OutputIterator, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
inline _OutputIterator
remove_copy(_InputIterator __first, _InputIterator __last,
_OutputIterator __result, const _Tp& __value)
*/
template<typename _InputIterator, typename _OutputIterator,
typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
inline _OutputIterator
remove_copy_if(_InputIterator __first, _InputIterator __last,
_OutputIterator __result, _Predicate __pred)
*/
template<typename _InputIterator, typename _OutputIterator,
typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
_OutputIterator
copy_if(_InputIterator __first, _InputIterator __last,
_OutputIterator __result, _Predicate __pred)
}
template<typename _InputIterator, typename _Size, typename _OutputIterator>
+ _GLIBCXX20_CONSTEXPR
_OutputIterator
__copy_n(_InputIterator __first, _Size __n,
_OutputIterator __result, input_iterator_tag)
template<typename _RandomAccessIterator, typename _Size,
typename _OutputIterator>
+ _GLIBCXX20_CONSTEXPR
inline _OutputIterator
__copy_n(_RandomAccessIterator __first, _Size __n,
_OutputIterator __result, random_access_iterator_tag)
* optimizations such as unrolling).
*/
template<typename _InputIterator, typename _Size, typename _OutputIterator>
+ _GLIBCXX20_CONSTEXPR
inline _OutputIterator
copy_n(_InputIterator __first, _Size __n, _OutputIterator __result)
{
*/
template<typename _InputIterator, typename _OutputIterator1,
typename _OutputIterator2, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
pair<_OutputIterator1, _OutputIterator2>
partition_copy(_InputIterator __first, _InputIterator __last,
_OutputIterator1 __out_true, _OutputIterator2 __out_false,
#endif
template<typename _ForwardIterator, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
_ForwardIterator
__remove_if(_ForwardIterator __first, _ForwardIterator __last,
_Predicate __pred)
* are still present, but their value is unspecified.
*/
template<typename _ForwardIterator, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
remove(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __value)
* are still present, but their value is unspecified.
*/
template<typename _ForwardIterator, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
remove_if(_ForwardIterator __first, _ForwardIterator __last,
_Predicate __pred)
}
template<typename _ForwardIterator, typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
_ForwardIterator
__adjacent_find(_ForwardIterator __first, _ForwardIterator __last,
_BinaryPredicate __binary_pred)
}
template<typename _ForwardIterator, typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
_ForwardIterator
__unique(_ForwardIterator __first, _ForwardIterator __last,
_BinaryPredicate __binary_pred)
* are still present, but their value is unspecified.
*/
template<typename _ForwardIterator>
+ _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
unique(_ForwardIterator __first, _ForwardIterator __last)
{
* are still present, but their value is unspecified.
*/
template<typename _ForwardIterator, typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
unique(_ForwardIterator __first, _ForwardIterator __last,
_BinaryPredicate __binary_pred)
*/
template<typename _ForwardIterator, typename _OutputIterator,
typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
_OutputIterator
__unique_copy(_ForwardIterator __first, _ForwardIterator __last,
_OutputIterator __result, _BinaryPredicate __binary_pred,
*/
template<typename _InputIterator, typename _OutputIterator,
typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
_OutputIterator
__unique_copy(_InputIterator __first, _InputIterator __last,
_OutputIterator __result, _BinaryPredicate __binary_pred,
*/
template<typename _InputIterator, typename _ForwardIterator,
typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
_ForwardIterator
__unique_copy(_InputIterator __first, _InputIterator __last,
_ForwardIterator __result, _BinaryPredicate __binary_pred,
* [__result,__result+(__last-__first)) must not overlap.
*/
template<typename _BidirectionalIterator, typename _OutputIterator>
+ _GLIBCXX20_CONSTEXPR
_OutputIterator
reverse_copy(_BidirectionalIterator __first, _BidirectionalIterator __last,
_OutputIterator __result)
* for each @p n in the range @p [0,__last-__first).
*/
template<typename _ForwardIterator, typename _OutputIterator>
+ _GLIBCXX20_CONSTEXPR
inline _OutputIterator
rotate_copy(_ForwardIterator __first, _ForwardIterator __middle,
_ForwardIterator __last, _OutputIterator __result)
/// This is a helper function for the sort routine.
template<typename _RandomAccessIterator, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
void
__unguarded_linear_insert(_RandomAccessIterator __last,
_Compare __comp)
/// This is a helper function for the sort routine.
template<typename _RandomAccessIterator, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
void
__insertion_sort(_RandomAccessIterator __first,
_RandomAccessIterator __last, _Compare __comp)
/// This is a helper function for the sort routine.
template<typename _RandomAccessIterator, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
inline void
__unguarded_insertion_sort(_RandomAccessIterator __first,
_RandomAccessIterator __last, _Compare __comp)
/// This is a helper function for the sort routine.
template<typename _RandomAccessIterator, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
void
__final_insertion_sort(_RandomAccessIterator __first,
_RandomAccessIterator __last, _Compare __comp)
* the function used for the initial sort.
*/
template<typename _ForwardIterator, typename _Tp, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
lower_bound(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val, _Compare __comp)
}
template<typename _ForwardIterator, typename _Tp, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
_ForwardIterator
__upper_bound(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val, _Compare __comp)
* @ingroup binary_search_algorithms
*/
template<typename _ForwardIterator, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
upper_bound(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val)
* the function used for the initial sort.
*/
template<typename _ForwardIterator, typename _Tp, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
upper_bound(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val, _Compare __comp)
template<typename _ForwardIterator, typename _Tp,
typename _CompareItTp, typename _CompareTpIt>
+ _GLIBCXX20_CONSTEXPR
pair<_ForwardIterator, _ForwardIterator>
__equal_range(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val,
* but does not actually call those functions.
*/
template<typename _ForwardIterator, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
inline pair<_ForwardIterator, _ForwardIterator>
equal_range(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val)
* but does not actually call those functions.
*/
template<typename _ForwardIterator, typename _Tp, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
inline pair<_ForwardIterator, _ForwardIterator>
equal_range(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val, _Compare __comp)
* that, use std::find or a container's specialized find member functions.
*/
template<typename _ForwardIterator, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
bool
binary_search(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val)
* the function used for the initial sort.
*/
template<typename _ForwardIterator, typename _Tp, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
bool
binary_search(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val, _Compare __comp)
template<typename _InputIterator1, typename _InputIterator2,
typename _Compare>
+ _GLIBCXX20_CONSTEXPR
bool
__includes(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
* returned.
*/
template<typename _InputIterator1, typename _InputIterator2>
+ _GLIBCXX20_CONSTEXPR
inline bool
includes(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2)
*/
template<typename _InputIterator1, typename _InputIterator2,
typename _Compare>
+ _GLIBCXX20_CONSTEXPR
inline bool
includes(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
// max_element
template<typename _BidirectionalIterator, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
bool
__next_permutation(_BidirectionalIterator __first,
_BidirectionalIterator __last, _Compare __comp)
}
template<typename _BidirectionalIterator, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
bool
__prev_permutation(_BidirectionalIterator __first,
_BidirectionalIterator __last, _Compare __comp)
template<typename _InputIterator, typename _OutputIterator,
typename _Predicate, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
_OutputIterator
__replace_copy_if(_InputIterator __first, _InputIterator __last,
_OutputIterator __result,
* equal to @p __old_value with @p __new_value.
*/
template<typename _InputIterator, typename _OutputIterator, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
inline _OutputIterator
replace_copy(_InputIterator __first, _InputIterator __last,
_OutputIterator __result,
*/
template<typename _InputIterator, typename _OutputIterator,
typename _Predicate, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
inline _OutputIterator
replace_copy_if(_InputIterator __first, _InputIterator __last,
_OutputIterator __result,
}
template<typename _InputIterator, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
typename iterator_traits<_InputIterator>::difference_type
__count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred)
{
* @return True if the elements are sorted, false otherwise.
*/
template<typename _ForwardIterator>
+ _GLIBCXX20_CONSTEXPR
inline bool
is_sorted(_ForwardIterator __first, _ForwardIterator __last)
{ return std::is_sorted_until(__first, __last) == __last; }
* @return True if the elements are sorted, false otherwise.
*/
template<typename _ForwardIterator, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
inline bool
is_sorted(_ForwardIterator __first, _ForwardIterator __last,
_Compare __comp)
{ return std::is_sorted_until(__first, __last, __comp) == __last; }
template<typename _ForwardIterator, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
_ForwardIterator
__is_sorted_until(_ForwardIterator __first, _ForwardIterator __last,
_Compare __comp)
* for which the range [__first, i) is sorted.
*/
template<typename _ForwardIterator>
+ _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
is_sorted_until(_ForwardIterator __first, _ForwardIterator __last)
{
* for which the range [__first, i) is sorted.
*/
template<typename _ForwardIterator, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
is_sorted_until(_ForwardIterator __first, _ForwardIterator __last,
_Compare __comp)
template<typename _ForwardIterator1, typename _ForwardIterator2,
typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
bool
__is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _BinaryPredicate __pred)
* returns true; otherwise, returns false.
*/
template<typename _ForwardIterator1, typename _ForwardIterator2>
+ _GLIBCXX20_CONSTEXPR
inline bool
is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2)
*/
template<typename _ForwardIterator1, typename _ForwardIterator2,
typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
inline bool
is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _BinaryPredicate __pred)
#if __cplusplus > 201103L
template<typename _ForwardIterator1, typename _ForwardIterator2,
typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
bool
__is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2,
* otherwise, returns false.
*/
template<typename _ForwardIterator1, typename _ForwardIterator2>
+ _GLIBCXX20_CONSTEXPR
inline bool
is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2)
*/
template<typename _ForwardIterator1, typename _ForwardIterator2,
typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
inline bool
is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2,
* If @p __f has a return value it is ignored.
*/
template<typename _InputIterator, typename _Function>
+ _GLIBCXX20_CONSTEXPR
_Function
for_each(_InputIterator __first, _InputIterator __last, _Function __f)
{
* such that @c *i == @p __val, or @p __last if no such iterator exists.
*/
template<typename _InputIterator, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
inline _InputIterator
find(_InputIterator __first, _InputIterator __last,
const _Tp& __val)
* such that @p __pred(*i) is true, or @p __last if no such iterator exists.
*/
template<typename _InputIterator, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
inline _InputIterator
find_if(_InputIterator __first, _InputIterator __last,
_Predicate __pred)
* otherwise returns @p __last1.
*/
template<typename _InputIterator, typename _ForwardIterator>
+ _GLIBCXX20_CONSTEXPR
_InputIterator
find_first_of(_InputIterator __first1, _InputIterator __last1,
_ForwardIterator __first2, _ForwardIterator __last2)
*/
template<typename _InputIterator, typename _ForwardIterator,
typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
_InputIterator
find_first_of(_InputIterator __first1, _InputIterator __last1,
_ForwardIterator __first2, _ForwardIterator __last2,
* or @p __last if no such iterator exists.
*/
template<typename _ForwardIterator>
+ _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
adjacent_find(_ForwardIterator __first, _ForwardIterator __last)
{
* exists.
*/
template<typename _ForwardIterator, typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
adjacent_find(_ForwardIterator __first, _ForwardIterator __last,
_BinaryPredicate __binary_pred)
* for which @c *i == @p __value
*/
template<typename _InputIterator, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
inline typename iterator_traits<_InputIterator>::difference_type
count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
{
* for which @p __pred(*i) is true.
*/
template<typename _InputIterator, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
inline typename iterator_traits<_InputIterator>::difference_type
count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred)
{
* @p [__first1,__last1-(__last2-__first2))
*/
template<typename _ForwardIterator1, typename _ForwardIterator2>
+ _GLIBCXX20_CONSTEXPR
inline _ForwardIterator1
search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2)
*/
template<typename _ForwardIterator1, typename _ForwardIterator2,
typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
inline _ForwardIterator1
search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2,
* equal to @p __val.
*/
template<typename _ForwardIterator, typename _Integer, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
search_n(_ForwardIterator __first, _ForwardIterator __last,
_Integer __count, const _Tp& __val)
*/
template<typename _ForwardIterator, typename _Integer, typename _Tp,
typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
search_n(_ForwardIterator __first, _ForwardIterator __last,
_Integer __count, const _Tp& __val,
*/
template<typename _InputIterator, typename _OutputIterator,
typename _UnaryOperation>
+ _GLIBCXX20_CONSTEXPR
_OutputIterator
transform(_InputIterator __first, _InputIterator __last,
_OutputIterator __result, _UnaryOperation __unary_op)
*/
template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator, typename _BinaryOperation>
+ _GLIBCXX20_CONSTEXPR
_OutputIterator
transform(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _OutputIterator __result,
* @p __old_value then the assignment @c *i = @p __new_value is performed.
*/
template<typename _ForwardIterator, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
void
replace(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __old_value, const _Tp& __new_value)
* is true then the assignment @c *i = @p __new_value is performed.
*/
template<typename _ForwardIterator, typename _Predicate, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
void
replace_if(_ForwardIterator __first, _ForwardIterator __last,
_Predicate __pred, const _Tp& __new_value)
* @p [__first,__last).
*/
template<typename _ForwardIterator, typename _Generator>
+ _GLIBCXX20_CONSTEXPR
void
generate(_ForwardIterator __first, _ForwardIterator __last,
_Generator __gen)
// DR 865. More algorithms that throw away information
// DR 426. search_n(), fill_n(), and generate_n() with negative n
template<typename _OutputIterator, typename _Size, typename _Generator>
+ _GLIBCXX20_CONSTEXPR
_OutputIterator
generate_n(_OutputIterator __first, _Size __n, _Generator __gen)
{
* Assignable?
*/
template<typename _InputIterator, typename _OutputIterator>
+ _GLIBCXX20_CONSTEXPR
inline _OutputIterator
unique_copy(_InputIterator __first, _InputIterator __last,
_OutputIterator __result)
*/
template<typename _InputIterator, typename _OutputIterator,
typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
inline _OutputIterator
unique_copy(_InputIterator __first, _InputIterator __last,
_OutputIterator __result,
template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
_OutputIterator
__merge(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
*/
template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator>
+ _GLIBCXX20_CONSTEXPR
inline _OutputIterator
merge(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
*/
template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
inline _OutputIterator
merge(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator,
typename _Compare>
+ _GLIBCXX20_CONSTEXPR
_OutputIterator
__set_union(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
*/
template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator>
+ _GLIBCXX20_CONSTEXPR
inline _OutputIterator
set_union(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
*/
template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
inline _OutputIterator
set_union(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator,
typename _Compare>
+ _GLIBCXX20_CONSTEXPR
_OutputIterator
__set_intersection(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
*/
template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator>
+ _GLIBCXX20_CONSTEXPR
inline _OutputIterator
set_intersection(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
*/
template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
inline _OutputIterator
set_intersection(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator,
typename _Compare>
+ _GLIBCXX20_CONSTEXPR
_OutputIterator
__set_difference(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
*/
template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator>
+ _GLIBCXX20_CONSTEXPR
inline _OutputIterator
set_difference(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
*/
template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
inline _OutputIterator
set_difference(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator,
typename _Compare>
+ _GLIBCXX20_CONSTEXPR
_OutputIterator
__set_symmetric_difference(_InputIterator1 __first1,
_InputIterator1 __last1,
*/
template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator>
+ _GLIBCXX20_CONSTEXPR
inline _OutputIterator
set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
*/
template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
inline _OutputIterator
set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+ /*
+ * A constexpr wrapper for __builtin_memmove.
+ * @param __num The number of elements of type _Tp (not bytes).
+ */
+ template<bool _IsMove, typename _Tp>
+ _GLIBCXX14_CONSTEXPR
+ inline void*
+ __memmove(_Tp* __dst, const _Tp* __src, size_t __num)
+ {
+#ifdef __cpp_lib_is_constant_evaluated
+ if (std::is_constant_evaluated())
+ {
+ for(; __num > 0; --__num)
+ {
+ if constexpr (_IsMove)
+ *__dst = std::move(*__src);
+ else
+ *__dst = *__src;
+ ++__src;
+ ++__dst;
+ }
+ return __dst;
+ }
+ else
+#endif
+ return __builtin_memmove(__dst, __src, sizeof(_Tp) * __num);
+ return __dst;
+ }
+
+ /*
+ * A constexpr wrapper for __builtin_memcmp.
+ * @param __num The number of elements of type _Tp (not bytes).
+ */
+ template<typename _Tp>
+ _GLIBCXX14_CONSTEXPR
+ inline int
+ __memcmp(const _Tp* __first1, const _Tp* __first2, size_t __num)
+ {
+#ifdef __cpp_lib_is_constant_evaluated
+ if (std::is_constant_evaluated())
+ {
+ for(; __num > 0; ++__first1, ++__first2, --__num)
+ if (*__first1 != *__first2)
+ return *__first1 < *__first2 ? -1 : 1;
+ return 0;
+ }
+ else
+#endif
+ return __builtin_memcmp(__first1, __first2, sizeof(_Tp) * __num);
+ }
+
#if __cplusplus < 201103L
// See http://gcc.gnu.org/ml/libstdc++/2004-08/msg00167.html: in a
// nutshell, we are partially implementing the resolution of DR 187,
// Fallback implementation of the function in bits/stl_iterator.h used to
// remove the __normal_iterator wrapper. See copy, fill, ...
template<typename _Iterator>
+ _GLIBCXX20_CONSTEXPR
inline _Iterator
__niter_base(_Iterator __it)
_GLIBCXX_NOEXCEPT_IF(std::is_nothrow_copy_constructible<_Iterator>::value)
// __normal_iterator back again (this assumes that __normal_iterator
// is only used to wrap random access iterators, like pointers).
template<typename _From, typename _To>
+ _GLIBCXX20_CONSTEXPR
inline _From
__niter_wrap(_From __from, _To __res)
{ return __from + (__res - std::__niter_base(__from)); }
// No need to wrap, iterator already has the right type.
template<typename _Iterator>
+ _GLIBCXX20_CONSTEXPR
inline _Iterator
__niter_wrap(const _Iterator&, _Iterator __res)
{ return __res; }
struct __copy_move
{
template<typename _II, typename _OI>
+ _GLIBCXX20_CONSTEXPR
static _OI
__copy_m(_II __first, _II __last, _OI __result)
{
struct __copy_move<true, false, _Category>
{
template<typename _II, typename _OI>
+ _GLIBCXX20_CONSTEXPR
static _OI
__copy_m(_II __first, _II __last, _OI __result)
{
struct __copy_move<false, false, random_access_iterator_tag>
{
template<typename _II, typename _OI>
+ _GLIBCXX20_CONSTEXPR
static _OI
__copy_m(_II __first, _II __last, _OI __result)
{
struct __copy_move<true, false, random_access_iterator_tag>
{
template<typename _II, typename _OI>
+ _GLIBCXX20_CONSTEXPR
static _OI
__copy_m(_II __first, _II __last, _OI __result)
{
struct __copy_move<_IsMove, true, random_access_iterator_tag>
{
template<typename _Tp>
+ _GLIBCXX20_CONSTEXPR
static _Tp*
__copy_m(const _Tp* __first, const _Tp* __last, _Tp* __result)
{
#endif
const ptrdiff_t _Num = __last - __first;
if (_Num)
- __builtin_memmove(__result, __first, sizeof(_Tp) * _Num);
+ std::__memmove<_IsMove>(__result, __first, _Num);
return __result + _Num;
}
};
template<bool _IsMove, typename _II, typename _OI>
+ _GLIBCXX20_CONSTEXPR
inline _OI
__copy_move_a(_II __first, _II __last, _OI __result)
{
&& __is_pointer<_II>::__value
&& __is_pointer<_OI>::__value
&& __are_same<_ValueTypeI, _ValueTypeO>::__value);
-
return std::__copy_move<_IsMove, __simple,
_Category>::__copy_m(__first, __last, __result);
}
istreambuf_iterator<_CharT, char_traits<_CharT> >, _CharT*);
template<bool _IsMove, typename _II, typename _OI>
+ _GLIBCXX20_CONSTEXPR
inline _OI
__copy_move_a2(_II __first, _II __last, _OI __result)
{
* within [first,last).
*/
template<typename _II, typename _OI>
+ _GLIBCXX20_CONSTEXPR
inline _OI
copy(_II __first, _II __last, _OI __result)
{
* within [first,last).
*/
template<typename _II, typename _OI>
+ _GLIBCXX20_CONSTEXPR
inline _OI
move(_II __first, _II __last, _OI __result)
{
struct __copy_move_backward
{
template<typename _BI1, typename _BI2>
+ _GLIBCXX20_CONSTEXPR
static _BI2
__copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
{
struct __copy_move_backward<true, false, _Category>
{
template<typename _BI1, typename _BI2>
+ _GLIBCXX20_CONSTEXPR
static _BI2
__copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
{
struct __copy_move_backward<false, false, random_access_iterator_tag>
{
template<typename _BI1, typename _BI2>
+ _GLIBCXX20_CONSTEXPR
static _BI2
__copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
{
- typename iterator_traits<_BI1>::difference_type __n;
- for (__n = __last - __first; __n > 0; --__n)
+ typename iterator_traits<_BI1>::difference_type
+ __n = __last - __first;
+ for (; __n > 0; --__n)
*--__result = *--__last;
return __result;
}
struct __copy_move_backward<true, false, random_access_iterator_tag>
{
template<typename _BI1, typename _BI2>
+ _GLIBCXX20_CONSTEXPR
static _BI2
__copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
{
- typename iterator_traits<_BI1>::difference_type __n;
- for (__n = __last - __first; __n > 0; --__n)
+ typename iterator_traits<_BI1>::difference_type
+ __n = __last - __first;
+ for (; __n > 0; --__n)
*--__result = std::move(*--__last);
return __result;
}
struct __copy_move_backward<_IsMove, true, random_access_iterator_tag>
{
template<typename _Tp>
+ _GLIBCXX20_CONSTEXPR
static _Tp*
__copy_move_b(const _Tp* __first, const _Tp* __last, _Tp* __result)
{
#endif
const ptrdiff_t _Num = __last - __first;
if (_Num)
- __builtin_memmove(__result - _Num, __first, sizeof(_Tp) * _Num);
+ std::__memmove<_IsMove>(__result - _Num, __first, _Num);
return __result - _Num;
}
};
template<bool _IsMove, typename _BI1, typename _BI2>
+ _GLIBCXX20_CONSTEXPR
inline _BI2
__copy_move_backward_a(_BI1 __first, _BI1 __last, _BI2 __result)
{
&& __is_pointer<_BI2>::__value
&& __are_same<_ValueType1, _ValueType2>::__value);
+#ifdef __cpp_lib_is_constant_evaluated
+ if (std::is_constant_evaluated())
+ return std::__copy_move_backward<true, false,
+ _Category>::__copy_move_b(__first, __last,
+ __result);
+#endif
return std::__copy_move_backward<_IsMove, __simple,
_Category>::__copy_move_b(__first,
__last,
}
template<bool _IsMove, typename _BI1, typename _BI2>
+ _GLIBCXX20_CONSTEXPR
inline _BI2
__copy_move_backward_a2(_BI1 __first, _BI1 __last, _BI2 __result)
{
* that the start of the output range may overlap [first,last).
*/
template<typename _BI1, typename _BI2>
+ _GLIBCXX20_CONSTEXPR
inline _BI2
copy_backward(_BI1 __first, _BI1 __last, _BI2 __result)
{
* that the start of the output range may overlap [first,last).
*/
template<typename _BI1, typename _BI2>
+ _GLIBCXX20_CONSTEXPR
inline _BI2
move_backward(_BI1 __first, _BI1 __last, _BI2 __result)
{
#endif
template<typename _ForwardIterator, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
inline typename
__gnu_cxx::__enable_if<!__is_scalar<_Tp>::__value, void>::__type
__fill_a(_ForwardIterator __first, _ForwardIterator __last,
}
template<typename _ForwardIterator, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
inline typename
__gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type
__fill_a(_ForwardIterator __first, _ForwardIterator __last,
* to @c memset or @c wmemset.
*/
template<typename _ForwardIterator, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
inline void
fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
{
#endif
template<typename _OutputIterator, typename _Size, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
inline typename
__gnu_cxx::__enable_if<!__is_scalar<_Tp>::__value, _OutputIterator>::__type
__fill_n_a(_OutputIterator __first, _Size __n, const _Tp& __value)
}
template<typename _OutputIterator, typename _Size, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
inline typename
__gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, _OutputIterator>::__type
__fill_n_a(_OutputIterator __first, _Size __n, const _Tp& __value)
}
template<typename _Size, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
inline typename
__gnu_cxx::__enable_if<__is_byte<_Tp>::__value, _Tp*>::__type
__fill_n_a(_Tp* __first, _Size __n, const _Tp& __c)
// DR 865. More algorithms that throw away information
// DR 426. search_n(), fill_n(), and generate_n() with negative n
template<typename _OI, typename _Size, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
inline _OI
fill_n(_OI __first, _Size __n, const _Tp& __value)
{
struct __equal
{
template<typename _II1, typename _II2>
+ _GLIBCXX20_CONSTEXPR
static bool
equal(_II1 __first1, _II1 __last1, _II2 __first2)
{
struct __equal<true>
{
template<typename _Tp>
+ _GLIBCXX20_CONSTEXPR
static bool
equal(const _Tp* __first1, const _Tp* __last1, const _Tp* __first2)
{
if (const size_t __len = (__last1 - __first1))
- return !__builtin_memcmp(__first1, __first2, sizeof(_Tp) * __len);
+ return !std::__memcmp(__first1, __first2, __len);
return true;
}
};
template<typename _II1, typename _II2>
+ _GLIBCXX20_CONSTEXPR
inline bool
__equal_aux(_II1 __first1, _II1 __last1, _II2 __first2)
{
struct __lc_rai
{
template<typename _II1, typename _II2>
+ _GLIBCXX20_CONSTEXPR
static _II1
__newlast1(_II1, _II1 __last1, _II2, _II2)
{ return __last1; }
template<typename _II>
+ _GLIBCXX20_CONSTEXPR
static bool
__cnd2(_II __first, _II __last)
{ return __first != __last; }
struct __lc_rai<random_access_iterator_tag, random_access_iterator_tag>
{
template<typename _RAI1, typename _RAI2>
+ _GLIBCXX20_CONSTEXPR
static _RAI1
__newlast1(_RAI1 __first1, _RAI1 __last1,
_RAI2 __first2, _RAI2 __last2)
}
template<typename _RAI>
- static bool
+ static _GLIBCXX20_CONSTEXPR bool
__cnd2(_RAI, _RAI)
{ return true; }
};
template<typename _II1, typename _II2, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
bool
__lexicographical_compare_impl(_II1 __first1, _II1 __last1,
_II2 __first2, _II2 __last2,
struct __lexicographical_compare
{
template<typename _II1, typename _II2>
+ _GLIBCXX20_CONSTEXPR
static bool __lc(_II1, _II1, _II2, _II2);
};
template<bool _BoolType>
template<typename _II1, typename _II2>
+ _GLIBCXX20_CONSTEXPR
bool
__lexicographical_compare<_BoolType>::
__lc(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2)
struct __lexicographical_compare<true>
{
template<typename _Tp, typename _Up>
+ _GLIBCXX20_CONSTEXPR
static bool
__lc(const _Tp* __first1, const _Tp* __last1,
const _Up* __first2, const _Up* __last2)
const size_t __len1 = __last1 - __first1;
const size_t __len2 = __last2 - __first2;
if (const size_t __len = std::min(__len1, __len2))
- if (int __result = __builtin_memcmp(__first1, __first2, __len))
+ if (int __result = std::__memcmp(__first1, __first2, __len))
return __result < 0;
return __len1 < __len2;
}
};
template<typename _II1, typename _II2>
+ _GLIBCXX20_CONSTEXPR
inline bool
__lexicographical_compare_aux(_II1 __first1, _II1 __last1,
_II2 __first2, _II2 __last2)
}
template<typename _ForwardIterator, typename _Tp, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
_ForwardIterator
__lower_bound(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val, _Compare __comp)
* @ingroup binary_search_algorithms
*/
template<typename _ForwardIterator, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
lower_bound(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val)
* ranges are equal.
*/
template<typename _II1, typename _II2>
+ _GLIBCXX20_CONSTEXPR
inline bool
equal(_II1 __first1, _II1 __last1, _II2 __first2)
{
* ranges are equal.
*/
template<typename _IIter1, typename _IIter2, typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
inline bool
equal(_IIter1 __first1, _IIter1 __last1,
_IIter2 __first2, _BinaryPredicate __binary_pred)
#if __cplusplus >= 201103L
// 4-iterator version of std::equal<It1, It2> for use in C++11.
template<typename _II1, typename _II2>
+ _GLIBCXX20_CONSTEXPR
inline bool
__equal4(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2)
{
// 4-iterator version of std::equal<It1, It2, BinaryPred> for use in C++11.
template<typename _II1, typename _II2, typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
inline bool
__equal4(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2,
_BinaryPredicate __binary_pred)
* ranges are equal.
*/
template<typename _II1, typename _II2>
+ _GLIBCXX20_CONSTEXPR
inline bool
equal(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2)
{
* ranges are equal.
*/
template<typename _IIter1, typename _IIter2, typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
inline bool
equal(_IIter1 __first1, _IIter1 __last1,
_IIter2 __first2, _IIter2 __last2, _BinaryPredicate __binary_pred)
* then this is an inline call to @c memcmp.
*/
template<typename _II1, typename _II2>
+ _GLIBCXX20_CONSTEXPR
inline bool
lexicographical_compare(_II1 __first1, _II1 __last1,
_II2 __first2, _II2 __last2)
* comp parameter instead of @c <.
*/
template<typename _II1, typename _II2, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
inline bool
lexicographical_compare(_II1 __first1, _II1 __last1,
_II2 __first2, _II2 __last2, _Compare __comp)
template<typename _InputIterator1, typename _InputIterator2,
typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
pair<_InputIterator1, _InputIterator2>
__mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _BinaryPredicate __binary_pred)
* to by the iterators are not equal.
*/
template<typename _InputIterator1, typename _InputIterator2>
+ _GLIBCXX20_CONSTEXPR
inline pair<_InputIterator1, _InputIterator2>
mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2)
*/
template<typename _InputIterator1, typename _InputIterator2,
typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
inline pair<_InputIterator1, _InputIterator2>
mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _BinaryPredicate __binary_pred)
template<typename _InputIterator1, typename _InputIterator2,
typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
pair<_InputIterator1, _InputIterator2>
__mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
* to by the iterators are not equal.
*/
template<typename _InputIterator1, typename _InputIterator2>
+ _GLIBCXX20_CONSTEXPR
inline pair<_InputIterator1, _InputIterator2>
mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2)
*/
template<typename _InputIterator1, typename _InputIterator2,
typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
inline pair<_InputIterator1, _InputIterator2>
mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
template<typename _RandomAccessIterator, typename _Distance,
typename _Compare>
+ _GLIBCXX20_CONSTEXPR
_Distance
__is_heap_until(_RandomAccessIterator __first, _Distance __n,
_Compare& __comp)
// __is_heap, a predicate testing whether or not a range is a heap.
// This function is an extension, not part of the C++ standard.
template<typename _RandomAccessIterator, typename _Distance>
+ _GLIBCXX20_CONSTEXPR
inline bool
__is_heap(_RandomAccessIterator __first, _Distance __n)
{
template<typename _RandomAccessIterator, typename _Compare,
typename _Distance>
+ _GLIBCXX20_CONSTEXPR
inline bool
__is_heap(_RandomAccessIterator __first, _Compare __comp, _Distance __n)
{
}
template<typename _RandomAccessIterator>
+ _GLIBCXX20_CONSTEXPR
inline bool
__is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
{ return std::__is_heap(__first, std::distance(__first, __last)); }
template<typename _RandomAccessIterator, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
inline bool
__is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
_Compare __comp)
* the range [__first, i) is a heap.
*/
template<typename _RandomAccessIterator>
+ _GLIBCXX20_CONSTEXPR
inline _RandomAccessIterator
is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last)
{
* the range [__first, i) is a heap. Comparisons are made using __comp.
*/
template<typename _RandomAccessIterator, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
inline _RandomAccessIterator
is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last,
_Compare __comp)
* @ingroup heap_algorithms
*/
template<typename _RandomAccessIterator>
+ _GLIBCXX20_CONSTEXPR
inline bool
is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
{ return std::is_heap_until(__first, __last) == __last; }
* @ingroup heap_algorithms
*/
template<typename _RandomAccessIterator, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
inline bool
is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
_Compare __comp)
#if __cplusplus >= 201103L
template<typename _Iterator>
- auto
+ _GLIBCXX20_CONSTEXPR auto
__niter_base(reverse_iterator<_Iterator> __it)
-> decltype(__make_reverse_iterator(__niter_base(__it.base())))
{ return __make_reverse_iterator(__niter_base(__it.base())); }
{ };
template<typename _Iterator>
- auto
+ _GLIBCXX20_CONSTEXPR auto
__miter_base(reverse_iterator<_Iterator> __it)
-> decltype(__make_reverse_iterator(__miter_base(__it.base())))
{ return __make_reverse_iterator(__miter_base(__it.base())); }
// Array comparisons.
template<typename _Tp, std::size_t _Nm>
+ _GLIBCXX20_CONSTEXPR
inline bool
operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return std::equal(__one.begin(), __one.end(), __two.begin()); }
template<typename _Tp, std::size_t _Nm>
+ _GLIBCXX20_CONSTEXPR
inline bool
operator!=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one == __two); }
template<typename _Tp, std::size_t _Nm>
+ _GLIBCXX20_CONSTEXPR
inline bool
operator<(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b)
{
}
template<typename _Tp, std::size_t _Nm>
+ _GLIBCXX20_CONSTEXPR
inline bool
operator>(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return __two < __one; }
template<typename _Tp, std::size_t _Nm>
+ _GLIBCXX20_CONSTEXPR
inline bool
operator<=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one > __two); }
template<typename _Tp, std::size_t _Nm>
+ _GLIBCXX20_CONSTEXPR
inline bool
operator>=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one < __two); }
_GLIBCXX_STD_C::__array_traits<_Tp, _Nm>::_Is_swappable::value
>::type
#else
+ _GLIBCXX20_CONSTEXPR
void
#endif
swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two)
#define __cpp_lib_exchange_function 201304
+#if __cplusplus > 201703L
+# define __cpp_lib_constexpr_algorithms 201711L
+#endif
+
/// Assign @p __new_val to @p __obj and return its previous value.
template <typename _Tp, typename _Up = _Tp>
+ _GLIBCXX20_CONSTEXPR
inline _Tp
exchange(_Tp& __obj, _Up&& __new_val)
{ return std::__exchange(__obj, std::forward<_Up>(__new_val)); }
+
#endif
// Stores a tuple of indices. Used by tuple and pair, and by bind() to
#endif
#define __cpp_lib_list_remove_return_type 201806L
#define __cpp_lib_math_constants 201907L
+#define __cpp_lib_constexpr_algorithms 201711L
#endif // C++2a
#endif // C++17
#endif // C++14
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <utility>
+
+constexpr bool
+test()
+{
+ constexpr double e_v = 2.71828182846;
+ double e = e_v;
+ constexpr double pi_v = 3.14159265359;
+ const auto x = std::exchange(e, pi_v);
+
+ return x == e_v && e == pi_v;
+}
+
+static_assert(test());
--- /dev/null
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+//
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <array>
+
+constexpr std::array<int, 3> a1{{1, 2, 3}};
+constexpr std::array<int, 3> a2{{4, 5, 6}};
+constexpr std::array<int, 3> a3{{1, 2, 4}};
+constexpr std::array<int, 3> a4{{1, 3, 3}};
+
+static_assert(a1 == a1);
+static_assert(a1 != a2);
+static_assert(a1 < a3);
+static_assert(a4 > a1);
+static_assert(a1 <= a3);
+static_assert(a4 >= a1);
int n2 = std::get<1>(std::move(a));
int n3 = std::get<1>(ca);
-// { dg-error "static assertion failed" "" { target *-*-* } 309 }
-// { dg-error "static assertion failed" "" { target *-*-* } 318 }
-// { dg-error "static assertion failed" "" { target *-*-* } 326 }
+// { dg-error "static assertion failed" "" { target *-*-* } 316 }
+// { dg-error "static assertion failed" "" { target *-*-* } 325 }
+// { dg-error "static assertion failed" "" { target *-*-* } 333 }
typedef std::tuple_element<1, std::array<int, 1>>::type type;
-// { dg-error "static assertion failed" "" { target *-*-* } 365 }
+// { dg-error "static assertion failed" "" { target *-*-* } 372 }
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr std::array<int, 12> car{{0, 1, 2, 3, 4, 5, 6, 6, 8, 9, 9, 11}};
+
+constexpr auto out0x = std::adjacent_find(car.begin(), car.end());
+
+constexpr auto out1x = std::adjacent_find(car.begin(), car.end(),
+ std::equal_to<int>());
+
+constexpr bool
+test()
+{
+ return out0x == car.begin() + 6 && out1x == car.begin() + 6;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr std::array<int, 6> cae{{0, 2, 4, 6, 8, 10}};
+
+constexpr auto out2 = std::all_of(cae.begin(), cae.end(),
+ [](int i){ return i % 2 == 0; });
+
+constexpr bool
+test()
+{
+ return true;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+
+ const auto out3 = std::any_of(ca0.begin(), ca0.end(),
+ [](int i){ return i % 2 == 0; });
+
+ return true;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+
+ const auto out4 = std::binary_search(ca0.begin(), ca0.end(), 5);
+
+ const auto out5 = std::binary_search(ca0.begin(), ca0.end(), 5,
+ std::equal_to<int>());
+
+ return true;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <version>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing in <version>"
+#elif __cpp_lib_constexpr_algorithms != 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value in <version>"
+#endif
test01(T* result)
{
T t[1];
- std::copy(t, t+1, result); // { dg-error "here" }
+ std::copy(t, t+1, result); // { dg-error "here|deleted" }
}
// { dg-prune-output "not assignable" }
+// { dg-prune-output "use of deleted" }
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+ std::array<int, 12> ma0{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
+
+ const auto out6 = std::copy(ca0.begin(), ca0.begin() + 8, ma0.begin() + 2);
+
+ return out6 == ma0.begin() + 10;
+}
+
+static_assert(test());
trivial_rvalstruct a[1], b[1];
copy(std::make_move_iterator(a), std::make_move_iterator(a + 1), b);
}
+// { dg-prune-output "use of deleted" }
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+
+ std::array<int, 12> ma0{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
+ const auto out7 = std::copy_backward(ca0.begin(), ca0.begin() + 8,
+ ma0.begin() + 10);
+
+ return true;
+}
+
+static_assert(test());
trivial_rvalstruct a[1], b[1];
copy_backward(std::make_move_iterator(a), std::make_move_iterator(a+1), b);
}
+// { dg-prune-output "use of deleted" }
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+
+constexpr bool
+test()
+{
+ std::array<int, 12> ma0{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
+ const auto out1 = std::copy_if(ca0.begin(), ca0.end(), ma0.begin(),
+ [](int i){ return i % 2 == 1; });
+
+ return out1 == ma0.begin() + 6;
+}
+
+static_assert(test());
test01(T* result)
{
T t[1];
- std::copy_n(t, 1, result); // { dg-error "here" }
+ std::copy_n(t, 1, result); // { dg-error "here|deleted" }
}
// { dg-prune-output "not assignable" }
+// { dg-prune-output "use of deleted" }
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+
+constexpr bool
+test()
+{
+ std::array<int, 12> ma0{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
+ std::copy_n(ca0.begin(), 12, ma0.begin());
+
+ return ma0[3] == ca0[3];
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+
+ const auto out8 = std::count(ca0.begin(), ca0.end(), 6);
+
+ return true;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+
+constexpr auto out9 = std::count_if(ca0.begin(), ca0.end(),
+ [](int i){ return i % 2 == 0; });
+
+constexpr bool
+test()
+{
+ return out9 == 6;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+ constexpr std::array<int, 12> ca1{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+ constexpr std::array<int, 12> cas{{3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}};
+
+ const auto outa = std::equal(ca0.begin(), ca0.end(), ca1.begin());
+
+ const auto outb = std::equal(ca0.begin(), ca0.end(), cas.begin(),
+ [](int i, int j){ return i + 3 == j; });
+
+ return true;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ constexpr std::array<int, 12> car{{0, 1, 2, 3, 4, 5, 6, 6, 8, 9, 9, 11}};
+
+ const auto outc = std::equal_range(car.begin(), car.end(), 6);
+
+ return true;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ std::array<int, 12> ma0{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
+ std::fill(ma0.begin(), ma0.end(), 66);
+
+ return true;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ std::array<int, 12> ma0{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
+
+ const auto outd = std::fill_n(ma0.begin(), 6, 77);
+
+ return outd == ma0.begin() + 6;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+
+constexpr auto oute = std::find(ca0.begin(), ca0.end(), 5);
+
+constexpr bool
+test()
+{
+ return oute == ca0.begin() + 5;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+ constexpr std::array<int, 3> cam{{4, 5, 6}};
+ constexpr std::array<int, 3> camm{{-4, -5, -6}};
+
+ const auto outf = std::find_end(ca0.begin(), ca0.end(),
+ cam.begin(), cam.end());
+
+ const auto outg = std::find_end(ca0.begin(), ca0.end(),
+ camm.begin(), camm.end(),
+ [](int i, int j){ return i + 1 == -j; });
+
+ return true;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+constexpr std::array<int, 12> cas{{3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}};
+
+constexpr auto outh = std::find_first_of(ca0.begin(), ca0.end(),
+ cas.begin(), cas.end());
+
+constexpr auto outi = std::find_first_of(ca0.begin(), ca0.end(),
+ cas.begin(), cas.end(),
+ [](int i, int j){ return i + 1 == j; });
+
+constexpr bool
+test()
+{
+ return outh == ca0.begin() + 3 && outi == ca0.begin() + 2;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+
+ const auto outj = std::find_if(ca0.begin(), ca0.end(),
+ [](int i){ return i == 6; });
+
+ return true;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+
+constexpr auto outk = std::find_if_not(ca0.begin(), ca0.end(),
+ [](int i){ return i <= 6; });
+
+constexpr bool
+test()
+{
+ return outk == ca0.begin() + 7;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+
+constexpr bool
+test()
+{
+ int tot = 0;
+ auto sum = [&total = tot](int i){ total += i; };
+ auto sum2 = std::for_each(ca0.begin(), ca0.end(), sum);
+
+ return tot == 66;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ std::array<int, 12> ma0{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
+
+ std::generate(ma0.begin(), ma0.begin() + 6, [](){ return 42; });
+
+ return ma0[5] == 42;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ std::array<int, 12> ma0{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
+
+ const auto outl = std::generate_n(ma0.begin(), 6, [](){ return 42; });
+
+ return outl == ma0.begin() + 6;
+}
+
+static_assert(test());
{
// 25.1, non-modifying sequence operations:
template<typename _IIter, typename _Funct>
+ _GLIBCXX20_CONSTEXPR
_Funct
for_each(_IIter, _IIter, _Funct);
template<typename _IIter, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
_IIter
find(_IIter, _IIter, const _Tp&);
template<typename _IIter, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
_IIter
find_if(_IIter, _IIter, _Predicate);
#if __cplusplus >= 201103L
template<typename _IIter, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
bool
all_of(_IIter, _IIter, _Predicate);
template<typename _IIter, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
bool
any_of(_IIter, _IIter, _Predicate);
template<typename _IIter, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
bool
none_of(_IIter, _IIter, _Predicate);
template<typename _IIter, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
_IIter
find_if_not(_IIter, _IIter, _Predicate);
template<typename _IIter, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
bool
is_partitioned(_IIter, _IIter, _Predicate);
template<typename _FIter, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
_FIter
partition_point(_FIter, _FIter, _Predicate);
#endif
template<typename _FIter1, typename _FIter2>
+ _GLIBCXX20_CONSTEXPR
_FIter1
find_end(_FIter1, _FIter1, _FIter2, _FIter2);
template<typename _FIter1, typename _FIter2, typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
_FIter1
find_end(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate);
template<typename _FIter1, typename _FIter2>
+ _GLIBCXX20_CONSTEXPR
_FIter1
find_first_of(_FIter1, _FIter1, _FIter2, _FIter2);
template<typename _FIter1, typename _FIter2, typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
_FIter1
find_first_of(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate);
template<typename _FIter>
+ _GLIBCXX20_CONSTEXPR
_FIter
adjacent_find(_FIter, _FIter);
template<typename _FIter, typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
_FIter
adjacent_find(_FIter, _FIter, _BinaryPredicate);
template<typename _IIter, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
typename iterator_traits<_IIter>::difference_type
count(_IIter, _IIter, const _Tp&);
template<typename _IIter, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
typename iterator_traits<_IIter>::difference_type
count_if(_IIter, _IIter, _Predicate);
template<typename _IIter1, typename _IIter2>
+ _GLIBCXX20_CONSTEXPR
pair<_IIter1, _IIter2>
mismatch(_IIter1, _IIter1, _IIter2);
template<typename _IIter1, typename _IIter2, typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
pair<_IIter1, _IIter2>
mismatch(_IIter1, _IIter1, _IIter2, _BinaryPredicate);
template<typename _IIter1, typename _IIter2>
+ _GLIBCXX20_CONSTEXPR
bool
equal(_IIter1, _IIter1, _IIter2);
template<typename _IIter1, typename _IIter2, typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
bool
equal(_IIter1, _IIter1, _IIter2, _BinaryPredicate);
template<typename _FIter1, typename _FIter2>
+ _GLIBCXX20_CONSTEXPR
_FIter1
search(_FIter1, _FIter1, _FIter2, _FIter2);
template<typename _FIter1, typename _FIter2, typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
_FIter1
search(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate);
template<typename _FIter, typename _Size, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
_FIter
search_n(_FIter, _FIter, _Size, const _Tp&);
template<typename _FIter, typename _Size, typename _Tp,
typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
_FIter
search_n(_FIter, _FIter, _Size, const _Tp&, _BinaryPredicate);
// 25.2, modifying sequence operations:
// 25.2.1, copy:
template<typename _IIter, typename _OIter>
+ _GLIBCXX20_CONSTEXPR
_OIter
copy(_IIter, _IIter, _OIter);
template<typename _BIter1, typename _BIter2>
+ _GLIBCXX20_CONSTEXPR
_BIter2
copy_backward (_BIter1, _BIter1, _BIter2);
iter_swap(_FIter1, _FIter2 b);
template<typename _IIter, typename _OIter, typename _UnaryOperation>
+ _GLIBCXX20_CONSTEXPR
_OIter
transform(_IIter, _IIter, _OIter, _UnaryOperation op);
template<typename _IIter1, typename _IIter2, typename _OIter,
typename _BinaryOperation>
+ _GLIBCXX20_CONSTEXPR
_OIter
transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation);
template<typename _FIter, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
void
replace(_FIter, _FIter, const _Tp&, const _Tp&);
template<typename _FIter, typename _Predicate, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
void
replace_if(_FIter, _FIter, _Predicate, const _Tp&);
template<typename _IIter, typename _OIter, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
_OIter
replace_copy(_IIter, _IIter, _OIter, const _Tp&, const _Tp&);
template<typename _Iter, typename _OIter, typename _Predicate, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
_OIter
replace_copy_if(_Iter, _Iter, _OIter, _Predicate, const _Tp&);
template<typename _FIter, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
void
fill(_FIter, _FIter, const _Tp&);
template<typename _OIter, typename _Size, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
void
fill_n(_OIter, _Size n, const _Tp&);
template<typename _FIter, typename _Generator>
+ _GLIBCXX20_CONSTEXPR
void
generate(_FIter, _FIter, _Generator);
template<typename _OIter, typename _Size, typename _Generator>
+ _GLIBCXX20_CONSTEXPR
void
generate_n(_OIter, _Size, _Generator);
template<typename _FIter, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
_FIter
remove(_FIter, _FIter, const _Tp&);
template<typename _FIter, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
_FIter
remove_if(_FIter, _FIter, _Predicate);
template<typename _IIter, typename _OIter, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
_OIter
remove_copy(_IIter, _IIter, _OIter, const _Tp&);
template<typename _IIter, typename _OIter, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
_OIter
remove_copy_if(_IIter, _IIter, _OIter, _Predicate);
#if __cplusplus >= 201103L
template<typename _IIter, typename _OIter, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
_OIter
copy_if(_IIter, _IIter, _OIter, _Predicate);
template<typename _IIter, typename _Size, typename _OIter>
+ _GLIBCXX20_CONSTEXPR
_OIter
copy_n(_IIter, _Size, _OIter);
template<typename _IIter, typename _OIter1,
typename _OIter2, typename _Predicate>
+ _GLIBCXX20_CONSTEXPR
pair<_OIter1, _OIter2>
partition_copy(_IIter, _IIter, _OIter1, _OIter2, _Predicate);
#endif
template<typename _FIter>
+ _GLIBCXX20_CONSTEXPR
_FIter
unique(_FIter, _FIter);
template<typename _FIter, typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
_FIter
unique(_FIter, _FIter, _BinaryPredicate);
template<typename _IIter, typename _OIter>
+ _GLIBCXX20_CONSTEXPR
_OIter
unique_copy(_IIter, _IIter, _OIter);
template<typename _IIter, typename _OIter, typename _BinaryPredicate>
+ _GLIBCXX20_CONSTEXPR
_OIter
unique_copy(_IIter, _IIter, _OIter, _BinaryPredicate);
reverse(_BIter, _BIter);
template<typename _BIter, typename _OIter>
+ _GLIBCXX20_CONSTEXPR
_OIter
reverse_copy(_BIter, _BIter, _OIter);
rotate(_FIter, _FIter, _FIter);
template<typename _FIter, typename _OIter>
+ _GLIBCXX20_CONSTEXPR
_OIter
rotate_copy (_FIter, _FIter, _FIter, _OIter);
// 25.3.3, binary search:
template<typename _FIter, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
_FIter
lower_bound(_FIter, _FIter, const _Tp&);
template<typename _FIter, typename _Tp, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
_FIter
lower_bound(_FIter, _FIter, const _Tp&, _Compare);
template<typename _FIter, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
_FIter
upper_bound(_FIter, _FIter, const _Tp&);
template<typename _FIter, typename _Tp, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
_FIter
upper_bound(_FIter, _FIter, const _Tp&, _Compare);
template<typename _FIter, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
pair<_FIter, _FIter>
equal_range(_FIter, _FIter, const _Tp&);
template<typename _FIter, typename _Tp, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
pair<_FIter, _FIter>
equal_range(_FIter, _FIter, const _Tp&, _Compare);
template<typename _FIter, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
bool
binary_search(_FIter, _FIter, const _Tp&);
template<typename _FIter, typename _Tp, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
bool
binary_search(_FIter, _FIter, const _Tp&, _Compare);
// 25.3.4, merge:
template<typename _IIter1, typename _IIter2, typename _OIter>
+ _GLIBCXX20_CONSTEXPR
_OIter
merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
template<typename _IIter1, typename _IIter2, typename _OIter,
typename _Compare>
+ _GLIBCXX20_CONSTEXPR
_OIter
merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);
// 25.3.5, set operations:
template<typename _IIter1, typename _IIter2>
+ _GLIBCXX20_CONSTEXPR
bool
includes(_IIter1, _IIter1, _IIter2, _IIter2);
template<typename _IIter1, typename _IIter2, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
bool
includes(_IIter1, _IIter1, _IIter2, _IIter2, _Compare);
template<typename _IIter1, typename _IIter2, typename _OIter>
+ _GLIBCXX20_CONSTEXPR
_OIter
set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
template<typename _IIter1, typename _IIter2, typename _OIter,
typename _Compare>
+ _GLIBCXX20_CONSTEXPR
_OIter
set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);
template<typename _IIter1, typename _IIter2, typename _OIter>
+ _GLIBCXX20_CONSTEXPR
_OIter
set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
template<typename _IIter1, typename _IIter2, typename _OIter,
typename _Compare>
+ _GLIBCXX20_CONSTEXPR
_OIter
set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);
template<typename _IIter1, typename _IIter2, typename _OIter>
+ _GLIBCXX20_CONSTEXPR
_OIter
set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
template<typename _IIter1, typename _IIter2, typename _OIter,
typename _Compare>
+ _GLIBCXX20_CONSTEXPR
_OIter
set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);
template<typename _IIter1, typename _IIter2, typename _OIter>
+ _GLIBCXX20_CONSTEXPR
_OIter
set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
template<typename _IIter1, typename _IIter2, typename _OIter,
typename _Compare>
+ _GLIBCXX20_CONSTEXPR
_OIter
set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2,
_OIter, _Compare);
#if __cplusplus >= 201103L
template<typename _RAIter>
+ _GLIBCXX20_CONSTEXPR
bool
is_heap(_RAIter, _RAIter);
template<typename _RAIter, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
bool
is_heap(_RAIter, _RAIter, _Compare);
template<typename _RAIter>
+ _GLIBCXX20_CONSTEXPR
_RAIter
is_heap_until(_RAIter, _RAIter);
template<typename _RAIter, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
_RAIter
is_heap_until(_RAIter, _RAIter, _Compare);
template<typename _FIter>
+ _GLIBCXX20_CONSTEXPR
bool
is_sorted(_FIter, _FIter);
template<typename _FIter, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
bool
is_sorted(_FIter, _FIter, _Compare);
template<typename _FIter>
+ _GLIBCXX20_CONSTEXPR
_FIter
is_sorted_until(_FIter, _FIter);
template<typename _FIter, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
_FIter
is_sorted_until(_FIter, _FIter, _Compare);
#endif
#endif
template<typename _IIter1, typename _IIter2>
+ _GLIBCXX20_CONSTEXPR
bool
lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2);
template<typename _IIter1, typename _IIter2, typename _Compare>
+ _GLIBCXX20_CONSTEXPR
bool
lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2, _Compare);
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+// heap
+constexpr std::array<int, 23>
+ah{{22,
+ 21, 20,
+ 17, 16, 19, 18,
+ 11, 10, 9, 8, 15, 14, 13, 12, 3, 2, 1, 0, 7, 6, 5, 4}};
+
+constexpr auto outo = std::is_heap(ah.begin(), ah.end());
+
+constexpr auto outp = std::is_heap(ah.begin(), ah.end(), std::less<int>());
+
+constexpr bool
+test()
+{
+ return outo && outp;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+// heap
+constexpr std::array<int, 23>
+ahu{{22,
+ 21, 20,
+ 17, 16, 19, 18,//v
+ 11, 10, 9, 8, 23, 14, 13, 12, 3, 2, 1, 0, 7, 6, 5, 4}};
+
+constexpr auto outq = std::is_heap_until(ahu.begin(), ahu.end());
+
+constexpr auto outr = std::is_heap_until(ahu.begin(), ahu.end(),
+ std::less<int>());
+
+constexpr bool
+test()
+{
+ return outq == ahu.begin() + 11 && outr == ahu.begin() + 11;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ constexpr std::array<int, 12> caeo{{0, 2, 4, 6, 8, 10, 1, 3, 5, 7, 9, 11}};
+
+ const auto outs = std::is_partitioned(caeo.begin(), caeo.end(),
+ [](int i){ return i % 2 == 0; });
+
+ return true;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+ constexpr std::array<int, 12> cap{{2, 1, 3, 6, 7, 5, 4, 8, 10, 9, 0, 11}};
+
+ const auto outt = std::is_permutation(ca0.begin(), ca0.end(), cap.begin());
+
+ return true;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+
+constexpr auto outv = std::is_sorted(ca0.begin(), ca0.end());
+
+constexpr auto outw = std::is_sorted(ca0.begin(), ca0.end(),
+ std::equal_to<int>());
+
+constexpr bool
+test()
+{
+ return outv && outw;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ constexpr std::array<int, 12> aus{{0, 1, 2, 3, 4, 5, 66, 7, 8, 9, 10, 11}};
+
+ const auto outx = std::is_sorted_until(aus.begin(), aus.end());
+
+ const auto outy = std::is_sorted_until(aus.begin(), aus.end(),
+ std::less<int>());
+
+ return true;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+ constexpr std::array<int, 12> ca1{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+
+ const auto outz = !std::lexicographical_compare(ca0.begin(), ca0.end(),
+ ca1.begin(), ca1.end());
+
+ const auto outaa = !std::lexicographical_compare(ca0.begin(), ca0.end(),
+ ca1.begin(), ca1.end(),
+ std::less<int>());
+
+ return true;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+
+ const auto outbb = std::lower_bound(ca0.begin(), ca0.end(), 6);
+
+ const auto outcc = std::lower_bound(ca0.begin(), ca0.end(), 6,
+ std::less<int>());
+
+ return true;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+ constexpr std::array<int, 12> cas{{3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}};
+ constexpr std::array<int, 3> camm{{-4, -5, -6}};
+ std::array<int, 24> out0{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
+
+ const auto outdd = std::merge(ca0.begin(), ca0.end(),
+ cas.begin(), cas.end(), out0.begin());
+
+ const auto outee = std::merge(ca0.begin(), ca0.end(),
+ camm.begin(), camm.end(), out0.begin(),
+ [](int i, int j){ return i < -j; });
+
+ return true;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+ constexpr std::array<int, 12> cax{{0, 1, 2, 3, 4, 5, 66, 7, 8, 99, 10, 11}};
+
+ const auto outff = std::mismatch(ca0.begin(), ca0.end(), cax.begin());
+
+ const auto outgg = std::mismatch(ca0.begin(), ca0.end(), cax.begin(),
+ std::equal_to<int>());
+
+ return true;
+}
+
+static_assert(test());
trivial_rvalstruct a[1], b[1];
std::move(a, a + 1, b);
}
+// { dg-prune-output "use of deleted" }
trivial_rvalstruct a[1], b[1];
std::move_backward(a, a + 1, b);
}
+// { dg-prune-output "use of deleted" }
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+
+ const auto outhh = std::none_of(ca0.begin(), ca0.end(),
+ [](int i){ return i > 12; });
+
+ return true;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+ std::array<int, 24> out0{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
+ std::array<int, 24> out1{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
+
+ const auto outii = std::partition_copy(ca0.begin(), ca0.end(),
+ out0.begin(), out1.begin(),
+ [](int i){ return i % 2 == 0; });
+
+ return true;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr std::array<int, 12> caeo{{0, 2, 4, 6, 8, 10, 1, 3, 5, 7, 9, 11}};
+
+constexpr bool
+test()
+{
+ const auto outjj = std::partition_point(caeo.begin(), caeo.end(),
+ [](int i){ return i % 2 == 0; });
+
+ return outjj == caeo.begin() + 6;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ std::array<int, 12> ar4{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+
+ const auto outkk = std::remove(ar4.begin(), ar4.end(), 7);
+
+ return outkk == ar4.begin() + 11;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+ std::array<int, 24> out0{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
+
+ const auto outmm = std::remove_copy(ca0.begin(), ca0.end(), out0.begin(), 6);
+
+ return true;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+ std::array<int, 24> out0{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
+
+ const auto outnn = std::remove_copy_if(ca0.begin(), ca0.end(), out0.begin(),
+ [](int i){ return i == 7; });
+
+ return true;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ std::array<int, 12> ac2{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+
+ const auto outll = std::remove_if(ac2.begin(), ac2.end(),
+ [](int i){ return i == 7; });
+
+ return true;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+
+constexpr bool
+test()
+{
+ std::array<int, 24> out0{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
+
+ const auto outoo = std::replace_copy(ca0.begin(), ca0.end(),
+ out0.begin(), 6, 66);
+
+ return outoo == out0.begin() + (ca0.end() - ca0.begin());
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+constexpr bool
+test()
+{
+ std::array<int, 24> out0{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
+
+ const auto outpp = std::replace_copy_if(ca0.begin(), ca0.end(),
+ out0.begin(),
+ [](int i){ return i < 6; }, 66);
+
+ return outpp == out0.begin() + (ca0.end() - ca0.begin());
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ std::array<int, 12> ar0{{0, 1, 2, 3, 4, 5, 6, 6, 8, 9, 9, 11}};
+
+ std::replace_if(ar0.begin(), ar0.end(), [](int i){ return i % 2 == 1; }, 42);
+
+ return true;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+ std::array<int, 24> out0{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
+
+ const auto outqq = std::reverse_copy(ca0.rbegin(), ca0.rend(), out0.begin());
+
+ return true;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+ std::array<int, 24> out0{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
+
+ const auto outrr = std::rotate_copy(ca0.begin(), ca0.begin() + 6,
+ ca0.end(), out0.begin());
+
+ return true;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+ constexpr std::array<int, 3> cam{{4, 5, 6}};
+
+ const auto outtt = std::search(ca0.begin(), ca0.end(),
+ cam.begin(), cam.end(),
+ std::equal_to<int>());
+
+ return true;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr std::array<int, 12> car{{0, 1, 2, 3, 4, 5, 6, 6, 8, 9, 9, 11}};
+
+constexpr auto outuu = std::search_n(car.begin(), car.end(), 2, 6);
+
+constexpr auto outuv = std::search_n(car.begin(), car.end(), 2, 9,
+ [](int i, int j){ return i == j; });
+
+constexpr bool
+test()
+{
+ return outuu == car.begin() + 6 && outuv == car.begin() + 9 ;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+ constexpr std::array<int, 12> cas{{3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}};
+ std::array<int, 24> out0{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
+
+ const auto outvv = std::set_difference(ca0.begin(), ca0.end(),
+ cas.begin(), cas.end(), out0.begin());
+
+ const auto outww = std::set_difference(ca0.begin(), ca0.end(),
+ cas.begin(), cas.end(),
+ out0.begin(), std::less<int>());
+
+ return true;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+ constexpr std::array<int, 12> cas{{3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}};
+ std::array<int, 24> out0{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
+
+ const auto outxx = std::set_intersection(ca0.begin(), ca0.end(),
+ cas.begin(), cas.end(),
+ out0.begin());
+
+ const auto outyy = std::set_intersection(ca0.begin(), ca0.end(),
+ cas.begin(), cas.end(),
+ out0.begin(), std::less<int>());
+
+ return true;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+ constexpr std::array<int, 12> cas{{3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}};
+ std::array<int, 24> out0{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
+
+ const auto outvv = std::set_difference(ca0.begin(), ca0.end(),
+ cas.begin(), cas.end(), out0.begin());
+
+ const auto outww = std::set_difference(ca0.begin(), ca0.end(),
+ cas.begin(), cas.end(),
+ out0.begin(), std::less<int>());
+
+ return true;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+ constexpr std::array<int, 12> cas{{3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}};
+ std::array<int, 24> out0{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
+
+ const auto out11 = std::set_union(ca0.begin(), ca0.end(),
+ cas.begin(), cas.end(), out0.begin());
+
+ const auto out22 = std::set_union(ca0.begin(), ca0.end(),
+ cas.begin(), cas.end(),
+ out0.begin(), std::less<int>());
+
+ return true;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+constexpr bool
+test()
+{
+ std::array<int, 24> out0{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
+
+ const auto out99 = std::transform(ca0.begin(), ca0.end(), out0.begin(),
+ [del = 6](int i){ return i + del; });
+
+ const auto out11 = std::transform(ca0.begin(), ca0.end(), ca0.begin(),
+ out0.begin(),
+ [](int i, int j){ return i + j; });
+
+ return out99 == out0.begin() + (ca0.end() - ca0.begin())
+ && out11 == out0.begin() + (ca0.end() - ca0.begin());
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ std::array<int, 12> ar1{{0, 1, 2, 3, 4, 5, 6, 6, 8, 9, 9, 11}};
+ std::array<int, 12> ar2{{0, 1, 2, 3, 4, 5, 6, 6, 8, 9, 9, 11}};
+
+ const auto out33 = std::unique(ar1.begin(), ar1.end());
+
+ const auto out44 = std::unique(ar2.begin(), ar2.end(), std::equal_to<int>());
+
+ return out33 == ar1.begin() + 10 && out44 == ar2.begin() + 10;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ std::array<int, 12> ar3{{0, 1, 2, 3, 4, 5, 6, 6, 8, 9, 9, 11}};
+ std::array<int, 24> out0{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
+
+ const auto out55 = std::unique_copy(ar3.begin(), ar3.end(), out0.begin());
+
+ const auto out66 = std::unique_copy(ar3.begin(), ar3.end(), out0.begin(),
+ std::equal_to<int>());
+
+ return true;
+}
+
+static_assert(test());
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <algorithm>
+#include <array>
+
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature-test macro for constexpr algorithms missing"
+#elif __cpp_lib_constexpr_algorithms < 201711L
+# error "Feature-test macro for constexpr algorithms has wrong value"
+#endif
+
+constexpr bool
+test()
+{
+ constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+
+ const auto out77 = std::upper_bound(ca0.begin(), ca0.end(), 6);
+
+ const auto out88 = std::upper_bound(ca0.begin(), ca0.end(), 6,
+ std::less<int>());
+
+ return true;
+}
+
+static_assert(test());