Commit 3a66e68a by Edward Smith-Rowland Committed by Edward Smith-Rowland

Implement C++20 p0202 - Add Constexpr Modifiers to Functions in <algorithm> and <utility> Headers.

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.

From-SVN: r273975
parent dd1f6968
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> 2019-07-31 Jonathan Wakely <jwakely@redhat.com>
* include/std/memory (make_obj_using_allocator): Qualify call to * include/std/memory (make_obj_using_allocator): Qualify call to
......
...@@ -191,21 +191,29 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -191,21 +191,29 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// adjacent_find // adjacent_find
#if __cplusplus > 201703L
# define __cpp_lib_constexpr_algorithms 201711L
#endif
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
template<typename _IIter, typename _Predicate> template<typename _IIter, typename _Predicate>
_GLIBCXX20_CONSTEXPR
bool bool
all_of(_IIter, _IIter, _Predicate); all_of(_IIter, _IIter, _Predicate);
template<typename _IIter, typename _Predicate> template<typename _IIter, typename _Predicate>
_GLIBCXX20_CONSTEXPR
bool bool
any_of(_IIter, _IIter, _Predicate); any_of(_IIter, _IIter, _Predicate);
#endif #endif
template<typename _FIter, typename _Tp> template<typename _FIter, typename _Tp>
_GLIBCXX20_CONSTEXPR
bool bool
binary_search(_FIter, _FIter, const _Tp&); binary_search(_FIter, _FIter, const _Tp&);
template<typename _FIter, typename _Tp, typename _Compare> template<typename _FIter, typename _Tp, typename _Compare>
_GLIBCXX20_CONSTEXPR
bool bool
binary_search(_FIter, _FIter, const _Tp&, _Compare); binary_search(_FIter, _FIter, const _Tp&, _Compare);
...@@ -222,19 +230,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -222,19 +230,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif #endif
template<typename _IIter, typename _OIter> template<typename _IIter, typename _OIter>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
copy(_IIter, _IIter, _OIter); copy(_IIter, _IIter, _OIter);
template<typename _BIter1, typename _BIter2> template<typename _BIter1, typename _BIter2>
_GLIBCXX20_CONSTEXPR
_BIter2 _BIter2
copy_backward(_BIter1, _BIter1, _BIter2); copy_backward(_BIter1, _BIter1, _BIter2);
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
template<typename _IIter, typename _OIter, typename _Predicate> template<typename _IIter, typename _OIter, typename _Predicate>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
copy_if(_IIter, _IIter, _OIter, _Predicate); copy_if(_IIter, _IIter, _OIter, _Predicate);
template<typename _IIter, typename _Size, typename _OIter> template<typename _IIter, typename _Size, typename _OIter>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
copy_n(_IIter, _Size, _OIter); copy_n(_IIter, _Size, _OIter);
#endif #endif
...@@ -243,28 +255,34 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -243,28 +255,34 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// count_if // count_if
template<typename _FIter, typename _Tp> template<typename _FIter, typename _Tp>
_GLIBCXX20_CONSTEXPR
pair<_FIter, _FIter> pair<_FIter, _FIter>
equal_range(_FIter, _FIter, const _Tp&); equal_range(_FIter, _FIter, const _Tp&);
template<typename _FIter, typename _Tp, typename _Compare> template<typename _FIter, typename _Tp, typename _Compare>
_GLIBCXX20_CONSTEXPR
pair<_FIter, _FIter> pair<_FIter, _FIter>
equal_range(_FIter, _FIter, const _Tp&, _Compare); equal_range(_FIter, _FIter, const _Tp&, _Compare);
template<typename _FIter, typename _Tp> template<typename _FIter, typename _Tp>
_GLIBCXX20_CONSTEXPR
void void
fill(_FIter, _FIter, const _Tp&); fill(_FIter, _FIter, const _Tp&);
template<typename _OIter, typename _Size, typename _Tp> template<typename _OIter, typename _Size, typename _Tp>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
fill_n(_OIter, _Size, const _Tp&); fill_n(_OIter, _Size, const _Tp&);
// find // find
template<typename _FIter1, typename _FIter2> template<typename _FIter1, typename _FIter2>
_GLIBCXX20_CONSTEXPR
_FIter1 _FIter1
find_end(_FIter1, _FIter1, _FIter2, _FIter2); find_end(_FIter1, _FIter1, _FIter2, _FIter2);
template<typename _FIter1, typename _FIter2, typename _BinaryPredicate> template<typename _FIter1, typename _FIter2, typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
_FIter1 _FIter1
find_end(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate); find_end(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate);
...@@ -273,6 +291,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -273,6 +291,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
template<typename _IIter, typename _Predicate> template<typename _IIter, typename _Predicate>
_GLIBCXX20_CONSTEXPR
_IIter _IIter
find_if_not(_IIter, _IIter, _Predicate); find_if_not(_IIter, _IIter, _Predicate);
#endif #endif
...@@ -282,10 +301,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -282,10 +301,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// generate_n // generate_n
template<typename _IIter1, typename _IIter2> template<typename _IIter1, typename _IIter2>
_GLIBCXX20_CONSTEXPR
bool bool
includes(_IIter1, _IIter1, _IIter2, _IIter2); includes(_IIter1, _IIter1, _IIter2, _IIter2);
template<typename _IIter1, typename _IIter2, typename _Compare> template<typename _IIter1, typename _IIter2, typename _Compare>
_GLIBCXX20_CONSTEXPR
bool bool
includes(_IIter1, _IIter1, _IIter2, _IIter2, _Compare); includes(_IIter1, _IIter1, _IIter2, _IIter2, _Compare);
...@@ -299,47 +320,58 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -299,47 +320,58 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
template<typename _RAIter> template<typename _RAIter>
_GLIBCXX20_CONSTEXPR
bool bool
is_heap(_RAIter, _RAIter); is_heap(_RAIter, _RAIter);
template<typename _RAIter, typename _Compare> template<typename _RAIter, typename _Compare>
_GLIBCXX20_CONSTEXPR
bool bool
is_heap(_RAIter, _RAIter, _Compare); is_heap(_RAIter, _RAIter, _Compare);
template<typename _RAIter> template<typename _RAIter>
_GLIBCXX20_CONSTEXPR
_RAIter _RAIter
is_heap_until(_RAIter, _RAIter); is_heap_until(_RAIter, _RAIter);
template<typename _RAIter, typename _Compare> template<typename _RAIter, typename _Compare>
_GLIBCXX20_CONSTEXPR
_RAIter _RAIter
is_heap_until(_RAIter, _RAIter, _Compare); is_heap_until(_RAIter, _RAIter, _Compare);
template<typename _IIter, typename _Predicate> template<typename _IIter, typename _Predicate>
_GLIBCXX20_CONSTEXPR
bool bool
is_partitioned(_IIter, _IIter, _Predicate); is_partitioned(_IIter, _IIter, _Predicate);
template<typename _FIter1, typename _FIter2> template<typename _FIter1, typename _FIter2>
_GLIBCXX20_CONSTEXPR
bool bool
is_permutation(_FIter1, _FIter1, _FIter2); is_permutation(_FIter1, _FIter1, _FIter2);
template<typename _FIter1, typename _FIter2, template<typename _FIter1, typename _FIter2,
typename _BinaryPredicate> typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
bool bool
is_permutation(_FIter1, _FIter1, _FIter2, _BinaryPredicate); is_permutation(_FIter1, _FIter1, _FIter2, _BinaryPredicate);
template<typename _FIter> template<typename _FIter>
_GLIBCXX20_CONSTEXPR
bool bool
is_sorted(_FIter, _FIter); is_sorted(_FIter, _FIter);
template<typename _FIter, typename _Compare> template<typename _FIter, typename _Compare>
_GLIBCXX20_CONSTEXPR
bool bool
is_sorted(_FIter, _FIter, _Compare); is_sorted(_FIter, _FIter, _Compare);
template<typename _FIter> template<typename _FIter>
_GLIBCXX20_CONSTEXPR
_FIter _FIter
is_sorted_until(_FIter, _FIter); is_sorted_until(_FIter, _FIter);
template<typename _FIter, typename _Compare> template<typename _FIter, typename _Compare>
_GLIBCXX20_CONSTEXPR
_FIter _FIter
is_sorted_until(_FIter, _FIter, _Compare); is_sorted_until(_FIter, _FIter, _Compare);
#endif #endif
...@@ -349,10 +381,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -349,10 +381,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
iter_swap(_FIter1, _FIter2); iter_swap(_FIter1, _FIter2);
template<typename _FIter, typename _Tp> template<typename _FIter, typename _Tp>
_GLIBCXX20_CONSTEXPR
_FIter _FIter
lower_bound(_FIter, _FIter, const _Tp&); lower_bound(_FIter, _FIter, const _Tp&);
template<typename _FIter, typename _Tp, typename _Compare> template<typename _FIter, typename _Tp, typename _Compare>
_GLIBCXX20_CONSTEXPR
_FIter _FIter
lower_bound(_FIter, _FIter, const _Tp&, _Compare); lower_bound(_FIter, _FIter, const _Tp&, _Compare);
...@@ -453,6 +487,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -453,6 +487,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
template<typename _IIter, typename _Predicate> template<typename _IIter, typename _Predicate>
_GLIBCXX20_CONSTEXPR
bool bool
none_of(_IIter, _IIter, _Predicate); none_of(_IIter, _IIter, _Predicate);
#endif #endif
...@@ -473,10 +508,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -473,10 +508,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
template<typename _IIter, typename _OIter1, template<typename _IIter, typename _OIter1,
typename _OIter2, typename _Predicate> typename _OIter2, typename _Predicate>
_GLIBCXX20_CONSTEXPR
pair<_OIter1, _OIter2> pair<_OIter1, _OIter2>
partition_copy(_IIter, _IIter, _OIter1, _OIter2, _Predicate); partition_copy(_IIter, _IIter, _OIter1, _OIter2, _Predicate);
template<typename _FIter, typename _Predicate> template<typename _FIter, typename _Predicate>
_GLIBCXX20_CONSTEXPR
_FIter _FIter
partition_point(_FIter, _FIter, _Predicate); partition_point(_FIter, _FIter, _Predicate);
#endif #endif
...@@ -508,28 +545,34 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -508,28 +545,34 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// random_shuffle // random_shuffle
template<typename _FIter, typename _Tp> template<typename _FIter, typename _Tp>
_GLIBCXX20_CONSTEXPR
_FIter _FIter
remove(_FIter, _FIter, const _Tp&); remove(_FIter, _FIter, const _Tp&);
template<typename _FIter, typename _Predicate> template<typename _FIter, typename _Predicate>
_GLIBCXX20_CONSTEXPR
_FIter _FIter
remove_if(_FIter, _FIter, _Predicate); remove_if(_FIter, _FIter, _Predicate);
template<typename _IIter, typename _OIter, typename _Tp> template<typename _IIter, typename _OIter, typename _Tp>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
remove_copy(_IIter, _IIter, _OIter, const _Tp&); remove_copy(_IIter, _IIter, _OIter, const _Tp&);
template<typename _IIter, typename _OIter, typename _Predicate> template<typename _IIter, typename _OIter, typename _Predicate>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
remove_copy_if(_IIter, _IIter, _OIter, _Predicate); remove_copy_if(_IIter, _IIter, _OIter, _Predicate);
// replace // replace
template<typename _IIter, typename _OIter, typename _Tp> template<typename _IIter, typename _OIter, typename _Tp>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
replace_copy(_IIter, _IIter, _OIter, const _Tp&, const _Tp&); replace_copy(_IIter, _IIter, _OIter, const _Tp&, const _Tp&);
template<typename _Iter, typename _OIter, typename _Predicate, typename _Tp> template<typename _Iter, typename _OIter, typename _Predicate, typename _Tp>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
replace_copy_if(_Iter, _Iter, _OIter, _Predicate, const _Tp&); replace_copy_if(_Iter, _Iter, _OIter, _Predicate, const _Tp&);
...@@ -540,6 +583,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -540,6 +583,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
reverse(_BIter, _BIter); reverse(_BIter, _BIter);
template<typename _BIter, typename _OIter> template<typename _BIter, typename _OIter>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
reverse_copy(_BIter, _BIter, _OIter); reverse_copy(_BIter, _BIter, _OIter);
...@@ -551,6 +595,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -551,6 +595,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
template<typename _FIter, typename _OIter> template<typename _FIter, typename _OIter>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
rotate_copy(_FIter, _FIter, _FIter, _OIter); rotate_copy(_FIter, _FIter, _FIter, _OIter);
...@@ -598,82 +643,101 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -598,82 +643,101 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// transform // transform
template<typename _FIter> template<typename _FIter>
_GLIBCXX20_CONSTEXPR
_FIter _FIter
unique(_FIter, _FIter); unique(_FIter, _FIter);
template<typename _FIter, typename _BinaryPredicate> template<typename _FIter, typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
_FIter _FIter
unique(_FIter, _FIter, _BinaryPredicate); unique(_FIter, _FIter, _BinaryPredicate);
// unique_copy // unique_copy
template<typename _FIter, typename _Tp> template<typename _FIter, typename _Tp>
_GLIBCXX20_CONSTEXPR
_FIter _FIter
upper_bound(_FIter, _FIter, const _Tp&); upper_bound(_FIter, _FIter, const _Tp&);
template<typename _FIter, typename _Tp, typename _Compare> template<typename _FIter, typename _Tp, typename _Compare>
_GLIBCXX20_CONSTEXPR
_FIter _FIter
upper_bound(_FIter, _FIter, const _Tp&, _Compare); upper_bound(_FIter, _FIter, const _Tp&, _Compare);
_GLIBCXX_BEGIN_NAMESPACE_ALGO _GLIBCXX_BEGIN_NAMESPACE_ALGO
template<typename _FIter> template<typename _FIter>
_GLIBCXX20_CONSTEXPR
_FIter _FIter
adjacent_find(_FIter, _FIter); adjacent_find(_FIter, _FIter);
template<typename _FIter, typename _BinaryPredicate> template<typename _FIter, typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
_FIter _FIter
adjacent_find(_FIter, _FIter, _BinaryPredicate); adjacent_find(_FIter, _FIter, _BinaryPredicate);
template<typename _IIter, typename _Tp> template<typename _IIter, typename _Tp>
_GLIBCXX20_CONSTEXPR
typename iterator_traits<_IIter>::difference_type typename iterator_traits<_IIter>::difference_type
count(_IIter, _IIter, const _Tp&); count(_IIter, _IIter, const _Tp&);
template<typename _IIter, typename _Predicate> template<typename _IIter, typename _Predicate>
_GLIBCXX20_CONSTEXPR
typename iterator_traits<_IIter>::difference_type typename iterator_traits<_IIter>::difference_type
count_if(_IIter, _IIter, _Predicate); count_if(_IIter, _IIter, _Predicate);
template<typename _IIter1, typename _IIter2> template<typename _IIter1, typename _IIter2>
_GLIBCXX20_CONSTEXPR
bool bool
equal(_IIter1, _IIter1, _IIter2); equal(_IIter1, _IIter1, _IIter2);
template<typename _IIter1, typename _IIter2, typename _BinaryPredicate> template<typename _IIter1, typename _IIter2, typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
bool bool
equal(_IIter1, _IIter1, _IIter2, _BinaryPredicate); equal(_IIter1, _IIter1, _IIter2, _BinaryPredicate);
template<typename _IIter, typename _Tp> template<typename _IIter, typename _Tp>
_GLIBCXX20_CONSTEXPR
_IIter _IIter
find(_IIter, _IIter, const _Tp&); find(_IIter, _IIter, const _Tp&);
template<typename _FIter1, typename _FIter2> template<typename _FIter1, typename _FIter2>
_GLIBCXX20_CONSTEXPR
_FIter1 _FIter1
find_first_of(_FIter1, _FIter1, _FIter2, _FIter2); find_first_of(_FIter1, _FIter1, _FIter2, _FIter2);
template<typename _FIter1, typename _FIter2, typename _BinaryPredicate> template<typename _FIter1, typename _FIter2, typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
_FIter1 _FIter1
find_first_of(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate); find_first_of(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate);
template<typename _IIter, typename _Predicate> template<typename _IIter, typename _Predicate>
_GLIBCXX20_CONSTEXPR
_IIter _IIter
find_if(_IIter, _IIter, _Predicate); find_if(_IIter, _IIter, _Predicate);
template<typename _IIter, typename _Funct> template<typename _IIter, typename _Funct>
_GLIBCXX20_CONSTEXPR
_Funct _Funct
for_each(_IIter, _IIter, _Funct); for_each(_IIter, _IIter, _Funct);
template<typename _FIter, typename _Generator> template<typename _FIter, typename _Generator>
_GLIBCXX20_CONSTEXPR
void void
generate(_FIter, _FIter, _Generator); generate(_FIter, _FIter, _Generator);
template<typename _OIter, typename _Size, typename _Generator> template<typename _OIter, typename _Size, typename _Generator>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
generate_n(_OIter, _Size, _Generator); generate_n(_OIter, _Size, _Generator);
template<typename _IIter1, typename _IIter2> template<typename _IIter1, typename _IIter2>
_GLIBCXX20_CONSTEXPR
bool bool
lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2); lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2);
template<typename _IIter1, typename _IIter2, typename _Compare> template<typename _IIter1, typename _IIter2, typename _Compare>
_GLIBCXX20_CONSTEXPR
bool bool
lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2, _Compare); lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2, _Compare);
...@@ -688,11 +752,13 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -688,11 +752,13 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
max_element(_FIter, _FIter, _Compare); max_element(_FIter, _FIter, _Compare);
template<typename _IIter1, typename _IIter2, typename _OIter> template<typename _IIter1, typename _IIter2, typename _OIter>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
template<typename _IIter1, typename _IIter2, typename _OIter, template<typename _IIter1, typename _IIter2, typename _OIter,
typename _Compare> typename _Compare>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);
...@@ -707,10 +773,12 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -707,10 +773,12 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
min_element(_FIter, _FIter, _Compare); min_element(_FIter, _FIter, _Compare);
template<typename _IIter1, typename _IIter2> template<typename _IIter1, typename _IIter2>
_GLIBCXX20_CONSTEXPR
pair<_IIter1, _IIter2> pair<_IIter1, _IIter2>
mismatch(_IIter1, _IIter1, _IIter2); mismatch(_IIter1, _IIter1, _IIter2);
template<typename _IIter1, typename _IIter2, typename _BinaryPredicate> template<typename _IIter1, typename _IIter2, typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
pair<_IIter1, _IIter2> pair<_IIter1, _IIter2>
mismatch(_IIter1, _IIter1, _IIter2, _BinaryPredicate); mismatch(_IIter1, _IIter1, _IIter2, _BinaryPredicate);
...@@ -748,64 +816,78 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -748,64 +816,78 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
#endif #endif
template<typename _FIter, typename _Tp> template<typename _FIter, typename _Tp>
_GLIBCXX20_CONSTEXPR
void void
replace(_FIter, _FIter, const _Tp&, const _Tp&); replace(_FIter, _FIter, const _Tp&, const _Tp&);
template<typename _FIter, typename _Predicate, typename _Tp> template<typename _FIter, typename _Predicate, typename _Tp>
_GLIBCXX20_CONSTEXPR
void void
replace_if(_FIter, _FIter, _Predicate, const _Tp&); replace_if(_FIter, _FIter, _Predicate, const _Tp&);
template<typename _FIter1, typename _FIter2> template<typename _FIter1, typename _FIter2>
_GLIBCXX20_CONSTEXPR
_FIter1 _FIter1
search(_FIter1, _FIter1, _FIter2, _FIter2); search(_FIter1, _FIter1, _FIter2, _FIter2);
template<typename _FIter1, typename _FIter2, typename _BinaryPredicate> template<typename _FIter1, typename _FIter2, typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
_FIter1 _FIter1
search(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate); search(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate);
template<typename _FIter, typename _Size, typename _Tp> template<typename _FIter, typename _Size, typename _Tp>
_GLIBCXX20_CONSTEXPR
_FIter _FIter
search_n(_FIter, _FIter, _Size, const _Tp&); search_n(_FIter, _FIter, _Size, const _Tp&);
template<typename _FIter, typename _Size, typename _Tp, template<typename _FIter, typename _Size, typename _Tp,
typename _BinaryPredicate> typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
_FIter _FIter
search_n(_FIter, _FIter, _Size, const _Tp&, _BinaryPredicate); search_n(_FIter, _FIter, _Size, const _Tp&, _BinaryPredicate);
template<typename _IIter1, typename _IIter2, typename _OIter> template<typename _IIter1, typename _IIter2, typename _OIter>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
template<typename _IIter1, typename _IIter2, typename _OIter, template<typename _IIter1, typename _IIter2, typename _OIter,
typename _Compare> typename _Compare>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);
template<typename _IIter1, typename _IIter2, typename _OIter> template<typename _IIter1, typename _IIter2, typename _OIter>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
template<typename _IIter1, typename _IIter2, typename _OIter, template<typename _IIter1, typename _IIter2, typename _OIter,
typename _Compare> typename _Compare>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);
template<typename _IIter1, typename _IIter2, typename _OIter> template<typename _IIter1, typename _IIter2, typename _OIter>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
template<typename _IIter1, typename _IIter2, typename _OIter, template<typename _IIter1, typename _IIter2, typename _OIter,
typename _Compare> typename _Compare>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2,
_OIter, _Compare); _OIter, _Compare);
template<typename _IIter1, typename _IIter2, typename _OIter> template<typename _IIter1, typename _IIter2, typename _OIter>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
template<typename _IIter1, typename _IIter2, typename _OIter, template<typename _IIter1, typename _IIter2, typename _OIter,
typename _Compare> typename _Compare>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);
...@@ -826,19 +908,23 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -826,19 +908,23 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
stable_sort(_RAIter, _RAIter, _Compare); stable_sort(_RAIter, _RAIter, _Compare);
template<typename _IIter, typename _OIter, typename _UnaryOperation> template<typename _IIter, typename _OIter, typename _UnaryOperation>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
transform(_IIter, _IIter, _OIter, _UnaryOperation); transform(_IIter, _IIter, _OIter, _UnaryOperation);
template<typename _IIter1, typename _IIter2, typename _OIter, template<typename _IIter1, typename _IIter2, typename _OIter,
typename _BinaryOperation> typename _BinaryOperation>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation); transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation);
template<typename _IIter, typename _OIter> template<typename _IIter, typename _OIter>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
unique_copy(_IIter, _IIter, _OIter); unique_copy(_IIter, _IIter, _OIter);
template<typename _IIter, typename _OIter, typename _BinaryPredicate> template<typename _IIter, typename _OIter, typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
unique_copy(_IIter, _IIter, _OIter, _BinaryPredicate); unique_copy(_IIter, _IIter, _OIter, _BinaryPredicate);
......
...@@ -424,6 +424,7 @@ __INT_N(__GLIBCXX_TYPE_INT_N_3) ...@@ -424,6 +424,7 @@ __INT_N(__GLIBCXX_TYPE_INT_N_3)
// Fallback implementation of the function in bits/stl_iterator.h used to // Fallback implementation of the function in bits/stl_iterator.h used to
// remove the move_iterator wrapper. // remove the move_iterator wrapper.
template<typename _Iterator> template<typename _Iterator>
_GLIBCXX20_CONSTEXPR
inline _Iterator inline _Iterator
__miter_base(_Iterator __it) __miter_base(_Iterator __it)
{ return __it; } { return __it; }
......
...@@ -145,6 +145,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -145,6 +145,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// C++11 version of std::exchange for internal use. // C++11 version of std::exchange for internal use.
template <typename _Tp, typename _Up = _Tp> template <typename _Tp, typename _Up = _Tp>
_GLIBCXX20_CONSTEXPR
inline _Tp inline _Tp
__exchange(_Tp& __obj, _Up&& __new_val) __exchange(_Tp& __obj, _Up&& __new_val)
{ {
......
...@@ -56,19 +56,23 @@ namespace __ops ...@@ -56,19 +56,23 @@ namespace __ops
_Iter_less_val() { } _Iter_less_val() { }
#endif #endif
_GLIBCXX20_CONSTEXPR
explicit explicit
_Iter_less_val(_Iter_less_iter) { } _Iter_less_val(_Iter_less_iter) { }
template<typename _Iterator, typename _Value> template<typename _Iterator, typename _Value>
_GLIBCXX20_CONSTEXPR
bool bool
operator()(_Iterator __it, _Value& __val) const operator()(_Iterator __it, _Value& __val) const
{ return *__it < __val; } { return *__it < __val; }
}; };
_GLIBCXX20_CONSTEXPR
inline _Iter_less_val inline _Iter_less_val
__iter_less_val() __iter_less_val()
{ return _Iter_less_val(); } { return _Iter_less_val(); }
_GLIBCXX20_CONSTEXPR
inline _Iter_less_val inline _Iter_less_val
__iter_comp_val(_Iter_less_iter) __iter_comp_val(_Iter_less_iter)
{ return _Iter_less_val(); } { return _Iter_less_val(); }
...@@ -81,19 +85,23 @@ namespace __ops ...@@ -81,19 +85,23 @@ namespace __ops
_Val_less_iter() { } _Val_less_iter() { }
#endif #endif
_GLIBCXX20_CONSTEXPR
explicit explicit
_Val_less_iter(_Iter_less_iter) { } _Val_less_iter(_Iter_less_iter) { }
template<typename _Value, typename _Iterator> template<typename _Value, typename _Iterator>
_GLIBCXX20_CONSTEXPR
bool bool
operator()(_Value& __val, _Iterator __it) const operator()(_Value& __val, _Iterator __it) const
{ return __val < *__it; } { return __val < *__it; }
}; };
_GLIBCXX20_CONSTEXPR
inline _Val_less_iter inline _Val_less_iter
__val_less_iter() __val_less_iter()
{ return _Val_less_iter(); } { return _Val_less_iter(); }
_GLIBCXX20_CONSTEXPR
inline _Val_less_iter inline _Val_less_iter
__val_comp_iter(_Iter_less_iter) __val_comp_iter(_Iter_less_iter)
{ return _Val_less_iter(); } { return _Val_less_iter(); }
...@@ -101,11 +109,13 @@ namespace __ops ...@@ -101,11 +109,13 @@ namespace __ops
struct _Iter_equal_to_iter struct _Iter_equal_to_iter
{ {
template<typename _Iterator1, typename _Iterator2> template<typename _Iterator1, typename _Iterator2>
_GLIBCXX20_CONSTEXPR
bool bool
operator()(_Iterator1 __it1, _Iterator2 __it2) const operator()(_Iterator1 __it1, _Iterator2 __it2) const
{ return *__it1 == *__it2; } { return *__it1 == *__it2; }
}; };
_GLIBCXX20_CONSTEXPR
inline _Iter_equal_to_iter inline _Iter_equal_to_iter
__iter_equal_to_iter() __iter_equal_to_iter()
{ return _Iter_equal_to_iter(); } { return _Iter_equal_to_iter(); }
...@@ -113,15 +123,18 @@ namespace __ops ...@@ -113,15 +123,18 @@ namespace __ops
struct _Iter_equal_to_val struct _Iter_equal_to_val
{ {
template<typename _Iterator, typename _Value> template<typename _Iterator, typename _Value>
_GLIBCXX20_CONSTEXPR
bool bool
operator()(_Iterator __it, _Value& __val) const operator()(_Iterator __it, _Value& __val) const
{ return *__it == __val; } { return *__it == __val; }
}; };
_GLIBCXX20_CONSTEXPR
inline _Iter_equal_to_val inline _Iter_equal_to_val
__iter_equal_to_val() __iter_equal_to_val()
{ return _Iter_equal_to_val(); } { return _Iter_equal_to_val(); }
_GLIBCXX20_CONSTEXPR
inline _Iter_equal_to_val inline _Iter_equal_to_val
__iter_comp_val(_Iter_equal_to_iter) __iter_comp_val(_Iter_equal_to_iter)
{ return _Iter_equal_to_val(); } { return _Iter_equal_to_val(); }
...@@ -154,17 +167,20 @@ namespace __ops ...@@ -154,17 +167,20 @@ namespace __ops
{ {
_Compare _M_comp; _Compare _M_comp;
_GLIBCXX20_CONSTEXPR
explicit explicit
_Iter_comp_val(_Compare __comp) _Iter_comp_val(_Compare __comp)
: _M_comp(_GLIBCXX_MOVE(__comp)) : _M_comp(_GLIBCXX_MOVE(__comp))
{ } { }
_GLIBCXX20_CONSTEXPR
explicit explicit
_Iter_comp_val(const _Iter_comp_iter<_Compare>& __comp) _Iter_comp_val(const _Iter_comp_iter<_Compare>& __comp)
: _M_comp(__comp._M_comp) : _M_comp(__comp._M_comp)
{ } { }
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
_GLIBCXX20_CONSTEXPR
explicit explicit
_Iter_comp_val(_Iter_comp_iter<_Compare>&& __comp) _Iter_comp_val(_Iter_comp_iter<_Compare>&& __comp)
: _M_comp(std::move(__comp._M_comp)) : _M_comp(std::move(__comp._M_comp))
...@@ -172,17 +188,20 @@ namespace __ops ...@@ -172,17 +188,20 @@ namespace __ops
#endif #endif
template<typename _Iterator, typename _Value> template<typename _Iterator, typename _Value>
_GLIBCXX20_CONSTEXPR
bool bool
operator()(_Iterator __it, _Value& __val) operator()(_Iterator __it, _Value& __val)
{ return bool(_M_comp(*__it, __val)); } { return bool(_M_comp(*__it, __val)); }
}; };
template<typename _Compare> template<typename _Compare>
inline _Iter_comp_val<_Compare> _GLIBCXX20_CONSTEXPR
inline _Iter_comp_val<_Compare>
__iter_comp_val(_Compare __comp) __iter_comp_val(_Compare __comp)
{ return _Iter_comp_val<_Compare>(_GLIBCXX_MOVE(__comp)); } { return _Iter_comp_val<_Compare>(_GLIBCXX_MOVE(__comp)); }
template<typename _Compare> template<typename _Compare>
_GLIBCXX20_CONSTEXPR
inline _Iter_comp_val<_Compare> inline _Iter_comp_val<_Compare>
__iter_comp_val(_Iter_comp_iter<_Compare> __comp) __iter_comp_val(_Iter_comp_iter<_Compare> __comp)
{ return _Iter_comp_val<_Compare>(_GLIBCXX_MOVE(__comp)); } { return _Iter_comp_val<_Compare>(_GLIBCXX_MOVE(__comp)); }
...@@ -192,17 +211,20 @@ namespace __ops ...@@ -192,17 +211,20 @@ namespace __ops
{ {
_Compare _M_comp; _Compare _M_comp;
_GLIBCXX20_CONSTEXPR
explicit explicit
_Val_comp_iter(_Compare __comp) _Val_comp_iter(_Compare __comp)
: _M_comp(_GLIBCXX_MOVE(__comp)) : _M_comp(_GLIBCXX_MOVE(__comp))
{ } { }
_GLIBCXX20_CONSTEXPR
explicit explicit
_Val_comp_iter(const _Iter_comp_iter<_Compare>& __comp) _Val_comp_iter(const _Iter_comp_iter<_Compare>& __comp)
: _M_comp(__comp._M_comp) : _M_comp(__comp._M_comp)
{ } { }
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
_GLIBCXX20_CONSTEXPR
explicit explicit
_Val_comp_iter(_Iter_comp_iter<_Compare>&& __comp) _Val_comp_iter(_Iter_comp_iter<_Compare>&& __comp)
: _M_comp(std::move(__comp._M_comp)) : _M_comp(std::move(__comp._M_comp))
...@@ -210,17 +232,20 @@ namespace __ops ...@@ -210,17 +232,20 @@ namespace __ops
#endif #endif
template<typename _Value, typename _Iterator> template<typename _Value, typename _Iterator>
_GLIBCXX20_CONSTEXPR
bool bool
operator()(_Value& __val, _Iterator __it) operator()(_Value& __val, _Iterator __it)
{ return bool(_M_comp(__val, *__it)); } { return bool(_M_comp(__val, *__it)); }
}; };
template<typename _Compare> template<typename _Compare>
_GLIBCXX20_CONSTEXPR
inline _Val_comp_iter<_Compare> inline _Val_comp_iter<_Compare>
__val_comp_iter(_Compare __comp) __val_comp_iter(_Compare __comp)
{ return _Val_comp_iter<_Compare>(_GLIBCXX_MOVE(__comp)); } { return _Val_comp_iter<_Compare>(_GLIBCXX_MOVE(__comp)); }
template<typename _Compare> template<typename _Compare>
_GLIBCXX20_CONSTEXPR
inline _Val_comp_iter<_Compare> inline _Val_comp_iter<_Compare>
__val_comp_iter(_Iter_comp_iter<_Compare> __comp) __val_comp_iter(_Iter_comp_iter<_Compare> __comp)
{ return _Val_comp_iter<_Compare>(_GLIBCXX_MOVE(__comp)); } { return _Val_comp_iter<_Compare>(_GLIBCXX_MOVE(__comp)); }
...@@ -230,18 +255,21 @@ namespace __ops ...@@ -230,18 +255,21 @@ namespace __ops
{ {
_Value& _M_value; _Value& _M_value;
_GLIBCXX20_CONSTEXPR
explicit explicit
_Iter_equals_val(_Value& __value) _Iter_equals_val(_Value& __value)
: _M_value(__value) : _M_value(__value)
{ } { }
template<typename _Iterator> template<typename _Iterator>
_GLIBCXX20_CONSTEXPR
bool bool
operator()(_Iterator __it) operator()(_Iterator __it)
{ return *__it == _M_value; } { return *__it == _M_value; }
}; };
template<typename _Value> template<typename _Value>
_GLIBCXX20_CONSTEXPR
inline _Iter_equals_val<_Value> inline _Iter_equals_val<_Value>
__iter_equals_val(_Value& __val) __iter_equals_val(_Value& __val)
{ return _Iter_equals_val<_Value>(__val); } { return _Iter_equals_val<_Value>(__val); }
...@@ -251,18 +279,21 @@ namespace __ops ...@@ -251,18 +279,21 @@ namespace __ops
{ {
_Iterator1 _M_it1; _Iterator1 _M_it1;
_GLIBCXX20_CONSTEXPR
explicit explicit
_Iter_equals_iter(_Iterator1 __it1) _Iter_equals_iter(_Iterator1 __it1)
: _M_it1(__it1) : _M_it1(__it1)
{ } { }
template<typename _Iterator2> template<typename _Iterator2>
_GLIBCXX20_CONSTEXPR
bool bool
operator()(_Iterator2 __it2) operator()(_Iterator2 __it2)
{ return *__it2 == *_M_it1; } { return *__it2 == *_M_it1; }
}; };
template<typename _Iterator> template<typename _Iterator>
_GLIBCXX20_CONSTEXPR
inline _Iter_equals_iter<_Iterator> inline _Iter_equals_iter<_Iterator>
__iter_comp_iter(_Iter_equal_to_iter, _Iterator __it) __iter_comp_iter(_Iter_equal_to_iter, _Iterator __it)
{ return _Iter_equals_iter<_Iterator>(__it); } { return _Iter_equals_iter<_Iterator>(__it); }
...@@ -272,18 +303,21 @@ namespace __ops ...@@ -272,18 +303,21 @@ namespace __ops
{ {
_Predicate _M_pred; _Predicate _M_pred;
_GLIBCXX20_CONSTEXPR
explicit explicit
_Iter_pred(_Predicate __pred) _Iter_pred(_Predicate __pred)
: _M_pred(_GLIBCXX_MOVE(__pred)) : _M_pred(_GLIBCXX_MOVE(__pred))
{ } { }
template<typename _Iterator> template<typename _Iterator>
_GLIBCXX20_CONSTEXPR
bool bool
operator()(_Iterator __it) operator()(_Iterator __it)
{ return bool(_M_pred(*__it)); } { return bool(_M_pred(*__it)); }
}; };
template<typename _Predicate> template<typename _Predicate>
_GLIBCXX20_CONSTEXPR
inline _Iter_pred<_Predicate> inline _Iter_pred<_Predicate>
__pred_iter(_Predicate __pred) __pred_iter(_Predicate __pred)
{ return _Iter_pred<_Predicate>(_GLIBCXX_MOVE(__pred)); } { return _Iter_pred<_Predicate>(_GLIBCXX_MOVE(__pred)); }
...@@ -294,11 +328,13 @@ namespace __ops ...@@ -294,11 +328,13 @@ namespace __ops
_Compare _M_comp; _Compare _M_comp;
_Value& _M_value; _Value& _M_value;
_GLIBCXX20_CONSTEXPR
_Iter_comp_to_val(_Compare __comp, _Value& __value) _Iter_comp_to_val(_Compare __comp, _Value& __value)
: _M_comp(_GLIBCXX_MOVE(__comp)), _M_value(__value) : _M_comp(_GLIBCXX_MOVE(__comp)), _M_value(__value)
{ } { }
template<typename _Iterator> template<typename _Iterator>
_GLIBCXX20_CONSTEXPR
bool bool
operator()(_Iterator __it) operator()(_Iterator __it)
{ return bool(_M_comp(*__it, _M_value)); } { return bool(_M_comp(*__it, _M_value)); }
...@@ -306,6 +342,7 @@ namespace __ops ...@@ -306,6 +342,7 @@ namespace __ops
template<typename _Compare, typename _Value> template<typename _Compare, typename _Value>
_Iter_comp_to_val<_Compare, _Value> _Iter_comp_to_val<_Compare, _Value>
_GLIBCXX20_CONSTEXPR
__iter_comp_val(_Compare __comp, _Value &__val) __iter_comp_val(_Compare __comp, _Value &__val)
{ {
return _Iter_comp_to_val<_Compare, _Value>(_GLIBCXX_MOVE(__comp), __val); return _Iter_comp_to_val<_Compare, _Value>(_GLIBCXX_MOVE(__comp), __val);
...@@ -317,17 +354,20 @@ namespace __ops ...@@ -317,17 +354,20 @@ namespace __ops
_Compare _M_comp; _Compare _M_comp;
_Iterator1 _M_it1; _Iterator1 _M_it1;
_GLIBCXX20_CONSTEXPR
_Iter_comp_to_iter(_Compare __comp, _Iterator1 __it1) _Iter_comp_to_iter(_Compare __comp, _Iterator1 __it1)
: _M_comp(_GLIBCXX_MOVE(__comp)), _M_it1(__it1) : _M_comp(_GLIBCXX_MOVE(__comp)), _M_it1(__it1)
{ } { }
template<typename _Iterator2> template<typename _Iterator2>
_GLIBCXX20_CONSTEXPR
bool bool
operator()(_Iterator2 __it2) operator()(_Iterator2 __it2)
{ return bool(_M_comp(*__it2, *_M_it1)); } { return bool(_M_comp(*__it2, *_M_it1)); }
}; };
template<typename _Compare, typename _Iterator> template<typename _Compare, typename _Iterator>
_GLIBCXX20_CONSTEXPR
inline _Iter_comp_to_iter<_Compare, _Iterator> inline _Iter_comp_to_iter<_Compare, _Iterator>
__iter_comp_iter(_Iter_comp_iter<_Compare> __comp, _Iterator __it) __iter_comp_iter(_Iter_comp_iter<_Compare> __comp, _Iterator __it)
{ {
...@@ -340,18 +380,21 @@ namespace __ops ...@@ -340,18 +380,21 @@ namespace __ops
{ {
_Predicate _M_pred; _Predicate _M_pred;
_GLIBCXX20_CONSTEXPR
explicit explicit
_Iter_negate(_Predicate __pred) _Iter_negate(_Predicate __pred)
: _M_pred(_GLIBCXX_MOVE(__pred)) : _M_pred(_GLIBCXX_MOVE(__pred))
{ } { }
template<typename _Iterator> template<typename _Iterator>
_GLIBCXX20_CONSTEXPR
bool bool
operator()(_Iterator __it) operator()(_Iterator __it)
{ return !bool(_M_pred(*__it)); } { return !bool(_M_pred(*__it)); }
}; };
template<typename _Predicate> template<typename _Predicate>
_GLIBCXX20_CONSTEXPR
inline _Iter_negate<_Predicate> inline _Iter_negate<_Predicate>
__negate(_Iter_pred<_Predicate> __pred) __negate(_Iter_pred<_Predicate> __pred)
{ return _Iter_negate<_Predicate>(_GLIBCXX_MOVE(__pred._M_pred)); } { return _Iter_negate<_Predicate>(_GLIBCXX_MOVE(__pred._M_pred)); }
......
...@@ -97,6 +97,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -97,6 +97,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// This is an overload used by find algos for the Input Iterator case. /// This is an overload used by find algos for the Input Iterator case.
template<typename _InputIterator, typename _Predicate> template<typename _InputIterator, typename _Predicate>
_GLIBCXX20_CONSTEXPR
inline _InputIterator inline _InputIterator
__find_if(_InputIterator __first, _InputIterator __last, __find_if(_InputIterator __first, _InputIterator __last,
_Predicate __pred, input_iterator_tag) _Predicate __pred, input_iterator_tag)
...@@ -108,6 +109,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -108,6 +109,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// This is an overload used by find algos for the RAI case. /// This is an overload used by find algos for the RAI case.
template<typename _RandomAccessIterator, typename _Predicate> template<typename _RandomAccessIterator, typename _Predicate>
_GLIBCXX20_CONSTEXPR
_RandomAccessIterator _RandomAccessIterator
__find_if(_RandomAccessIterator __first, _RandomAccessIterator __last, __find_if(_RandomAccessIterator __first, _RandomAccessIterator __last,
_Predicate __pred, random_access_iterator_tag) _Predicate __pred, random_access_iterator_tag)
...@@ -155,6 +157,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -155,6 +157,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
template<typename _Iterator, typename _Predicate> template<typename _Iterator, typename _Predicate>
_GLIBCXX20_CONSTEXPR
inline _Iterator inline _Iterator
__find_if(_Iterator __first, _Iterator __last, _Predicate __pred) __find_if(_Iterator __first, _Iterator __last, _Predicate __pred)
{ {
...@@ -164,6 +167,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -164,6 +167,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// Provided for stable_partition to use. /// Provided for stable_partition to use.
template<typename _InputIterator, typename _Predicate> template<typename _InputIterator, typename _Predicate>
_GLIBCXX20_CONSTEXPR
inline _InputIterator inline _InputIterator
__find_if_not(_InputIterator __first, _InputIterator __last, __find_if_not(_InputIterator __first, _InputIterator __last,
_Predicate __pred) _Predicate __pred)
...@@ -177,6 +181,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -177,6 +181,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// remaining range length instead of comparing against an end /// remaining range length instead of comparing against an end
/// iterator. /// iterator.
template<typename _InputIterator, typename _Predicate, typename _Distance> template<typename _InputIterator, typename _Predicate, typename _Distance>
_GLIBCXX20_CONSTEXPR
_InputIterator _InputIterator
__find_if_not_n(_InputIterator __first, _Distance& __len, _Predicate __pred) __find_if_not_n(_InputIterator __first, _Distance& __len, _Predicate __pred)
{ {
...@@ -201,6 +206,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -201,6 +206,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _ForwardIterator1, typename _ForwardIterator2, template<typename _ForwardIterator1, typename _ForwardIterator2,
typename _BinaryPredicate> typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
_ForwardIterator1 _ForwardIterator1
__search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, __search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2, _ForwardIterator2 __first2, _ForwardIterator2 __last2,
...@@ -217,7 +223,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -217,7 +223,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__gnu_cxx::__ops::__iter_comp_iter(__predicate, __first2)); __gnu_cxx::__ops::__iter_comp_iter(__predicate, __first2));
// General case. // General case.
_ForwardIterator2 __p;
_ForwardIterator1 __current = __first1; _ForwardIterator1 __current = __first1;
for (;;) for (;;)
...@@ -229,7 +234,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -229,7 +234,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (__first1 == __last1) if (__first1 == __last1)
return __last1; return __last1;
__p = __p1; _ForwardIterator2 __p = __p1;
__current = __first1; __current = __first1;
if (++__current == __last1) if (++__current == __last1)
return __last1; return __last1;
...@@ -253,6 +258,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -253,6 +258,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/ */
template<typename _ForwardIterator, typename _Integer, template<typename _ForwardIterator, typename _Integer,
typename _UnaryPredicate> typename _UnaryPredicate>
_GLIBCXX20_CONSTEXPR
_ForwardIterator _ForwardIterator
__search_n_aux(_ForwardIterator __first, _ForwardIterator __last, __search_n_aux(_ForwardIterator __first, _ForwardIterator __last,
_Integer __count, _UnaryPredicate __unary_pred, _Integer __count, _UnaryPredicate __unary_pred,
...@@ -285,6 +291,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -285,6 +291,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/ */
template<typename _RandomAccessIter, typename _Integer, template<typename _RandomAccessIter, typename _Integer,
typename _UnaryPredicate> typename _UnaryPredicate>
_GLIBCXX20_CONSTEXPR
_RandomAccessIter _RandomAccessIter
__search_n_aux(_RandomAccessIter __first, _RandomAccessIter __last, __search_n_aux(_RandomAccessIter __first, _RandomAccessIter __last,
_Integer __count, _UnaryPredicate __unary_pred, _Integer __count, _UnaryPredicate __unary_pred,
...@@ -315,6 +322,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -315,6 +322,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _ForwardIterator, typename _Integer, template<typename _ForwardIterator, typename _Integer,
typename _UnaryPredicate> typename _UnaryPredicate>
_GLIBCXX20_CONSTEXPR
_ForwardIterator _ForwardIterator
__search_n(_ForwardIterator __first, _ForwardIterator __last, __search_n(_ForwardIterator __first, _ForwardIterator __last,
_Integer __count, _Integer __count,
...@@ -333,6 +341,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -333,6 +341,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// find_end for forward iterators. // find_end for forward iterators.
template<typename _ForwardIterator1, typename _ForwardIterator2, template<typename _ForwardIterator1, typename _ForwardIterator2,
typename _BinaryPredicate> typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
_ForwardIterator1 _ForwardIterator1
__find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, __find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2, _ForwardIterator2 __first2, _ForwardIterator2 __last2,
...@@ -361,6 +370,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -361,6 +370,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// find_end for bidirectional iterators (much faster). // find_end for bidirectional iterators (much faster).
template<typename _BidirectionalIterator1, typename _BidirectionalIterator2, template<typename _BidirectionalIterator1, typename _BidirectionalIterator2,
typename _BinaryPredicate> typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
_BidirectionalIterator1 _BidirectionalIterator1
__find_end(_BidirectionalIterator1 __first1, __find_end(_BidirectionalIterator1 __first1,
_BidirectionalIterator1 __last1, _BidirectionalIterator1 __last1,
...@@ -421,6 +431,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -421,6 +431,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* [__first1,__last1-(__last2-__first2)) * [__first1,__last1-(__last2-__first2))
*/ */
template<typename _ForwardIterator1, typename _ForwardIterator2> template<typename _ForwardIterator1, typename _ForwardIterator2>
_GLIBCXX20_CONSTEXPR
inline _ForwardIterator1 inline _ForwardIterator1
find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2) _ForwardIterator2 __first2, _ForwardIterator2 __last2)
...@@ -470,6 +481,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -470,6 +481,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/ */
template<typename _ForwardIterator1, typename _ForwardIterator2, template<typename _ForwardIterator1, typename _ForwardIterator2,
typename _BinaryPredicate> typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
inline _ForwardIterator1 inline _ForwardIterator1
find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2, _ForwardIterator2 __first2, _ForwardIterator2 __last2,
...@@ -504,6 +516,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -504,6 +516,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @p [__first,__last), and false otherwise. * @p [__first,__last), and false otherwise.
*/ */
template<typename _InputIterator, typename _Predicate> template<typename _InputIterator, typename _Predicate>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
{ return __last == std::find_if_not(__first, __last, __pred); } { return __last == std::find_if_not(__first, __last, __pred); }
...@@ -521,6 +534,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -521,6 +534,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @p [__first,__last), and false otherwise. * @p [__first,__last), and false otherwise.
*/ */
template<typename _InputIterator, typename _Predicate> template<typename _InputIterator, typename _Predicate>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
none_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) none_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
{ return __last == _GLIBCXX_STD_A::find_if(__first, __last, __pred); } { return __last == _GLIBCXX_STD_A::find_if(__first, __last, __pred); }
...@@ -539,6 +553,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -539,6 +553,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* otherwise. * otherwise.
*/ */
template<typename _InputIterator, typename _Predicate> template<typename _InputIterator, typename _Predicate>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
{ return !std::none_of(__first, __last, __pred); } { return !std::none_of(__first, __last, __pred); }
...@@ -554,6 +569,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -554,6 +569,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* such that @p __pred(*i) is false, or @p __last if no such iterator exists. * such that @p __pred(*i) is false, or @p __last if no such iterator exists.
*/ */
template<typename _InputIterator, typename _Predicate> template<typename _InputIterator, typename _Predicate>
_GLIBCXX20_CONSTEXPR
inline _InputIterator inline _InputIterator
find_if_not(_InputIterator __first, _InputIterator __last, find_if_not(_InputIterator __first, _InputIterator __last,
_Predicate __pred) _Predicate __pred)
...@@ -578,6 +594,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -578,6 +594,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* do not. * do not.
*/ */
template<typename _InputIterator, typename _Predicate> template<typename _InputIterator, typename _Predicate>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
is_partitioned(_InputIterator __first, _InputIterator __last, is_partitioned(_InputIterator __first, _InputIterator __last,
_Predicate __pred) _Predicate __pred)
...@@ -599,6 +616,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -599,6 +616,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* and @p none_of(mid, __last, __pred) are both true. * and @p none_of(mid, __last, __pred) are both true.
*/ */
template<typename _ForwardIterator, typename _Predicate> template<typename _ForwardIterator, typename _Predicate>
_GLIBCXX20_CONSTEXPR
_ForwardIterator _ForwardIterator
partition_point(_ForwardIterator __first, _ForwardIterator __last, partition_point(_ForwardIterator __first, _ForwardIterator __last,
_Predicate __pred) _Predicate __pred)
...@@ -615,13 +633,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -615,13 +633,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_DistanceType; _DistanceType;
_DistanceType __len = std::distance(__first, __last); _DistanceType __len = std::distance(__first, __last);
_DistanceType __half;
_ForwardIterator __middle;
while (__len > 0) while (__len > 0)
{ {
__half = __len >> 1; _DistanceType __half = __len >> 1;
__middle = __first; _ForwardIterator __middle = __first;
std::advance(__middle, __half); std::advance(__middle, __half);
if (__pred(*__middle)) if (__pred(*__middle))
{ {
...@@ -638,6 +654,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -638,6 +654,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _InputIterator, typename _OutputIterator, template<typename _InputIterator, typename _OutputIterator,
typename _Predicate> typename _Predicate>
_GLIBCXX20_CONSTEXPR
_OutputIterator _OutputIterator
__remove_copy_if(_InputIterator __first, _InputIterator __last, __remove_copy_if(_InputIterator __first, _InputIterator __last,
_OutputIterator __result, _Predicate __pred) _OutputIterator __result, _Predicate __pred)
...@@ -666,6 +683,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -666,6 +683,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* are copied is unchanged. * are copied is unchanged.
*/ */
template<typename _InputIterator, typename _OutputIterator, typename _Tp> template<typename _InputIterator, typename _OutputIterator, typename _Tp>
_GLIBCXX20_CONSTEXPR
inline _OutputIterator inline _OutputIterator
remove_copy(_InputIterator __first, _InputIterator __last, remove_copy(_InputIterator __first, _InputIterator __last,
_OutputIterator __result, const _Tp& __value) _OutputIterator __result, const _Tp& __value)
...@@ -699,6 +717,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -699,6 +717,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/ */
template<typename _InputIterator, typename _OutputIterator, template<typename _InputIterator, typename _OutputIterator,
typename _Predicate> typename _Predicate>
_GLIBCXX20_CONSTEXPR
inline _OutputIterator inline _OutputIterator
remove_copy_if(_InputIterator __first, _InputIterator __last, remove_copy_if(_InputIterator __first, _InputIterator __last,
_OutputIterator __result, _Predicate __pred) _OutputIterator __result, _Predicate __pred)
...@@ -733,6 +752,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -733,6 +752,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/ */
template<typename _InputIterator, typename _OutputIterator, template<typename _InputIterator, typename _OutputIterator,
typename _Predicate> typename _Predicate>
_GLIBCXX20_CONSTEXPR
_OutputIterator _OutputIterator
copy_if(_InputIterator __first, _InputIterator __last, copy_if(_InputIterator __first, _InputIterator __last,
_OutputIterator __result, _Predicate __pred) _OutputIterator __result, _Predicate __pred)
...@@ -755,6 +775,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -755,6 +775,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
template<typename _InputIterator, typename _Size, typename _OutputIterator> template<typename _InputIterator, typename _Size, typename _OutputIterator>
_GLIBCXX20_CONSTEXPR
_OutputIterator _OutputIterator
__copy_n(_InputIterator __first, _Size __n, __copy_n(_InputIterator __first, _Size __n,
_OutputIterator __result, input_iterator_tag) _OutputIterator __result, input_iterator_tag)
...@@ -776,6 +797,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -776,6 +797,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _RandomAccessIterator, typename _Size, template<typename _RandomAccessIterator, typename _Size,
typename _OutputIterator> typename _OutputIterator>
_GLIBCXX20_CONSTEXPR
inline _OutputIterator inline _OutputIterator
__copy_n(_RandomAccessIterator __first, _Size __n, __copy_n(_RandomAccessIterator __first, _Size __n,
_OutputIterator __result, random_access_iterator_tag) _OutputIterator __result, random_access_iterator_tag)
...@@ -795,6 +817,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -795,6 +817,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* optimizations such as unrolling). * optimizations such as unrolling).
*/ */
template<typename _InputIterator, typename _Size, typename _OutputIterator> template<typename _InputIterator, typename _Size, typename _OutputIterator>
_GLIBCXX20_CONSTEXPR
inline _OutputIterator inline _OutputIterator
copy_n(_InputIterator __first, _Size __n, _OutputIterator __result) copy_n(_InputIterator __first, _Size __n, _OutputIterator __result)
{ {
...@@ -824,6 +847,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -824,6 +847,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/ */
template<typename _InputIterator, typename _OutputIterator1, template<typename _InputIterator, typename _OutputIterator1,
typename _OutputIterator2, typename _Predicate> typename _OutputIterator2, typename _Predicate>
_GLIBCXX20_CONSTEXPR
pair<_OutputIterator1, _OutputIterator2> pair<_OutputIterator1, _OutputIterator2>
partition_copy(_InputIterator __first, _InputIterator __last, partition_copy(_InputIterator __first, _InputIterator __last,
_OutputIterator1 __out_true, _OutputIterator2 __out_false, _OutputIterator1 __out_true, _OutputIterator2 __out_false,
...@@ -856,6 +880,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -856,6 +880,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif #endif
template<typename _ForwardIterator, typename _Predicate> template<typename _ForwardIterator, typename _Predicate>
_GLIBCXX20_CONSTEXPR
_ForwardIterator _ForwardIterator
__remove_if(_ForwardIterator __first, _ForwardIterator __last, __remove_if(_ForwardIterator __first, _ForwardIterator __last,
_Predicate __pred) _Predicate __pred)
...@@ -892,6 +917,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -892,6 +917,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* are still present, but their value is unspecified. * are still present, but their value is unspecified.
*/ */
template<typename _ForwardIterator, typename _Tp> template<typename _ForwardIterator, typename _Tp>
_GLIBCXX20_CONSTEXPR
inline _ForwardIterator inline _ForwardIterator
remove(_ForwardIterator __first, _ForwardIterator __last, remove(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __value) const _Tp& __value)
...@@ -925,6 +951,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -925,6 +951,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* are still present, but their value is unspecified. * are still present, but their value is unspecified.
*/ */
template<typename _ForwardIterator, typename _Predicate> template<typename _ForwardIterator, typename _Predicate>
_GLIBCXX20_CONSTEXPR
inline _ForwardIterator inline _ForwardIterator
remove_if(_ForwardIterator __first, _ForwardIterator __last, remove_if(_ForwardIterator __first, _ForwardIterator __last,
_Predicate __pred) _Predicate __pred)
...@@ -941,6 +968,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -941,6 +968,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
template<typename _ForwardIterator, typename _BinaryPredicate> template<typename _ForwardIterator, typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
_ForwardIterator _ForwardIterator
__adjacent_find(_ForwardIterator __first, _ForwardIterator __last, __adjacent_find(_ForwardIterator __first, _ForwardIterator __last,
_BinaryPredicate __binary_pred) _BinaryPredicate __binary_pred)
...@@ -958,6 +986,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -958,6 +986,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
template<typename _ForwardIterator, typename _BinaryPredicate> template<typename _ForwardIterator, typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
_ForwardIterator _ForwardIterator
__unique(_ForwardIterator __first, _ForwardIterator __last, __unique(_ForwardIterator __first, _ForwardIterator __last,
_BinaryPredicate __binary_pred) _BinaryPredicate __binary_pred)
...@@ -991,6 +1020,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -991,6 +1020,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* are still present, but their value is unspecified. * are still present, but their value is unspecified.
*/ */
template<typename _ForwardIterator> template<typename _ForwardIterator>
_GLIBCXX20_CONSTEXPR
inline _ForwardIterator inline _ForwardIterator
unique(_ForwardIterator __first, _ForwardIterator __last) unique(_ForwardIterator __first, _ForwardIterator __last)
{ {
...@@ -1021,6 +1051,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1021,6 +1051,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* are still present, but their value is unspecified. * are still present, but their value is unspecified.
*/ */
template<typename _ForwardIterator, typename _BinaryPredicate> template<typename _ForwardIterator, typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
inline _ForwardIterator inline _ForwardIterator
unique(_ForwardIterator __first, _ForwardIterator __last, unique(_ForwardIterator __first, _ForwardIterator __last,
_BinaryPredicate __binary_pred) _BinaryPredicate __binary_pred)
...@@ -1045,6 +1076,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1045,6 +1076,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/ */
template<typename _ForwardIterator, typename _OutputIterator, template<typename _ForwardIterator, typename _OutputIterator,
typename _BinaryPredicate> typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
_OutputIterator _OutputIterator
__unique_copy(_ForwardIterator __first, _ForwardIterator __last, __unique_copy(_ForwardIterator __first, _ForwardIterator __last,
_OutputIterator __result, _BinaryPredicate __binary_pred, _OutputIterator __result, _BinaryPredicate __binary_pred,
...@@ -1074,6 +1106,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1074,6 +1106,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/ */
template<typename _InputIterator, typename _OutputIterator, template<typename _InputIterator, typename _OutputIterator,
typename _BinaryPredicate> typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
_OutputIterator _OutputIterator
__unique_copy(_InputIterator __first, _InputIterator __last, __unique_copy(_InputIterator __first, _InputIterator __last,
_OutputIterator __result, _BinaryPredicate __binary_pred, _OutputIterator __result, _BinaryPredicate __binary_pred,
...@@ -1106,6 +1139,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1106,6 +1139,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/ */
template<typename _InputIterator, typename _ForwardIterator, template<typename _InputIterator, typename _ForwardIterator,
typename _BinaryPredicate> typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
_ForwardIterator _ForwardIterator
__unique_copy(_InputIterator __first, _InputIterator __last, __unique_copy(_InputIterator __first, _InputIterator __last,
_ForwardIterator __result, _BinaryPredicate __binary_pred, _ForwardIterator __result, _BinaryPredicate __binary_pred,
...@@ -1203,6 +1237,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1203,6 +1237,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* [__result,__result+(__last-__first)) must not overlap. * [__result,__result+(__last-__first)) must not overlap.
*/ */
template<typename _BidirectionalIterator, typename _OutputIterator> template<typename _BidirectionalIterator, typename _OutputIterator>
_GLIBCXX20_CONSTEXPR
_OutputIterator _OutputIterator
reverse_copy(_BidirectionalIterator __first, _BidirectionalIterator __last, reverse_copy(_BidirectionalIterator __first, _BidirectionalIterator __last,
_OutputIterator __result) _OutputIterator __result)
...@@ -1467,6 +1502,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1467,6 +1502,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* for each @p n in the range @p [0,__last-__first). * for each @p n in the range @p [0,__last-__first).
*/ */
template<typename _ForwardIterator, typename _OutputIterator> template<typename _ForwardIterator, typename _OutputIterator>
_GLIBCXX20_CONSTEXPR
inline _OutputIterator inline _OutputIterator
rotate_copy(_ForwardIterator __first, _ForwardIterator __middle, rotate_copy(_ForwardIterator __first, _ForwardIterator __middle,
_ForwardIterator __last, _OutputIterator __result) _ForwardIterator __last, _OutputIterator __result)
...@@ -1816,6 +1852,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1816,6 +1852,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// This is a helper function for the sort routine. /// This is a helper function for the sort routine.
template<typename _RandomAccessIterator, typename _Compare> template<typename _RandomAccessIterator, typename _Compare>
_GLIBCXX20_CONSTEXPR
void void
__unguarded_linear_insert(_RandomAccessIterator __last, __unguarded_linear_insert(_RandomAccessIterator __last,
_Compare __comp) _Compare __comp)
...@@ -1835,6 +1872,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1835,6 +1872,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// This is a helper function for the sort routine. /// This is a helper function for the sort routine.
template<typename _RandomAccessIterator, typename _Compare> template<typename _RandomAccessIterator, typename _Compare>
_GLIBCXX20_CONSTEXPR
void void
__insertion_sort(_RandomAccessIterator __first, __insertion_sort(_RandomAccessIterator __first,
_RandomAccessIterator __last, _Compare __comp) _RandomAccessIterator __last, _Compare __comp)
...@@ -1858,6 +1896,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1858,6 +1896,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// This is a helper function for the sort routine. /// This is a helper function for the sort routine.
template<typename _RandomAccessIterator, typename _Compare> template<typename _RandomAccessIterator, typename _Compare>
_GLIBCXX20_CONSTEXPR
inline void inline void
__unguarded_insertion_sort(_RandomAccessIterator __first, __unguarded_insertion_sort(_RandomAccessIterator __first,
_RandomAccessIterator __last, _Compare __comp) _RandomAccessIterator __last, _Compare __comp)
...@@ -1875,6 +1914,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1875,6 +1914,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// This is a helper function for the sort routine. /// This is a helper function for the sort routine.
template<typename _RandomAccessIterator, typename _Compare> template<typename _RandomAccessIterator, typename _Compare>
_GLIBCXX20_CONSTEXPR
void void
__final_insertion_sort(_RandomAccessIterator __first, __final_insertion_sort(_RandomAccessIterator __first,
_RandomAccessIterator __last, _Compare __comp) _RandomAccessIterator __last, _Compare __comp)
...@@ -2018,6 +2058,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -2018,6 +2058,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* the function used for the initial sort. * the function used for the initial sort.
*/ */
template<typename _ForwardIterator, typename _Tp, typename _Compare> template<typename _ForwardIterator, typename _Tp, typename _Compare>
_GLIBCXX20_CONSTEXPR
inline _ForwardIterator inline _ForwardIterator
lower_bound(_ForwardIterator __first, _ForwardIterator __last, lower_bound(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val, _Compare __comp) const _Tp& __val, _Compare __comp)
...@@ -2034,6 +2075,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -2034,6 +2075,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
template<typename _ForwardIterator, typename _Tp, typename _Compare> template<typename _ForwardIterator, typename _Tp, typename _Compare>
_GLIBCXX20_CONSTEXPR
_ForwardIterator _ForwardIterator
__upper_bound(_ForwardIterator __first, _ForwardIterator __last, __upper_bound(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val, _Compare __comp) const _Tp& __val, _Compare __comp)
...@@ -2072,6 +2114,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -2072,6 +2114,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @ingroup binary_search_algorithms * @ingroup binary_search_algorithms
*/ */
template<typename _ForwardIterator, typename _Tp> template<typename _ForwardIterator, typename _Tp>
_GLIBCXX20_CONSTEXPR
inline _ForwardIterator inline _ForwardIterator
upper_bound(_ForwardIterator __first, _ForwardIterator __last, upper_bound(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val) const _Tp& __val)
...@@ -2102,6 +2145,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -2102,6 +2145,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* the function used for the initial sort. * the function used for the initial sort.
*/ */
template<typename _ForwardIterator, typename _Tp, typename _Compare> template<typename _ForwardIterator, typename _Tp, typename _Compare>
_GLIBCXX20_CONSTEXPR
inline _ForwardIterator inline _ForwardIterator
upper_bound(_ForwardIterator __first, _ForwardIterator __last, upper_bound(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val, _Compare __comp) const _Tp& __val, _Compare __comp)
...@@ -2119,6 +2163,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -2119,6 +2163,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _ForwardIterator, typename _Tp, template<typename _ForwardIterator, typename _Tp,
typename _CompareItTp, typename _CompareTpIt> typename _CompareItTp, typename _CompareTpIt>
_GLIBCXX20_CONSTEXPR
pair<_ForwardIterator, _ForwardIterator> pair<_ForwardIterator, _ForwardIterator>
__equal_range(_ForwardIterator __first, _ForwardIterator __last, __equal_range(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val, const _Tp& __val,
...@@ -2173,6 +2218,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -2173,6 +2218,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* but does not actually call those functions. * but does not actually call those functions.
*/ */
template<typename _ForwardIterator, typename _Tp> template<typename _ForwardIterator, typename _Tp>
_GLIBCXX20_CONSTEXPR
inline pair<_ForwardIterator, _ForwardIterator> inline pair<_ForwardIterator, _ForwardIterator>
equal_range(_ForwardIterator __first, _ForwardIterator __last, equal_range(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val) const _Tp& __val)
...@@ -2209,6 +2255,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -2209,6 +2255,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* but does not actually call those functions. * but does not actually call those functions.
*/ */
template<typename _ForwardIterator, typename _Tp, typename _Compare> template<typename _ForwardIterator, typename _Tp, typename _Compare>
_GLIBCXX20_CONSTEXPR
inline pair<_ForwardIterator, _ForwardIterator> inline pair<_ForwardIterator, _ForwardIterator>
equal_range(_ForwardIterator __first, _ForwardIterator __last, equal_range(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val, _Compare __comp) const _Tp& __val, _Compare __comp)
...@@ -2242,6 +2289,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -2242,6 +2289,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* that, use std::find or a container's specialized find member functions. * that, use std::find or a container's specialized find member functions.
*/ */
template<typename _ForwardIterator, typename _Tp> template<typename _ForwardIterator, typename _Tp>
_GLIBCXX20_CONSTEXPR
bool bool
binary_search(_ForwardIterator __first, _ForwardIterator __last, binary_search(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val) const _Tp& __val)
...@@ -2275,6 +2323,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -2275,6 +2323,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* the function used for the initial sort. * the function used for the initial sort.
*/ */
template<typename _ForwardIterator, typename _Tp, typename _Compare> template<typename _ForwardIterator, typename _Tp, typename _Compare>
_GLIBCXX20_CONSTEXPR
bool bool
binary_search(_ForwardIterator __first, _ForwardIterator __last, binary_search(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val, _Compare __comp) const _Tp& __val, _Compare __comp)
...@@ -2778,6 +2827,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -2778,6 +2827,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _InputIterator1, typename _InputIterator2, template<typename _InputIterator1, typename _InputIterator2,
typename _Compare> typename _Compare>
_GLIBCXX20_CONSTEXPR
bool bool
__includes(_InputIterator1 __first1, _InputIterator1 __last1, __includes(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _InputIterator2 __first2, _InputIterator2 __last2,
...@@ -2816,6 +2866,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -2816,6 +2866,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* returned. * returned.
*/ */
template<typename _InputIterator1, typename _InputIterator2> template<typename _InputIterator1, typename _InputIterator2>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
includes(_InputIterator1 __first1, _InputIterator1 __last1, includes(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2) _InputIterator2 __first2, _InputIterator2 __last2)
...@@ -2861,6 +2912,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -2861,6 +2912,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/ */
template<typename _InputIterator1, typename _InputIterator2, template<typename _InputIterator1, typename _InputIterator2,
typename _Compare> typename _Compare>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
includes(_InputIterator1 __first1, _InputIterator1 __last1, includes(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _InputIterator2 __first2, _InputIterator2 __last2,
...@@ -2895,6 +2947,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -2895,6 +2947,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// max_element // max_element
template<typename _BidirectionalIterator, typename _Compare> template<typename _BidirectionalIterator, typename _Compare>
_GLIBCXX20_CONSTEXPR
bool bool
__next_permutation(_BidirectionalIterator __first, __next_permutation(_BidirectionalIterator __first,
_BidirectionalIterator __last, _Compare __comp) _BidirectionalIterator __last, _Compare __comp)
...@@ -2994,6 +3047,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -2994,6 +3047,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
template<typename _BidirectionalIterator, typename _Compare> template<typename _BidirectionalIterator, typename _Compare>
_GLIBCXX20_CONSTEXPR
bool bool
__prev_permutation(_BidirectionalIterator __first, __prev_permutation(_BidirectionalIterator __first,
_BidirectionalIterator __last, _Compare __comp) _BidirectionalIterator __last, _Compare __comp)
...@@ -3098,6 +3152,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -3098,6 +3152,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _InputIterator, typename _OutputIterator, template<typename _InputIterator, typename _OutputIterator,
typename _Predicate, typename _Tp> typename _Predicate, typename _Tp>
_GLIBCXX20_CONSTEXPR
_OutputIterator _OutputIterator
__replace_copy_if(_InputIterator __first, _InputIterator __last, __replace_copy_if(_InputIterator __first, _InputIterator __last,
_OutputIterator __result, _OutputIterator __result,
...@@ -3126,6 +3181,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -3126,6 +3181,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* equal to @p __old_value with @p __new_value. * equal to @p __old_value with @p __new_value.
*/ */
template<typename _InputIterator, typename _OutputIterator, typename _Tp> template<typename _InputIterator, typename _OutputIterator, typename _Tp>
_GLIBCXX20_CONSTEXPR
inline _OutputIterator inline _OutputIterator
replace_copy(_InputIterator __first, _InputIterator __last, replace_copy(_InputIterator __first, _InputIterator __last,
_OutputIterator __result, _OutputIterator __result,
...@@ -3161,6 +3217,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -3161,6 +3217,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/ */
template<typename _InputIterator, typename _OutputIterator, template<typename _InputIterator, typename _OutputIterator,
typename _Predicate, typename _Tp> typename _Predicate, typename _Tp>
_GLIBCXX20_CONSTEXPR
inline _OutputIterator inline _OutputIterator
replace_copy_if(_InputIterator __first, _InputIterator __last, replace_copy_if(_InputIterator __first, _InputIterator __last,
_OutputIterator __result, _OutputIterator __result,
...@@ -3180,6 +3237,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -3180,6 +3237,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
template<typename _InputIterator, typename _Predicate> template<typename _InputIterator, typename _Predicate>
_GLIBCXX20_CONSTEXPR
typename iterator_traits<_InputIterator>::difference_type typename iterator_traits<_InputIterator>::difference_type
__count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) __count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred)
{ {
...@@ -3199,6 +3257,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -3199,6 +3257,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @return True if the elements are sorted, false otherwise. * @return True if the elements are sorted, false otherwise.
*/ */
template<typename _ForwardIterator> template<typename _ForwardIterator>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
is_sorted(_ForwardIterator __first, _ForwardIterator __last) is_sorted(_ForwardIterator __first, _ForwardIterator __last)
{ return std::is_sorted_until(__first, __last) == __last; } { return std::is_sorted_until(__first, __last) == __last; }
...@@ -3213,12 +3272,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -3213,12 +3272,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @return True if the elements are sorted, false otherwise. * @return True if the elements are sorted, false otherwise.
*/ */
template<typename _ForwardIterator, typename _Compare> template<typename _ForwardIterator, typename _Compare>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
is_sorted(_ForwardIterator __first, _ForwardIterator __last, is_sorted(_ForwardIterator __first, _ForwardIterator __last,
_Compare __comp) _Compare __comp)
{ return std::is_sorted_until(__first, __last, __comp) == __last; } { return std::is_sorted_until(__first, __last, __comp) == __last; }
template<typename _ForwardIterator, typename _Compare> template<typename _ForwardIterator, typename _Compare>
_GLIBCXX20_CONSTEXPR
_ForwardIterator _ForwardIterator
__is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, __is_sorted_until(_ForwardIterator __first, _ForwardIterator __last,
_Compare __comp) _Compare __comp)
...@@ -3242,6 +3303,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -3242,6 +3303,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* for which the range [__first, i) is sorted. * for which the range [__first, i) is sorted.
*/ */
template<typename _ForwardIterator> template<typename _ForwardIterator>
_GLIBCXX20_CONSTEXPR
inline _ForwardIterator inline _ForwardIterator
is_sorted_until(_ForwardIterator __first, _ForwardIterator __last) is_sorted_until(_ForwardIterator __first, _ForwardIterator __last)
{ {
...@@ -3266,6 +3328,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -3266,6 +3328,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* for which the range [__first, i) is sorted. * for which the range [__first, i) is sorted.
*/ */
template<typename _ForwardIterator, typename _Compare> template<typename _ForwardIterator, typename _Compare>
_GLIBCXX20_CONSTEXPR
inline _ForwardIterator inline _ForwardIterator
is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, is_sorted_until(_ForwardIterator __first, _ForwardIterator __last,
_Compare __comp) _Compare __comp)
...@@ -3484,6 +3547,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -3484,6 +3547,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _ForwardIterator1, typename _ForwardIterator2, template<typename _ForwardIterator1, typename _ForwardIterator2,
typename _BinaryPredicate> typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
bool bool
__is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, __is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _BinaryPredicate __pred) _ForwardIterator2 __first2, _BinaryPredicate __pred)
...@@ -3532,6 +3596,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -3532,6 +3596,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* returns true; otherwise, returns false. * returns true; otherwise, returns false.
*/ */
template<typename _ForwardIterator1, typename _ForwardIterator2> template<typename _ForwardIterator1, typename _ForwardIterator2>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2) _ForwardIterator2 __first2)
...@@ -3564,6 +3629,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -3564,6 +3629,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/ */
template<typename _ForwardIterator1, typename _ForwardIterator2, template<typename _ForwardIterator1, typename _ForwardIterator2,
typename _BinaryPredicate> typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _BinaryPredicate __pred) _ForwardIterator2 __first2, _BinaryPredicate __pred)
...@@ -3583,6 +3649,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -3583,6 +3649,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#if __cplusplus > 201103L #if __cplusplus > 201103L
template<typename _ForwardIterator1, typename _ForwardIterator2, template<typename _ForwardIterator1, typename _ForwardIterator2,
typename _BinaryPredicate> typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
bool bool
__is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, __is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2, _ForwardIterator2 __first2, _ForwardIterator2 __last2,
...@@ -3656,6 +3723,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -3656,6 +3723,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* otherwise, returns false. * otherwise, returns false.
*/ */
template<typename _ForwardIterator1, typename _ForwardIterator2> template<typename _ForwardIterator1, typename _ForwardIterator2>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2) _ForwardIterator2 __first2, _ForwardIterator2 __last2)
...@@ -3684,6 +3752,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -3684,6 +3752,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/ */
template<typename _ForwardIterator1, typename _ForwardIterator2, template<typename _ForwardIterator1, typename _ForwardIterator2,
typename _BinaryPredicate> typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2, _ForwardIterator2 __first2, _ForwardIterator2 __last2,
...@@ -3866,6 +3935,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -3866,6 +3935,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* If @p __f has a return value it is ignored. * If @p __f has a return value it is ignored.
*/ */
template<typename _InputIterator, typename _Function> template<typename _InputIterator, typename _Function>
_GLIBCXX20_CONSTEXPR
_Function _Function
for_each(_InputIterator __first, _InputIterator __last, _Function __f) for_each(_InputIterator __first, _InputIterator __last, _Function __f)
{ {
...@@ -3920,6 +3990,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -3920,6 +3990,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* such that @c *i == @p __val, or @p __last if no such iterator exists. * such that @c *i == @p __val, or @p __last if no such iterator exists.
*/ */
template<typename _InputIterator, typename _Tp> template<typename _InputIterator, typename _Tp>
_GLIBCXX20_CONSTEXPR
inline _InputIterator inline _InputIterator
find(_InputIterator __first, _InputIterator __last, find(_InputIterator __first, _InputIterator __last,
const _Tp& __val) const _Tp& __val)
...@@ -3944,6 +4015,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -3944,6 +4015,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* such that @p __pred(*i) is true, or @p __last if no such iterator exists. * such that @p __pred(*i) is true, or @p __last if no such iterator exists.
*/ */
template<typename _InputIterator, typename _Predicate> template<typename _InputIterator, typename _Predicate>
_GLIBCXX20_CONSTEXPR
inline _InputIterator inline _InputIterator
find_if(_InputIterator __first, _InputIterator __last, find_if(_InputIterator __first, _InputIterator __last,
_Predicate __pred) _Predicate __pred)
...@@ -3975,6 +4047,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -3975,6 +4047,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* otherwise returns @p __last1. * otherwise returns @p __last1.
*/ */
template<typename _InputIterator, typename _ForwardIterator> template<typename _InputIterator, typename _ForwardIterator>
_GLIBCXX20_CONSTEXPR
_InputIterator _InputIterator
find_first_of(_InputIterator __first1, _InputIterator __last1, find_first_of(_InputIterator __first1, _InputIterator __last1,
_ForwardIterator __first2, _ForwardIterator __last2) _ForwardIterator __first2, _ForwardIterator __last2)
...@@ -4016,6 +4089,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -4016,6 +4089,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/ */
template<typename _InputIterator, typename _ForwardIterator, template<typename _InputIterator, typename _ForwardIterator,
typename _BinaryPredicate> typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
_InputIterator _InputIterator
find_first_of(_InputIterator __first1, _InputIterator __last1, find_first_of(_InputIterator __first1, _InputIterator __last1,
_ForwardIterator __first2, _ForwardIterator __last2, _ForwardIterator __first2, _ForwardIterator __last2,
...@@ -4047,6 +4121,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -4047,6 +4121,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* or @p __last if no such iterator exists. * or @p __last if no such iterator exists.
*/ */
template<typename _ForwardIterator> template<typename _ForwardIterator>
_GLIBCXX20_CONSTEXPR
inline _ForwardIterator inline _ForwardIterator
adjacent_find(_ForwardIterator __first, _ForwardIterator __last) adjacent_find(_ForwardIterator __first, _ForwardIterator __last)
{ {
...@@ -4072,6 +4147,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -4072,6 +4147,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* exists. * exists.
*/ */
template<typename _ForwardIterator, typename _BinaryPredicate> template<typename _ForwardIterator, typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
inline _ForwardIterator inline _ForwardIterator
adjacent_find(_ForwardIterator __first, _ForwardIterator __last, adjacent_find(_ForwardIterator __first, _ForwardIterator __last,
_BinaryPredicate __binary_pred) _BinaryPredicate __binary_pred)
...@@ -4097,6 +4173,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -4097,6 +4173,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* for which @c *i == @p __value * for which @c *i == @p __value
*/ */
template<typename _InputIterator, typename _Tp> template<typename _InputIterator, typename _Tp>
_GLIBCXX20_CONSTEXPR
inline typename iterator_traits<_InputIterator>::difference_type inline typename iterator_traits<_InputIterator>::difference_type
count(_InputIterator __first, _InputIterator __last, const _Tp& __value) count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
{ {
...@@ -4120,6 +4197,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -4120,6 +4197,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* for which @p __pred(*i) is true. * for which @p __pred(*i) is true.
*/ */
template<typename _InputIterator, typename _Predicate> template<typename _InputIterator, typename _Predicate>
_GLIBCXX20_CONSTEXPR
inline typename iterator_traits<_InputIterator>::difference_type inline typename iterator_traits<_InputIterator>::difference_type
count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred)
{ {
...@@ -4160,6 +4238,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -4160,6 +4238,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* @p [__first1,__last1-(__last2-__first2)) * @p [__first1,__last1-(__last2-__first2))
*/ */
template<typename _ForwardIterator1, typename _ForwardIterator2> template<typename _ForwardIterator1, typename _ForwardIterator2>
_GLIBCXX20_CONSTEXPR
inline _ForwardIterator1 inline _ForwardIterator1
search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2) _ForwardIterator2 __first2, _ForwardIterator2 __last2)
...@@ -4200,6 +4279,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -4200,6 +4279,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/ */
template<typename _ForwardIterator1, typename _ForwardIterator2, template<typename _ForwardIterator1, typename _ForwardIterator2,
typename _BinaryPredicate> typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
inline _ForwardIterator1 inline _ForwardIterator1
search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2, _ForwardIterator2 __first2, _ForwardIterator2 __last2,
...@@ -4234,6 +4314,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -4234,6 +4314,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* equal to @p __val. * equal to @p __val.
*/ */
template<typename _ForwardIterator, typename _Integer, typename _Tp> template<typename _ForwardIterator, typename _Integer, typename _Tp>
_GLIBCXX20_CONSTEXPR
inline _ForwardIterator inline _ForwardIterator
search_n(_ForwardIterator __first, _ForwardIterator __last, search_n(_ForwardIterator __first, _ForwardIterator __last,
_Integer __count, const _Tp& __val) _Integer __count, const _Tp& __val)
...@@ -4268,6 +4349,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -4268,6 +4349,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/ */
template<typename _ForwardIterator, typename _Integer, typename _Tp, template<typename _ForwardIterator, typename _Integer, typename _Tp,
typename _BinaryPredicate> typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
inline _ForwardIterator inline _ForwardIterator
search_n(_ForwardIterator __first, _ForwardIterator __last, search_n(_ForwardIterator __first, _ForwardIterator __last,
_Integer __count, const _Tp& __val, _Integer __count, const _Tp& __val,
...@@ -4316,6 +4398,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -4316,6 +4398,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/ */
template<typename _InputIterator, typename _OutputIterator, template<typename _InputIterator, typename _OutputIterator,
typename _UnaryOperation> typename _UnaryOperation>
_GLIBCXX20_CONSTEXPR
_OutputIterator _OutputIterator
transform(_InputIterator __first, _InputIterator __last, transform(_InputIterator __first, _InputIterator __last,
_OutputIterator __result, _UnaryOperation __unary_op) _OutputIterator __result, _UnaryOperation __unary_op)
...@@ -4353,6 +4436,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -4353,6 +4436,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/ */
template<typename _InputIterator1, typename _InputIterator2, template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator, typename _BinaryOperation> typename _OutputIterator, typename _BinaryOperation>
_GLIBCXX20_CONSTEXPR
_OutputIterator _OutputIterator
transform(_InputIterator1 __first1, _InputIterator1 __last1, transform(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _OutputIterator __result, _InputIterator2 __first2, _OutputIterator __result,
...@@ -4385,6 +4469,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -4385,6 +4469,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* @p __old_value then the assignment @c *i = @p __new_value is performed. * @p __old_value then the assignment @c *i = @p __new_value is performed.
*/ */
template<typename _ForwardIterator, typename _Tp> template<typename _ForwardIterator, typename _Tp>
_GLIBCXX20_CONSTEXPR
void void
replace(_ForwardIterator __first, _ForwardIterator __last, replace(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __old_value, const _Tp& __new_value) const _Tp& __old_value, const _Tp& __new_value)
...@@ -4417,6 +4502,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -4417,6 +4502,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* is true then the assignment @c *i = @p __new_value is performed. * is true then the assignment @c *i = @p __new_value is performed.
*/ */
template<typename _ForwardIterator, typename _Predicate, typename _Tp> template<typename _ForwardIterator, typename _Predicate, typename _Tp>
_GLIBCXX20_CONSTEXPR
void void
replace_if(_ForwardIterator __first, _ForwardIterator __last, replace_if(_ForwardIterator __first, _ForwardIterator __last,
_Predicate __pred, const _Tp& __new_value) _Predicate __pred, const _Tp& __new_value)
...@@ -4449,6 +4535,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -4449,6 +4535,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* @p [__first,__last). * @p [__first,__last).
*/ */
template<typename _ForwardIterator, typename _Generator> template<typename _ForwardIterator, typename _Generator>
_GLIBCXX20_CONSTEXPR
void void
generate(_ForwardIterator __first, _ForwardIterator __last, generate(_ForwardIterator __first, _ForwardIterator __last,
_Generator __gen) _Generator __gen)
...@@ -4482,6 +4569,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -4482,6 +4569,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
// DR 865. More algorithms that throw away information // DR 865. More algorithms that throw away information
// DR 426. search_n(), fill_n(), and generate_n() with negative n // DR 426. search_n(), fill_n(), and generate_n() with negative n
template<typename _OutputIterator, typename _Size, typename _Generator> template<typename _OutputIterator, typename _Size, typename _Generator>
_GLIBCXX20_CONSTEXPR
_OutputIterator _OutputIterator
generate_n(_OutputIterator __first, _Size __n, _Generator __gen) generate_n(_OutputIterator __first, _Size __n, _Generator __gen)
{ {
...@@ -4519,6 +4607,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -4519,6 +4607,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* Assignable? * Assignable?
*/ */
template<typename _InputIterator, typename _OutputIterator> template<typename _InputIterator, typename _OutputIterator>
_GLIBCXX20_CONSTEXPR
inline _OutputIterator inline _OutputIterator
unique_copy(_InputIterator __first, _InputIterator __last, unique_copy(_InputIterator __first, _InputIterator __last,
_OutputIterator __result) _OutputIterator __result)
...@@ -4560,6 +4649,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -4560,6 +4649,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/ */
template<typename _InputIterator, typename _OutputIterator, template<typename _InputIterator, typename _OutputIterator,
typename _BinaryPredicate> typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
inline _OutputIterator inline _OutputIterator
unique_copy(_InputIterator __first, _InputIterator __last, unique_copy(_InputIterator __first, _InputIterator __last,
_OutputIterator __result, _OutputIterator __result,
...@@ -4898,6 +4988,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -4898,6 +4988,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
template<typename _InputIterator1, typename _InputIterator2, template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator, typename _Compare> typename _OutputIterator, typename _Compare>
_GLIBCXX20_CONSTEXPR
_OutputIterator _OutputIterator
__merge(_InputIterator1 __first1, _InputIterator1 __last1, __merge(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _InputIterator2 __first2, _InputIterator2 __last2,
...@@ -4942,6 +5033,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -4942,6 +5033,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/ */
template<typename _InputIterator1, typename _InputIterator2, template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator> typename _OutputIterator>
_GLIBCXX20_CONSTEXPR
inline _OutputIterator inline _OutputIterator
merge(_InputIterator1 __first1, _InputIterator1 __last1, merge(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _InputIterator2 __first2, _InputIterator2 __last2,
...@@ -4992,6 +5084,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -4992,6 +5084,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/ */
template<typename _InputIterator1, typename _InputIterator2, template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator, typename _Compare> typename _OutputIterator, typename _Compare>
_GLIBCXX20_CONSTEXPR
inline _OutputIterator inline _OutputIterator
merge(_InputIterator1 __first1, _InputIterator1 __last1, merge(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _InputIterator2 __first2, _InputIterator2 __last2,
...@@ -5109,6 +5202,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -5109,6 +5202,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
template<typename _InputIterator1, typename _InputIterator2, template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator, typename _OutputIterator,
typename _Compare> typename _Compare>
_GLIBCXX20_CONSTEXPR
_OutputIterator _OutputIterator
__set_union(_InputIterator1 __first1, _InputIterator1 __last1, __set_union(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _InputIterator2 __first2, _InputIterator2 __last2,
...@@ -5159,6 +5253,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -5159,6 +5253,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/ */
template<typename _InputIterator1, typename _InputIterator2, template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator> typename _OutputIterator>
_GLIBCXX20_CONSTEXPR
inline _OutputIterator inline _OutputIterator
set_union(_InputIterator1 __first1, _InputIterator1 __last1, set_union(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _InputIterator2 __first2, _InputIterator2 __last2,
...@@ -5209,6 +5304,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -5209,6 +5304,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/ */
template<typename _InputIterator1, typename _InputIterator2, template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator, typename _Compare> typename _OutputIterator, typename _Compare>
_GLIBCXX20_CONSTEXPR
inline _OutputIterator inline _OutputIterator
set_union(_InputIterator1 __first1, _InputIterator1 __last1, set_union(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _InputIterator2 __first2, _InputIterator2 __last2,
...@@ -5240,6 +5336,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -5240,6 +5336,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
template<typename _InputIterator1, typename _InputIterator2, template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator, typename _OutputIterator,
typename _Compare> typename _Compare>
_GLIBCXX20_CONSTEXPR
_OutputIterator _OutputIterator
__set_intersection(_InputIterator1 __first1, _InputIterator1 __last1, __set_intersection(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _InputIterator2 __first2, _InputIterator2 __last2,
...@@ -5280,6 +5377,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -5280,6 +5377,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/ */
template<typename _InputIterator1, typename _InputIterator2, template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator> typename _OutputIterator>
_GLIBCXX20_CONSTEXPR
inline _OutputIterator inline _OutputIterator
set_intersection(_InputIterator1 __first1, _InputIterator1 __last1, set_intersection(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _InputIterator2 __first2, _InputIterator2 __last2,
...@@ -5329,6 +5427,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -5329,6 +5427,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/ */
template<typename _InputIterator1, typename _InputIterator2, template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator, typename _Compare> typename _OutputIterator, typename _Compare>
_GLIBCXX20_CONSTEXPR
inline _OutputIterator inline _OutputIterator
set_intersection(_InputIterator1 __first1, _InputIterator1 __last1, set_intersection(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _InputIterator2 __first2, _InputIterator2 __last2,
...@@ -5358,6 +5457,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -5358,6 +5457,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
template<typename _InputIterator1, typename _InputIterator2, template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator, typename _OutputIterator,
typename _Compare> typename _Compare>
_GLIBCXX20_CONSTEXPR
_OutputIterator _OutputIterator
__set_difference(_InputIterator1 __first1, _InputIterator1 __last1, __set_difference(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _InputIterator2 __first2, _InputIterator2 __last2,
...@@ -5402,6 +5502,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -5402,6 +5502,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/ */
template<typename _InputIterator1, typename _InputIterator2, template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator> typename _OutputIterator>
_GLIBCXX20_CONSTEXPR
inline _OutputIterator inline _OutputIterator
set_difference(_InputIterator1 __first1, _InputIterator1 __last1, set_difference(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _InputIterator2 __first2, _InputIterator2 __last2,
...@@ -5453,6 +5554,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -5453,6 +5554,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/ */
template<typename _InputIterator1, typename _InputIterator2, template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator, typename _Compare> typename _OutputIterator, typename _Compare>
_GLIBCXX20_CONSTEXPR
inline _OutputIterator inline _OutputIterator
set_difference(_InputIterator1 __first1, _InputIterator1 __last1, set_difference(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _InputIterator2 __first2, _InputIterator2 __last2,
...@@ -5482,6 +5584,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -5482,6 +5584,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
template<typename _InputIterator1, typename _InputIterator2, template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator, typename _OutputIterator,
typename _Compare> typename _Compare>
_GLIBCXX20_CONSTEXPR
_OutputIterator _OutputIterator
__set_symmetric_difference(_InputIterator1 __first1, __set_symmetric_difference(_InputIterator1 __first1,
_InputIterator1 __last1, _InputIterator1 __last1,
...@@ -5532,6 +5635,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -5532,6 +5635,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/ */
template<typename _InputIterator1, typename _InputIterator2, template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator> typename _OutputIterator>
_GLIBCXX20_CONSTEXPR
inline _OutputIterator inline _OutputIterator
set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1, set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _InputIterator2 __first2, _InputIterator2 __last2,
...@@ -5583,6 +5687,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -5583,6 +5687,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/ */
template<typename _InputIterator1, typename _InputIterator2, template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator, typename _Compare> typename _OutputIterator, typename _Compare>
_GLIBCXX20_CONSTEXPR
inline _OutputIterator inline _OutputIterator
set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1, set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _InputIterator2 __first2, _InputIterator2 __last2,
......
...@@ -77,6 +77,57 @@ namespace std _GLIBCXX_VISIBILITY(default) ...@@ -77,6 +77,57 @@ namespace std _GLIBCXX_VISIBILITY(default)
{ {
_GLIBCXX_BEGIN_NAMESPACE_VERSION _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 #if __cplusplus < 201103L
// See http://gcc.gnu.org/ml/libstdc++/2004-08/msg00167.html: in a // See http://gcc.gnu.org/ml/libstdc++/2004-08/msg00167.html: in a
// nutshell, we are partially implementing the resolution of DR 187, // nutshell, we are partially implementing the resolution of DR 187,
...@@ -276,6 +327,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -276,6 +327,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Fallback implementation of the function in bits/stl_iterator.h used to // Fallback implementation of the function in bits/stl_iterator.h used to
// remove the __normal_iterator wrapper. See copy, fill, ... // remove the __normal_iterator wrapper. See copy, fill, ...
template<typename _Iterator> template<typename _Iterator>
_GLIBCXX20_CONSTEXPR
inline _Iterator inline _Iterator
__niter_base(_Iterator __it) __niter_base(_Iterator __it)
_GLIBCXX_NOEXCEPT_IF(std::is_nothrow_copy_constructible<_Iterator>::value) _GLIBCXX_NOEXCEPT_IF(std::is_nothrow_copy_constructible<_Iterator>::value)
...@@ -285,12 +337,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -285,12 +337,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// __normal_iterator back again (this assumes that __normal_iterator // __normal_iterator back again (this assumes that __normal_iterator
// is only used to wrap random access iterators, like pointers). // is only used to wrap random access iterators, like pointers).
template<typename _From, typename _To> template<typename _From, typename _To>
_GLIBCXX20_CONSTEXPR
inline _From inline _From
__niter_wrap(_From __from, _To __res) __niter_wrap(_From __from, _To __res)
{ return __from + (__res - std::__niter_base(__from)); } { return __from + (__res - std::__niter_base(__from)); }
// No need to wrap, iterator already has the right type. // No need to wrap, iterator already has the right type.
template<typename _Iterator> template<typename _Iterator>
_GLIBCXX20_CONSTEXPR
inline _Iterator inline _Iterator
__niter_wrap(const _Iterator&, _Iterator __res) __niter_wrap(const _Iterator&, _Iterator __res)
{ return __res; } { return __res; }
...@@ -305,6 +359,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -305,6 +359,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __copy_move struct __copy_move
{ {
template<typename _II, typename _OI> template<typename _II, typename _OI>
_GLIBCXX20_CONSTEXPR
static _OI static _OI
__copy_m(_II __first, _II __last, _OI __result) __copy_m(_II __first, _II __last, _OI __result)
{ {
...@@ -319,6 +374,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -319,6 +374,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __copy_move<true, false, _Category> struct __copy_move<true, false, _Category>
{ {
template<typename _II, typename _OI> template<typename _II, typename _OI>
_GLIBCXX20_CONSTEXPR
static _OI static _OI
__copy_m(_II __first, _II __last, _OI __result) __copy_m(_II __first, _II __last, _OI __result)
{ {
...@@ -333,6 +389,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -333,6 +389,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __copy_move<false, false, random_access_iterator_tag> struct __copy_move<false, false, random_access_iterator_tag>
{ {
template<typename _II, typename _OI> template<typename _II, typename _OI>
_GLIBCXX20_CONSTEXPR
static _OI static _OI
__copy_m(_II __first, _II __last, _OI __result) __copy_m(_II __first, _II __last, _OI __result)
{ {
...@@ -352,6 +409,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -352,6 +409,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __copy_move<true, false, random_access_iterator_tag> struct __copy_move<true, false, random_access_iterator_tag>
{ {
template<typename _II, typename _OI> template<typename _II, typename _OI>
_GLIBCXX20_CONSTEXPR
static _OI static _OI
__copy_m(_II __first, _II __last, _OI __result) __copy_m(_II __first, _II __last, _OI __result)
{ {
...@@ -371,6 +429,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -371,6 +429,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __copy_move<_IsMove, true, random_access_iterator_tag> struct __copy_move<_IsMove, true, random_access_iterator_tag>
{ {
template<typename _Tp> template<typename _Tp>
_GLIBCXX20_CONSTEXPR
static _Tp* static _Tp*
__copy_m(const _Tp* __first, const _Tp* __last, _Tp* __result) __copy_m(const _Tp* __first, const _Tp* __last, _Tp* __result)
{ {
...@@ -383,12 +442,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -383,12 +442,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif #endif
const ptrdiff_t _Num = __last - __first; const ptrdiff_t _Num = __last - __first;
if (_Num) if (_Num)
__builtin_memmove(__result, __first, sizeof(_Tp) * _Num); std::__memmove<_IsMove>(__result, __first, _Num);
return __result + _Num; return __result + _Num;
} }
}; };
template<bool _IsMove, typename _II, typename _OI> template<bool _IsMove, typename _II, typename _OI>
_GLIBCXX20_CONSTEXPR
inline _OI inline _OI
__copy_move_a(_II __first, _II __last, _OI __result) __copy_move_a(_II __first, _II __last, _OI __result)
{ {
...@@ -399,7 +459,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -399,7 +459,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
&& __is_pointer<_II>::__value && __is_pointer<_II>::__value
&& __is_pointer<_OI>::__value && __is_pointer<_OI>::__value
&& __are_same<_ValueTypeI, _ValueTypeO>::__value); && __are_same<_ValueTypeI, _ValueTypeO>::__value);
return std::__copy_move<_IsMove, __simple, return std::__copy_move<_IsMove, __simple,
_Category>::__copy_m(__first, __last, __result); _Category>::__copy_m(__first, __last, __result);
} }
...@@ -434,6 +493,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -434,6 +493,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
istreambuf_iterator<_CharT, char_traits<_CharT> >, _CharT*); istreambuf_iterator<_CharT, char_traits<_CharT> >, _CharT*);
template<bool _IsMove, typename _II, typename _OI> template<bool _IsMove, typename _II, typename _OI>
_GLIBCXX20_CONSTEXPR
inline _OI inline _OI
__copy_move_a2(_II __first, _II __last, _OI __result) __copy_move_a2(_II __first, _II __last, _OI __result)
{ {
...@@ -461,6 +521,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -461,6 +521,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* within [first,last). * within [first,last).
*/ */
template<typename _II, typename _OI> template<typename _II, typename _OI>
_GLIBCXX20_CONSTEXPR
inline _OI inline _OI
copy(_II __first, _II __last, _OI __result) copy(_II __first, _II __last, _OI __result)
{ {
...@@ -493,6 +554,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -493,6 +554,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* within [first,last). * within [first,last).
*/ */
template<typename _II, typename _OI> template<typename _II, typename _OI>
_GLIBCXX20_CONSTEXPR
inline _OI inline _OI
move(_II __first, _II __last, _OI __result) move(_II __first, _II __last, _OI __result)
{ {
...@@ -515,6 +577,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -515,6 +577,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __copy_move_backward struct __copy_move_backward
{ {
template<typename _BI1, typename _BI2> template<typename _BI1, typename _BI2>
_GLIBCXX20_CONSTEXPR
static _BI2 static _BI2
__copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result) __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
{ {
...@@ -529,6 +592,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -529,6 +592,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __copy_move_backward<true, false, _Category> struct __copy_move_backward<true, false, _Category>
{ {
template<typename _BI1, typename _BI2> template<typename _BI1, typename _BI2>
_GLIBCXX20_CONSTEXPR
static _BI2 static _BI2
__copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result) __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
{ {
...@@ -543,11 +607,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -543,11 +607,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __copy_move_backward<false, false, random_access_iterator_tag> struct __copy_move_backward<false, false, random_access_iterator_tag>
{ {
template<typename _BI1, typename _BI2> template<typename _BI1, typename _BI2>
_GLIBCXX20_CONSTEXPR
static _BI2 static _BI2
__copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result) __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
{ {
typename iterator_traits<_BI1>::difference_type __n; typename iterator_traits<_BI1>::difference_type
for (__n = __last - __first; __n > 0; --__n) __n = __last - __first;
for (; __n > 0; --__n)
*--__result = *--__last; *--__result = *--__last;
return __result; return __result;
} }
...@@ -558,11 +624,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -558,11 +624,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __copy_move_backward<true, false, random_access_iterator_tag> struct __copy_move_backward<true, false, random_access_iterator_tag>
{ {
template<typename _BI1, typename _BI2> template<typename _BI1, typename _BI2>
_GLIBCXX20_CONSTEXPR
static _BI2 static _BI2
__copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result) __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
{ {
typename iterator_traits<_BI1>::difference_type __n; typename iterator_traits<_BI1>::difference_type
for (__n = __last - __first; __n > 0; --__n) __n = __last - __first;
for (; __n > 0; --__n)
*--__result = std::move(*--__last); *--__result = std::move(*--__last);
return __result; return __result;
} }
...@@ -573,6 +641,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -573,6 +641,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __copy_move_backward<_IsMove, true, random_access_iterator_tag> struct __copy_move_backward<_IsMove, true, random_access_iterator_tag>
{ {
template<typename _Tp> template<typename _Tp>
_GLIBCXX20_CONSTEXPR
static _Tp* static _Tp*
__copy_move_b(const _Tp* __first, const _Tp* __last, _Tp* __result) __copy_move_b(const _Tp* __first, const _Tp* __last, _Tp* __result)
{ {
...@@ -585,12 +654,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -585,12 +654,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif #endif
const ptrdiff_t _Num = __last - __first; const ptrdiff_t _Num = __last - __first;
if (_Num) if (_Num)
__builtin_memmove(__result - _Num, __first, sizeof(_Tp) * _Num); std::__memmove<_IsMove>(__result - _Num, __first, _Num);
return __result - _Num; return __result - _Num;
} }
}; };
template<bool _IsMove, typename _BI1, typename _BI2> template<bool _IsMove, typename _BI1, typename _BI2>
_GLIBCXX20_CONSTEXPR
inline _BI2 inline _BI2
__copy_move_backward_a(_BI1 __first, _BI1 __last, _BI2 __result) __copy_move_backward_a(_BI1 __first, _BI1 __last, _BI2 __result)
{ {
...@@ -602,6 +672,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -602,6 +672,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
&& __is_pointer<_BI2>::__value && __is_pointer<_BI2>::__value
&& __are_same<_ValueType1, _ValueType2>::__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, return std::__copy_move_backward<_IsMove, __simple,
_Category>::__copy_move_b(__first, _Category>::__copy_move_b(__first,
__last, __last,
...@@ -609,6 +685,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -609,6 +685,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
template<bool _IsMove, typename _BI1, typename _BI2> template<bool _IsMove, typename _BI1, typename _BI2>
_GLIBCXX20_CONSTEXPR
inline _BI2 inline _BI2
__copy_move_backward_a2(_BI1 __first, _BI1 __last, _BI2 __result) __copy_move_backward_a2(_BI1 __first, _BI1 __last, _BI2 __result)
{ {
...@@ -637,6 +714,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -637,6 +714,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* that the start of the output range may overlap [first,last). * that the start of the output range may overlap [first,last).
*/ */
template<typename _BI1, typename _BI2> template<typename _BI1, typename _BI2>
_GLIBCXX20_CONSTEXPR
inline _BI2 inline _BI2
copy_backward(_BI1 __first, _BI1 __last, _BI2 __result) copy_backward(_BI1 __first, _BI1 __last, _BI2 __result)
{ {
...@@ -672,6 +750,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -672,6 +750,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* that the start of the output range may overlap [first,last). * that the start of the output range may overlap [first,last).
*/ */
template<typename _BI1, typename _BI2> template<typename _BI1, typename _BI2>
_GLIBCXX20_CONSTEXPR
inline _BI2 inline _BI2
move_backward(_BI1 __first, _BI1 __last, _BI2 __result) move_backward(_BI1 __first, _BI1 __last, _BI2 __result)
{ {
...@@ -694,6 +773,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -694,6 +773,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif #endif
template<typename _ForwardIterator, typename _Tp> template<typename _ForwardIterator, typename _Tp>
_GLIBCXX20_CONSTEXPR
inline typename inline typename
__gnu_cxx::__enable_if<!__is_scalar<_Tp>::__value, void>::__type __gnu_cxx::__enable_if<!__is_scalar<_Tp>::__value, void>::__type
__fill_a(_ForwardIterator __first, _ForwardIterator __last, __fill_a(_ForwardIterator __first, _ForwardIterator __last,
...@@ -704,6 +784,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -704,6 +784,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
template<typename _ForwardIterator, typename _Tp> template<typename _ForwardIterator, typename _Tp>
_GLIBCXX20_CONSTEXPR
inline typename inline typename
__gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type
__fill_a(_ForwardIterator __first, _ForwardIterator __last, __fill_a(_ForwardIterator __first, _ForwardIterator __last,
...@@ -738,6 +819,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -738,6 +819,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* to @c memset or @c wmemset. * to @c memset or @c wmemset.
*/ */
template<typename _ForwardIterator, typename _Tp> template<typename _ForwardIterator, typename _Tp>
_GLIBCXX20_CONSTEXPR
inline void inline void
fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
{ {
...@@ -801,6 +883,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -801,6 +883,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif #endif
template<typename _OutputIterator, typename _Size, typename _Tp> template<typename _OutputIterator, typename _Size, typename _Tp>
_GLIBCXX20_CONSTEXPR
inline typename inline typename
__gnu_cxx::__enable_if<!__is_scalar<_Tp>::__value, _OutputIterator>::__type __gnu_cxx::__enable_if<!__is_scalar<_Tp>::__value, _OutputIterator>::__type
__fill_n_a(_OutputIterator __first, _Size __n, const _Tp& __value) __fill_n_a(_OutputIterator __first, _Size __n, const _Tp& __value)
...@@ -814,6 +897,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -814,6 +897,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
template<typename _OutputIterator, typename _Size, typename _Tp> template<typename _OutputIterator, typename _Size, typename _Tp>
_GLIBCXX20_CONSTEXPR
inline typename inline typename
__gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, _OutputIterator>::__type __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, _OutputIterator>::__type
__fill_n_a(_OutputIterator __first, _Size __n, const _Tp& __value) __fill_n_a(_OutputIterator __first, _Size __n, const _Tp& __value)
...@@ -828,6 +912,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -828,6 +912,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
template<typename _Size, typename _Tp> template<typename _Size, typename _Tp>
_GLIBCXX20_CONSTEXPR
inline typename inline typename
__gnu_cxx::__enable_if<__is_byte<_Tp>::__value, _Tp*>::__type __gnu_cxx::__enable_if<__is_byte<_Tp>::__value, _Tp*>::__type
__fill_n_a(_Tp* __first, _Size __n, const _Tp& __c) __fill_n_a(_Tp* __first, _Size __n, const _Tp& __c)
...@@ -854,6 +939,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -854,6 +939,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// DR 865. More algorithms that throw away information // DR 865. More algorithms that throw away information
// DR 426. search_n(), fill_n(), and generate_n() with negative n // DR 426. search_n(), fill_n(), and generate_n() with negative n
template<typename _OI, typename _Size, typename _Tp> template<typename _OI, typename _Size, typename _Tp>
_GLIBCXX20_CONSTEXPR
inline _OI inline _OI
fill_n(_OI __first, _Size __n, const _Tp& __value) fill_n(_OI __first, _Size __n, const _Tp& __value)
{ {
...@@ -870,6 +956,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -870,6 +956,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __equal struct __equal
{ {
template<typename _II1, typename _II2> template<typename _II1, typename _II2>
_GLIBCXX20_CONSTEXPR
static bool static bool
equal(_II1 __first1, _II1 __last1, _II2 __first2) equal(_II1 __first1, _II1 __last1, _II2 __first2)
{ {
...@@ -884,16 +971,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -884,16 +971,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __equal<true> struct __equal<true>
{ {
template<typename _Tp> template<typename _Tp>
_GLIBCXX20_CONSTEXPR
static bool static bool
equal(const _Tp* __first1, const _Tp* __last1, const _Tp* __first2) equal(const _Tp* __first1, const _Tp* __last1, const _Tp* __first2)
{ {
if (const size_t __len = (__last1 - __first1)) if (const size_t __len = (__last1 - __first1))
return !__builtin_memcmp(__first1, __first2, sizeof(_Tp) * __len); return !std::__memcmp(__first1, __first2, __len);
return true; return true;
} }
}; };
template<typename _II1, typename _II2> template<typename _II1, typename _II2>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
__equal_aux(_II1 __first1, _II1 __last1, _II2 __first2) __equal_aux(_II1 __first1, _II1 __last1, _II2 __first2)
{ {
...@@ -912,11 +1001,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -912,11 +1001,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __lc_rai struct __lc_rai
{ {
template<typename _II1, typename _II2> template<typename _II1, typename _II2>
_GLIBCXX20_CONSTEXPR
static _II1 static _II1
__newlast1(_II1, _II1 __last1, _II2, _II2) __newlast1(_II1, _II1 __last1, _II2, _II2)
{ return __last1; } { return __last1; }
template<typename _II> template<typename _II>
_GLIBCXX20_CONSTEXPR
static bool static bool
__cnd2(_II __first, _II __last) __cnd2(_II __first, _II __last)
{ return __first != __last; } { return __first != __last; }
...@@ -926,6 +1017,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -926,6 +1017,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __lc_rai<random_access_iterator_tag, random_access_iterator_tag> struct __lc_rai<random_access_iterator_tag, random_access_iterator_tag>
{ {
template<typename _RAI1, typename _RAI2> template<typename _RAI1, typename _RAI2>
_GLIBCXX20_CONSTEXPR
static _RAI1 static _RAI1
__newlast1(_RAI1 __first1, _RAI1 __last1, __newlast1(_RAI1 __first1, _RAI1 __last1,
_RAI2 __first2, _RAI2 __last2) _RAI2 __first2, _RAI2 __last2)
...@@ -938,12 +1030,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -938,12 +1030,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
template<typename _RAI> template<typename _RAI>
static bool static _GLIBCXX20_CONSTEXPR bool
__cnd2(_RAI, _RAI) __cnd2(_RAI, _RAI)
{ return true; } { return true; }
}; };
template<typename _II1, typename _II2, typename _Compare> template<typename _II1, typename _II2, typename _Compare>
_GLIBCXX20_CONSTEXPR
bool bool
__lexicographical_compare_impl(_II1 __first1, _II1 __last1, __lexicographical_compare_impl(_II1 __first1, _II1 __last1,
_II2 __first2, _II2 __last2, _II2 __first2, _II2 __last2,
...@@ -969,11 +1062,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -969,11 +1062,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __lexicographical_compare struct __lexicographical_compare
{ {
template<typename _II1, typename _II2> template<typename _II1, typename _II2>
_GLIBCXX20_CONSTEXPR
static bool __lc(_II1, _II1, _II2, _II2); static bool __lc(_II1, _II1, _II2, _II2);
}; };
template<bool _BoolType> template<bool _BoolType>
template<typename _II1, typename _II2> template<typename _II1, typename _II2>
_GLIBCXX20_CONSTEXPR
bool bool
__lexicographical_compare<_BoolType>:: __lexicographical_compare<_BoolType>::
__lc(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2) __lc(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2)
...@@ -987,6 +1082,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -987,6 +1082,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __lexicographical_compare<true> struct __lexicographical_compare<true>
{ {
template<typename _Tp, typename _Up> template<typename _Tp, typename _Up>
_GLIBCXX20_CONSTEXPR
static bool static bool
__lc(const _Tp* __first1, const _Tp* __last1, __lc(const _Tp* __first1, const _Tp* __last1,
const _Up* __first2, const _Up* __last2) const _Up* __first2, const _Up* __last2)
...@@ -994,13 +1090,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -994,13 +1090,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
const size_t __len1 = __last1 - __first1; const size_t __len1 = __last1 - __first1;
const size_t __len2 = __last2 - __first2; const size_t __len2 = __last2 - __first2;
if (const size_t __len = std::min(__len1, __len2)) 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 __result < 0;
return __len1 < __len2; return __len1 < __len2;
} }
}; };
template<typename _II1, typename _II2> template<typename _II1, typename _II2>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
__lexicographical_compare_aux(_II1 __first1, _II1 __last1, __lexicographical_compare_aux(_II1 __first1, _II1 __last1,
_II2 __first2, _II2 __last2) _II2 __first2, _II2 __last2)
...@@ -1019,6 +1116,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1019,6 +1116,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
template<typename _ForwardIterator, typename _Tp, typename _Compare> template<typename _ForwardIterator, typename _Tp, typename _Compare>
_GLIBCXX20_CONSTEXPR
_ForwardIterator _ForwardIterator
__lower_bound(_ForwardIterator __first, _ForwardIterator __last, __lower_bound(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val, _Compare __comp) const _Tp& __val, _Compare __comp)
...@@ -1057,6 +1155,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1057,6 +1155,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @ingroup binary_search_algorithms * @ingroup binary_search_algorithms
*/ */
template<typename _ForwardIterator, typename _Tp> template<typename _ForwardIterator, typename _Tp>
_GLIBCXX20_CONSTEXPR
inline _ForwardIterator inline _ForwardIterator
lower_bound(_ForwardIterator __first, _ForwardIterator __last, lower_bound(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val) const _Tp& __val)
...@@ -1112,6 +1211,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -1112,6 +1211,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* ranges are equal. * ranges are equal.
*/ */
template<typename _II1, typename _II2> template<typename _II1, typename _II2>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
equal(_II1 __first1, _II1 __last1, _II2 __first2) equal(_II1 __first1, _II1 __last1, _II2 __first2)
{ {
...@@ -1144,6 +1244,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -1144,6 +1244,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* ranges are equal. * ranges are equal.
*/ */
template<typename _IIter1, typename _IIter2, typename _BinaryPredicate> template<typename _IIter1, typename _IIter2, typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
equal(_IIter1 __first1, _IIter1 __last1, equal(_IIter1 __first1, _IIter1 __last1,
_IIter2 __first2, _BinaryPredicate __binary_pred) _IIter2 __first2, _BinaryPredicate __binary_pred)
...@@ -1162,6 +1263,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -1162,6 +1263,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
// 4-iterator version of std::equal<It1, It2> for use in C++11. // 4-iterator version of std::equal<It1, It2> for use in C++11.
template<typename _II1, typename _II2> template<typename _II1, typename _II2>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
__equal4(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2) __equal4(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2)
{ {
...@@ -1187,6 +1289,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -1187,6 +1289,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
// 4-iterator version of std::equal<It1, It2, BinaryPred> for use in C++11. // 4-iterator version of std::equal<It1, It2, BinaryPred> for use in C++11.
template<typename _II1, typename _II2, typename _BinaryPredicate> template<typename _II1, typename _II2, typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
__equal4(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2, __equal4(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2,
_BinaryPredicate __binary_pred) _BinaryPredicate __binary_pred)
...@@ -1231,6 +1334,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -1231,6 +1334,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* ranges are equal. * ranges are equal.
*/ */
template<typename _II1, typename _II2> template<typename _II1, typename _II2>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
equal(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2) equal(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2)
{ {
...@@ -1263,6 +1367,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -1263,6 +1367,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* ranges are equal. * ranges are equal.
*/ */
template<typename _IIter1, typename _IIter2, typename _BinaryPredicate> template<typename _IIter1, typename _IIter2, typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
equal(_IIter1 __first1, _IIter1 __last1, equal(_IIter1 __first1, _IIter1 __last1,
_IIter2 __first2, _IIter2 __last2, _BinaryPredicate __binary_pred) _IIter2 __first2, _IIter2 __last2, _BinaryPredicate __binary_pred)
...@@ -1294,6 +1399,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -1294,6 +1399,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* then this is an inline call to @c memcmp. * then this is an inline call to @c memcmp.
*/ */
template<typename _II1, typename _II2> template<typename _II1, typename _II2>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
lexicographical_compare(_II1 __first1, _II1 __last1, lexicographical_compare(_II1 __first1, _II1 __last1,
_II2 __first2, _II2 __last2) _II2 __first2, _II2 __last2)
...@@ -1330,6 +1436,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -1330,6 +1436,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* comp parameter instead of @c <. * comp parameter instead of @c <.
*/ */
template<typename _II1, typename _II2, typename _Compare> template<typename _II1, typename _II2, typename _Compare>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
lexicographical_compare(_II1 __first1, _II1 __last1, lexicographical_compare(_II1 __first1, _II1 __last1,
_II2 __first2, _II2 __last2, _Compare __comp) _II2 __first2, _II2 __last2, _Compare __comp)
...@@ -1347,6 +1454,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -1347,6 +1454,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
template<typename _InputIterator1, typename _InputIterator2, template<typename _InputIterator1, typename _InputIterator2,
typename _BinaryPredicate> typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
pair<_InputIterator1, _InputIterator2> pair<_InputIterator1, _InputIterator2>
__mismatch(_InputIterator1 __first1, _InputIterator1 __last1, __mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _BinaryPredicate __binary_pred) _InputIterator2 __first2, _BinaryPredicate __binary_pred)
...@@ -1373,6 +1481,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -1373,6 +1481,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* to by the iterators are not equal. * to by the iterators are not equal.
*/ */
template<typename _InputIterator1, typename _InputIterator2> template<typename _InputIterator1, typename _InputIterator2>
_GLIBCXX20_CONSTEXPR
inline pair<_InputIterator1, _InputIterator2> inline pair<_InputIterator1, _InputIterator2>
mismatch(_InputIterator1 __first1, _InputIterator1 __last1, mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2) _InputIterator2 __first2)
...@@ -1407,6 +1516,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -1407,6 +1516,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/ */
template<typename _InputIterator1, typename _InputIterator2, template<typename _InputIterator1, typename _InputIterator2,
typename _BinaryPredicate> typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
inline pair<_InputIterator1, _InputIterator2> inline pair<_InputIterator1, _InputIterator2>
mismatch(_InputIterator1 __first1, _InputIterator1 __last1, mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _BinaryPredicate __binary_pred) _InputIterator2 __first2, _BinaryPredicate __binary_pred)
...@@ -1424,6 +1534,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -1424,6 +1534,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
template<typename _InputIterator1, typename _InputIterator2, template<typename _InputIterator1, typename _InputIterator2,
typename _BinaryPredicate> typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
pair<_InputIterator1, _InputIterator2> pair<_InputIterator1, _InputIterator2>
__mismatch(_InputIterator1 __first1, _InputIterator1 __last1, __mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _InputIterator2 __first2, _InputIterator2 __last2,
...@@ -1453,6 +1564,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -1453,6 +1564,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* to by the iterators are not equal. * to by the iterators are not equal.
*/ */
template<typename _InputIterator1, typename _InputIterator2> template<typename _InputIterator1, typename _InputIterator2>
_GLIBCXX20_CONSTEXPR
inline pair<_InputIterator1, _InputIterator2> inline pair<_InputIterator1, _InputIterator2>
mismatch(_InputIterator1 __first1, _InputIterator1 __last1, mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2) _InputIterator2 __first2, _InputIterator2 __last2)
...@@ -1489,6 +1601,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -1489,6 +1601,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/ */
template<typename _InputIterator1, typename _InputIterator2, template<typename _InputIterator1, typename _InputIterator2,
typename _BinaryPredicate> typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
inline pair<_InputIterator1, _InputIterator2> inline pair<_InputIterator1, _InputIterator2>
mismatch(_InputIterator1 __first1, _InputIterator1 __last1, mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _InputIterator2 __first2, _InputIterator2 __last2,
......
...@@ -70,6 +70,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -70,6 +70,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _RandomAccessIterator, typename _Distance, template<typename _RandomAccessIterator, typename _Distance,
typename _Compare> typename _Compare>
_GLIBCXX20_CONSTEXPR
_Distance _Distance
__is_heap_until(_RandomAccessIterator __first, _Distance __n, __is_heap_until(_RandomAccessIterator __first, _Distance __n,
_Compare& __comp) _Compare& __comp)
...@@ -88,6 +89,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -88,6 +89,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// __is_heap, a predicate testing whether or not a range is a heap. // __is_heap, a predicate testing whether or not a range is a heap.
// This function is an extension, not part of the C++ standard. // This function is an extension, not part of the C++ standard.
template<typename _RandomAccessIterator, typename _Distance> template<typename _RandomAccessIterator, typename _Distance>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
__is_heap(_RandomAccessIterator __first, _Distance __n) __is_heap(_RandomAccessIterator __first, _Distance __n)
{ {
...@@ -97,6 +99,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -97,6 +99,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _RandomAccessIterator, typename _Compare, template<typename _RandomAccessIterator, typename _Compare,
typename _Distance> typename _Distance>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
__is_heap(_RandomAccessIterator __first, _Compare __comp, _Distance __n) __is_heap(_RandomAccessIterator __first, _Compare __comp, _Distance __n)
{ {
...@@ -106,11 +109,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -106,11 +109,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
template<typename _RandomAccessIterator> template<typename _RandomAccessIterator>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
__is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) __is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
{ return std::__is_heap(__first, std::distance(__first, __last)); } { return std::__is_heap(__first, std::distance(__first, __last)); }
template<typename _RandomAccessIterator, typename _Compare> template<typename _RandomAccessIterator, typename _Compare>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
__is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, __is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
_Compare __comp) _Compare __comp)
...@@ -473,6 +478,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -473,6 +478,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* the range [__first, i) is a heap. * the range [__first, i) is a heap.
*/ */
template<typename _RandomAccessIterator> template<typename _RandomAccessIterator>
_GLIBCXX20_CONSTEXPR
inline _RandomAccessIterator inline _RandomAccessIterator
is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last) is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last)
{ {
...@@ -501,6 +507,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -501,6 +507,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* the range [__first, i) is a heap. Comparisons are made using __comp. * the range [__first, i) is a heap. Comparisons are made using __comp.
*/ */
template<typename _RandomAccessIterator, typename _Compare> template<typename _RandomAccessIterator, typename _Compare>
_GLIBCXX20_CONSTEXPR
inline _RandomAccessIterator inline _RandomAccessIterator
is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last,
_Compare __comp) _Compare __comp)
...@@ -525,6 +532,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -525,6 +532,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @ingroup heap_algorithms * @ingroup heap_algorithms
*/ */
template<typename _RandomAccessIterator> template<typename _RandomAccessIterator>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
{ return std::is_heap_until(__first, __last) == __last; } { return std::is_heap_until(__first, __last) == __last; }
...@@ -538,6 +546,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -538,6 +546,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @ingroup heap_algorithms * @ingroup heap_algorithms
*/ */
template<typename _RandomAccessIterator, typename _Compare> template<typename _RandomAccessIterator, typename _Compare>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
_Compare __comp) _Compare __comp)
......
...@@ -446,7 +446,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -446,7 +446,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
template<typename _Iterator> template<typename _Iterator>
auto _GLIBCXX20_CONSTEXPR auto
__niter_base(reverse_iterator<_Iterator> __it) __niter_base(reverse_iterator<_Iterator> __it)
-> decltype(__make_reverse_iterator(__niter_base(__it.base()))) -> decltype(__make_reverse_iterator(__niter_base(__it.base())))
{ return __make_reverse_iterator(__niter_base(__it.base())); } { return __make_reverse_iterator(__niter_base(__it.base())); }
...@@ -457,7 +457,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -457,7 +457,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ }; { };
template<typename _Iterator> template<typename _Iterator>
auto _GLIBCXX20_CONSTEXPR auto
__miter_base(reverse_iterator<_Iterator> __it) __miter_base(reverse_iterator<_Iterator> __it)
-> decltype(__make_reverse_iterator(__miter_base(__it.base()))) -> decltype(__make_reverse_iterator(__miter_base(__it.base())))
{ return __make_reverse_iterator(__miter_base(__it.base())); } { return __make_reverse_iterator(__miter_base(__it.base())); }
......
...@@ -248,16 +248,19 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -248,16 +248,19 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
// Array comparisons. // Array comparisons.
template<typename _Tp, std::size_t _Nm> template<typename _Tp, std::size_t _Nm>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return std::equal(__one.begin(), __one.end(), __two.begin()); } { return std::equal(__one.begin(), __one.end(), __two.begin()); }
template<typename _Tp, std::size_t _Nm> template<typename _Tp, std::size_t _Nm>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
operator!=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) operator!=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one == __two); } { return !(__one == __two); }
template<typename _Tp, std::size_t _Nm> template<typename _Tp, std::size_t _Nm>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
operator<(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b) operator<(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b)
{ {
...@@ -266,16 +269,19 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -266,16 +269,19 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
} }
template<typename _Tp, std::size_t _Nm> template<typename _Tp, std::size_t _Nm>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
operator>(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) operator>(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return __two < __one; } { return __two < __one; }
template<typename _Tp, std::size_t _Nm> template<typename _Tp, std::size_t _Nm>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
operator<=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) operator<=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one > __two); } { return !(__one > __two); }
template<typename _Tp, std::size_t _Nm> template<typename _Tp, std::size_t _Nm>
_GLIBCXX20_CONSTEXPR
inline bool inline bool
operator>=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) operator>=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one < __two); } { return !(__one < __two); }
...@@ -289,6 +295,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -289,6 +295,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_GLIBCXX_STD_C::__array_traits<_Tp, _Nm>::_Is_swappable::value _GLIBCXX_STD_C::__array_traits<_Tp, _Nm>::_Is_swappable::value
>::type >::type
#else #else
_GLIBCXX20_CONSTEXPR
void void
#endif #endif
swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two) swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two)
......
...@@ -280,11 +280,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -280,11 +280,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#define __cpp_lib_exchange_function 201304 #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. /// Assign @p __new_val to @p __obj and return its previous value.
template <typename _Tp, typename _Up = _Tp> template <typename _Tp, typename _Up = _Tp>
_GLIBCXX20_CONSTEXPR
inline _Tp inline _Tp
exchange(_Tp& __obj, _Up&& __new_val) exchange(_Tp& __obj, _Up&& __new_val)
{ return std::__exchange(__obj, std::forward<_Up>(__new_val)); } { return std::__exchange(__obj, std::forward<_Up>(__new_val)); }
#endif #endif
// Stores a tuple of indices. Used by tuple and pair, and by bind() to // Stores a tuple of indices. Used by tuple and pair, and by bind() to
......
...@@ -164,6 +164,7 @@ ...@@ -164,6 +164,7 @@
#endif #endif
#define __cpp_lib_list_remove_return_type 201806L #define __cpp_lib_list_remove_return_type 201806L
#define __cpp_lib_math_constants 201907L #define __cpp_lib_math_constants 201907L
#define __cpp_lib_constexpr_algorithms 201711L
#endif // C++2a #endif // C++2a
#endif // C++17 #endif // C++17
#endif // C++14 #endif // C++14
......
// 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());
// { 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);
...@@ -27,6 +27,6 @@ int n1 = std::get<1>(a); ...@@ -27,6 +27,6 @@ int n1 = std::get<1>(a);
int n2 = std::get<1>(std::move(a)); int n2 = std::get<1>(std::move(a));
int n3 = std::get<1>(ca); int n3 = std::get<1>(ca);
// { dg-error "static assertion failed" "" { target *-*-* } 309 } // { dg-error "static assertion failed" "" { target *-*-* } 316 }
// { dg-error "static assertion failed" "" { target *-*-* } 318 } // { dg-error "static assertion failed" "" { target *-*-* } 325 }
// { dg-error "static assertion failed" "" { target *-*-* } 326 } // { dg-error "static assertion failed" "" { target *-*-* } 333 }
...@@ -22,4 +22,4 @@ ...@@ -22,4 +22,4 @@
typedef std::tuple_element<1, std::array<int, 1>>::type type; 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 }
// 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());
// 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());
// 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());
// 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());
// 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
...@@ -36,6 +36,7 @@ void ...@@ -36,6 +36,7 @@ void
test01(T* result) test01(T* result)
{ {
T t[1]; 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 "not assignable" }
// { dg-prune-output "use of deleted" }
// 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());
...@@ -37,3 +37,4 @@ test01() ...@@ -37,3 +37,4 @@ test01()
trivial_rvalstruct a[1], b[1]; trivial_rvalstruct a[1], b[1];
copy(std::make_move_iterator(a), std::make_move_iterator(a + 1), b); copy(std::make_move_iterator(a), std::make_move_iterator(a + 1), b);
} }
// { dg-prune-output "use of deleted" }
// 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());
...@@ -37,3 +37,4 @@ test01() ...@@ -37,3 +37,4 @@ test01()
trivial_rvalstruct a[1], b[1]; trivial_rvalstruct a[1], b[1];
copy_backward(std::make_move_iterator(a), std::make_move_iterator(a+1), b); copy_backward(std::make_move_iterator(a), std::make_move_iterator(a+1), b);
} }
// { dg-prune-output "use of deleted" }
// 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());
...@@ -36,6 +36,7 @@ void ...@@ -36,6 +36,7 @@ void
test01(T* result) test01(T* result)
{ {
T t[1]; 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 "not assignable" }
// { dg-prune-output "use of deleted" }
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
...@@ -23,115 +23,142 @@ namespace std ...@@ -23,115 +23,142 @@ namespace std
{ {
// 25.1, non-modifying sequence operations: // 25.1, non-modifying sequence operations:
template<typename _IIter, typename _Funct> template<typename _IIter, typename _Funct>
_GLIBCXX20_CONSTEXPR
_Funct _Funct
for_each(_IIter, _IIter, _Funct); for_each(_IIter, _IIter, _Funct);
template<typename _IIter, typename _Tp> template<typename _IIter, typename _Tp>
_GLIBCXX20_CONSTEXPR
_IIter _IIter
find(_IIter, _IIter, const _Tp&); find(_IIter, _IIter, const _Tp&);
template<typename _IIter, typename _Predicate> template<typename _IIter, typename _Predicate>
_GLIBCXX20_CONSTEXPR
_IIter _IIter
find_if(_IIter, _IIter, _Predicate); find_if(_IIter, _IIter, _Predicate);
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
template<typename _IIter, typename _Predicate> template<typename _IIter, typename _Predicate>
_GLIBCXX20_CONSTEXPR
bool bool
all_of(_IIter, _IIter, _Predicate); all_of(_IIter, _IIter, _Predicate);
template<typename _IIter, typename _Predicate> template<typename _IIter, typename _Predicate>
_GLIBCXX20_CONSTEXPR
bool bool
any_of(_IIter, _IIter, _Predicate); any_of(_IIter, _IIter, _Predicate);
template<typename _IIter, typename _Predicate> template<typename _IIter, typename _Predicate>
_GLIBCXX20_CONSTEXPR
bool bool
none_of(_IIter, _IIter, _Predicate); none_of(_IIter, _IIter, _Predicate);
template<typename _IIter, typename _Predicate> template<typename _IIter, typename _Predicate>
_GLIBCXX20_CONSTEXPR
_IIter _IIter
find_if_not(_IIter, _IIter, _Predicate); find_if_not(_IIter, _IIter, _Predicate);
template<typename _IIter, typename _Predicate> template<typename _IIter, typename _Predicate>
_GLIBCXX20_CONSTEXPR
bool bool
is_partitioned(_IIter, _IIter, _Predicate); is_partitioned(_IIter, _IIter, _Predicate);
template<typename _FIter, typename _Predicate> template<typename _FIter, typename _Predicate>
_GLIBCXX20_CONSTEXPR
_FIter _FIter
partition_point(_FIter, _FIter, _Predicate); partition_point(_FIter, _FIter, _Predicate);
#endif #endif
template<typename _FIter1, typename _FIter2> template<typename _FIter1, typename _FIter2>
_GLIBCXX20_CONSTEXPR
_FIter1 _FIter1
find_end(_FIter1, _FIter1, _FIter2, _FIter2); find_end(_FIter1, _FIter1, _FIter2, _FIter2);
template<typename _FIter1, typename _FIter2, typename _BinaryPredicate> template<typename _FIter1, typename _FIter2, typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
_FIter1 _FIter1
find_end(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate); find_end(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate);
template<typename _FIter1, typename _FIter2> template<typename _FIter1, typename _FIter2>
_GLIBCXX20_CONSTEXPR
_FIter1 _FIter1
find_first_of(_FIter1, _FIter1, _FIter2, _FIter2); find_first_of(_FIter1, _FIter1, _FIter2, _FIter2);
template<typename _FIter1, typename _FIter2, typename _BinaryPredicate> template<typename _FIter1, typename _FIter2, typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
_FIter1 _FIter1
find_first_of(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate); find_first_of(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate);
template<typename _FIter> template<typename _FIter>
_GLIBCXX20_CONSTEXPR
_FIter _FIter
adjacent_find(_FIter, _FIter); adjacent_find(_FIter, _FIter);
template<typename _FIter, typename _BinaryPredicate> template<typename _FIter, typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
_FIter _FIter
adjacent_find(_FIter, _FIter, _BinaryPredicate); adjacent_find(_FIter, _FIter, _BinaryPredicate);
template<typename _IIter, typename _Tp> template<typename _IIter, typename _Tp>
_GLIBCXX20_CONSTEXPR
typename iterator_traits<_IIter>::difference_type typename iterator_traits<_IIter>::difference_type
count(_IIter, _IIter, const _Tp&); count(_IIter, _IIter, const _Tp&);
template<typename _IIter, typename _Predicate> template<typename _IIter, typename _Predicate>
_GLIBCXX20_CONSTEXPR
typename iterator_traits<_IIter>::difference_type typename iterator_traits<_IIter>::difference_type
count_if(_IIter, _IIter, _Predicate); count_if(_IIter, _IIter, _Predicate);
template<typename _IIter1, typename _IIter2> template<typename _IIter1, typename _IIter2>
_GLIBCXX20_CONSTEXPR
pair<_IIter1, _IIter2> pair<_IIter1, _IIter2>
mismatch(_IIter1, _IIter1, _IIter2); mismatch(_IIter1, _IIter1, _IIter2);
template<typename _IIter1, typename _IIter2, typename _BinaryPredicate> template<typename _IIter1, typename _IIter2, typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
pair<_IIter1, _IIter2> pair<_IIter1, _IIter2>
mismatch(_IIter1, _IIter1, _IIter2, _BinaryPredicate); mismatch(_IIter1, _IIter1, _IIter2, _BinaryPredicate);
template<typename _IIter1, typename _IIter2> template<typename _IIter1, typename _IIter2>
_GLIBCXX20_CONSTEXPR
bool bool
equal(_IIter1, _IIter1, _IIter2); equal(_IIter1, _IIter1, _IIter2);
template<typename _IIter1, typename _IIter2, typename _BinaryPredicate> template<typename _IIter1, typename _IIter2, typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
bool bool
equal(_IIter1, _IIter1, _IIter2, _BinaryPredicate); equal(_IIter1, _IIter1, _IIter2, _BinaryPredicate);
template<typename _FIter1, typename _FIter2> template<typename _FIter1, typename _FIter2>
_GLIBCXX20_CONSTEXPR
_FIter1 _FIter1
search(_FIter1, _FIter1, _FIter2, _FIter2); search(_FIter1, _FIter1, _FIter2, _FIter2);
template<typename _FIter1, typename _FIter2, typename _BinaryPredicate> template<typename _FIter1, typename _FIter2, typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
_FIter1 _FIter1
search(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate); search(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate);
template<typename _FIter, typename _Size, typename _Tp> template<typename _FIter, typename _Size, typename _Tp>
_GLIBCXX20_CONSTEXPR
_FIter _FIter
search_n(_FIter, _FIter, _Size, const _Tp&); search_n(_FIter, _FIter, _Size, const _Tp&);
template<typename _FIter, typename _Size, typename _Tp, template<typename _FIter, typename _Size, typename _Tp,
typename _BinaryPredicate> typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
_FIter _FIter
search_n(_FIter, _FIter, _Size, const _Tp&, _BinaryPredicate); search_n(_FIter, _FIter, _Size, const _Tp&, _BinaryPredicate);
// 25.2, modifying sequence operations: // 25.2, modifying sequence operations:
// 25.2.1, copy: // 25.2.1, copy:
template<typename _IIter, typename _OIter> template<typename _IIter, typename _OIter>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
copy(_IIter, _IIter, _OIter); copy(_IIter, _IIter, _OIter);
template<typename _BIter1, typename _BIter2> template<typename _BIter1, typename _BIter2>
_GLIBCXX20_CONSTEXPR
_BIter2 _BIter2
copy_backward (_BIter1, _BIter1, _BIter2); copy_backward (_BIter1, _BIter1, _BIter2);
...@@ -159,90 +186,111 @@ namespace std ...@@ -159,90 +186,111 @@ namespace std
iter_swap(_FIter1, _FIter2 b); iter_swap(_FIter1, _FIter2 b);
template<typename _IIter, typename _OIter, typename _UnaryOperation> template<typename _IIter, typename _OIter, typename _UnaryOperation>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
transform(_IIter, _IIter, _OIter, _UnaryOperation op); transform(_IIter, _IIter, _OIter, _UnaryOperation op);
template<typename _IIter1, typename _IIter2, typename _OIter, template<typename _IIter1, typename _IIter2, typename _OIter,
typename _BinaryOperation> typename _BinaryOperation>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation); transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation);
template<typename _FIter, typename _Tp> template<typename _FIter, typename _Tp>
_GLIBCXX20_CONSTEXPR
void void
replace(_FIter, _FIter, const _Tp&, const _Tp&); replace(_FIter, _FIter, const _Tp&, const _Tp&);
template<typename _FIter, typename _Predicate, typename _Tp> template<typename _FIter, typename _Predicate, typename _Tp>
_GLIBCXX20_CONSTEXPR
void void
replace_if(_FIter, _FIter, _Predicate, const _Tp&); replace_if(_FIter, _FIter, _Predicate, const _Tp&);
template<typename _IIter, typename _OIter, typename _Tp> template<typename _IIter, typename _OIter, typename _Tp>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
replace_copy(_IIter, _IIter, _OIter, const _Tp&, const _Tp&); replace_copy(_IIter, _IIter, _OIter, const _Tp&, const _Tp&);
template<typename _Iter, typename _OIter, typename _Predicate, typename _Tp> template<typename _Iter, typename _OIter, typename _Predicate, typename _Tp>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
replace_copy_if(_Iter, _Iter, _OIter, _Predicate, const _Tp&); replace_copy_if(_Iter, _Iter, _OIter, _Predicate, const _Tp&);
template<typename _FIter, typename _Tp> template<typename _FIter, typename _Tp>
_GLIBCXX20_CONSTEXPR
void void
fill(_FIter, _FIter, const _Tp&); fill(_FIter, _FIter, const _Tp&);
template<typename _OIter, typename _Size, typename _Tp> template<typename _OIter, typename _Size, typename _Tp>
_GLIBCXX20_CONSTEXPR
void void
fill_n(_OIter, _Size n, const _Tp&); fill_n(_OIter, _Size n, const _Tp&);
template<typename _FIter, typename _Generator> template<typename _FIter, typename _Generator>
_GLIBCXX20_CONSTEXPR
void void
generate(_FIter, _FIter, _Generator); generate(_FIter, _FIter, _Generator);
template<typename _OIter, typename _Size, typename _Generator> template<typename _OIter, typename _Size, typename _Generator>
_GLIBCXX20_CONSTEXPR
void void
generate_n(_OIter, _Size, _Generator); generate_n(_OIter, _Size, _Generator);
template<typename _FIter, typename _Tp> template<typename _FIter, typename _Tp>
_GLIBCXX20_CONSTEXPR
_FIter _FIter
remove(_FIter, _FIter, const _Tp&); remove(_FIter, _FIter, const _Tp&);
template<typename _FIter, typename _Predicate> template<typename _FIter, typename _Predicate>
_GLIBCXX20_CONSTEXPR
_FIter _FIter
remove_if(_FIter, _FIter, _Predicate); remove_if(_FIter, _FIter, _Predicate);
template<typename _IIter, typename _OIter, typename _Tp> template<typename _IIter, typename _OIter, typename _Tp>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
remove_copy(_IIter, _IIter, _OIter, const _Tp&); remove_copy(_IIter, _IIter, _OIter, const _Tp&);
template<typename _IIter, typename _OIter, typename _Predicate> template<typename _IIter, typename _OIter, typename _Predicate>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
remove_copy_if(_IIter, _IIter, _OIter, _Predicate); remove_copy_if(_IIter, _IIter, _OIter, _Predicate);
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
template<typename _IIter, typename _OIter, typename _Predicate> template<typename _IIter, typename _OIter, typename _Predicate>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
copy_if(_IIter, _IIter, _OIter, _Predicate); copy_if(_IIter, _IIter, _OIter, _Predicate);
template<typename _IIter, typename _Size, typename _OIter> template<typename _IIter, typename _Size, typename _OIter>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
copy_n(_IIter, _Size, _OIter); copy_n(_IIter, _Size, _OIter);
template<typename _IIter, typename _OIter1, template<typename _IIter, typename _OIter1,
typename _OIter2, typename _Predicate> typename _OIter2, typename _Predicate>
_GLIBCXX20_CONSTEXPR
pair<_OIter1, _OIter2> pair<_OIter1, _OIter2>
partition_copy(_IIter, _IIter, _OIter1, _OIter2, _Predicate); partition_copy(_IIter, _IIter, _OIter1, _OIter2, _Predicate);
#endif #endif
template<typename _FIter> template<typename _FIter>
_GLIBCXX20_CONSTEXPR
_FIter _FIter
unique(_FIter, _FIter); unique(_FIter, _FIter);
template<typename _FIter, typename _BinaryPredicate> template<typename _FIter, typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
_FIter _FIter
unique(_FIter, _FIter, _BinaryPredicate); unique(_FIter, _FIter, _BinaryPredicate);
template<typename _IIter, typename _OIter> template<typename _IIter, typename _OIter>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
unique_copy(_IIter, _IIter, _OIter); unique_copy(_IIter, _IIter, _OIter);
template<typename _IIter, typename _OIter, typename _BinaryPredicate> template<typename _IIter, typename _OIter, typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
unique_copy(_IIter, _IIter, _OIter, _BinaryPredicate); unique_copy(_IIter, _IIter, _OIter, _BinaryPredicate);
...@@ -251,6 +299,7 @@ namespace std ...@@ -251,6 +299,7 @@ namespace std
reverse(_BIter, _BIter); reverse(_BIter, _BIter);
template<typename _BIter, typename _OIter> template<typename _BIter, typename _OIter>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
reverse_copy(_BIter, _BIter, _OIter); reverse_copy(_BIter, _BIter, _OIter);
...@@ -259,6 +308,7 @@ namespace std ...@@ -259,6 +308,7 @@ namespace std
rotate(_FIter, _FIter, _FIter); rotate(_FIter, _FIter, _FIter);
template<typename _FIter, typename _OIter> template<typename _FIter, typename _OIter>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
rotate_copy (_FIter, _FIter, _FIter, _OIter); rotate_copy (_FIter, _FIter, _FIter, _OIter);
...@@ -323,44 +373,54 @@ namespace std ...@@ -323,44 +373,54 @@ namespace std
// 25.3.3, binary search: // 25.3.3, binary search:
template<typename _FIter, typename _Tp> template<typename _FIter, typename _Tp>
_GLIBCXX20_CONSTEXPR
_FIter _FIter
lower_bound(_FIter, _FIter, const _Tp&); lower_bound(_FIter, _FIter, const _Tp&);
template<typename _FIter, typename _Tp, typename _Compare> template<typename _FIter, typename _Tp, typename _Compare>
_GLIBCXX20_CONSTEXPR
_FIter _FIter
lower_bound(_FIter, _FIter, const _Tp&, _Compare); lower_bound(_FIter, _FIter, const _Tp&, _Compare);
template<typename _FIter, typename _Tp> template<typename _FIter, typename _Tp>
_GLIBCXX20_CONSTEXPR
_FIter _FIter
upper_bound(_FIter, _FIter, const _Tp&); upper_bound(_FIter, _FIter, const _Tp&);
template<typename _FIter, typename _Tp, typename _Compare> template<typename _FIter, typename _Tp, typename _Compare>
_GLIBCXX20_CONSTEXPR
_FIter _FIter
upper_bound(_FIter, _FIter, const _Tp&, _Compare); upper_bound(_FIter, _FIter, const _Tp&, _Compare);
template<typename _FIter, typename _Tp> template<typename _FIter, typename _Tp>
_GLIBCXX20_CONSTEXPR
pair<_FIter, _FIter> pair<_FIter, _FIter>
equal_range(_FIter, _FIter, const _Tp&); equal_range(_FIter, _FIter, const _Tp&);
template<typename _FIter, typename _Tp, typename _Compare> template<typename _FIter, typename _Tp, typename _Compare>
_GLIBCXX20_CONSTEXPR
pair<_FIter, _FIter> pair<_FIter, _FIter>
equal_range(_FIter, _FIter, const _Tp&, _Compare); equal_range(_FIter, _FIter, const _Tp&, _Compare);
template<typename _FIter, typename _Tp> template<typename _FIter, typename _Tp>
_GLIBCXX20_CONSTEXPR
bool bool
binary_search(_FIter, _FIter, const _Tp&); binary_search(_FIter, _FIter, const _Tp&);
template<typename _FIter, typename _Tp, typename _Compare> template<typename _FIter, typename _Tp, typename _Compare>
_GLIBCXX20_CONSTEXPR
bool bool
binary_search(_FIter, _FIter, const _Tp&, _Compare); binary_search(_FIter, _FIter, const _Tp&, _Compare);
// 25.3.4, merge: // 25.3.4, merge:
template<typename _IIter1, typename _IIter2, typename _OIter> template<typename _IIter1, typename _IIter2, typename _OIter>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
template<typename _IIter1, typename _IIter2, typename _OIter, template<typename _IIter1, typename _IIter2, typename _OIter,
typename _Compare> typename _Compare>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);
...@@ -374,46 +434,56 @@ namespace std ...@@ -374,46 +434,56 @@ namespace std
// 25.3.5, set operations: // 25.3.5, set operations:
template<typename _IIter1, typename _IIter2> template<typename _IIter1, typename _IIter2>
_GLIBCXX20_CONSTEXPR
bool bool
includes(_IIter1, _IIter1, _IIter2, _IIter2); includes(_IIter1, _IIter1, _IIter2, _IIter2);
template<typename _IIter1, typename _IIter2, typename _Compare> template<typename _IIter1, typename _IIter2, typename _Compare>
_GLIBCXX20_CONSTEXPR
bool bool
includes(_IIter1, _IIter1, _IIter2, _IIter2, _Compare); includes(_IIter1, _IIter1, _IIter2, _IIter2, _Compare);
template<typename _IIter1, typename _IIter2, typename _OIter> template<typename _IIter1, typename _IIter2, typename _OIter>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
template<typename _IIter1, typename _IIter2, typename _OIter, template<typename _IIter1, typename _IIter2, typename _OIter,
typename _Compare> typename _Compare>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);
template<typename _IIter1, typename _IIter2, typename _OIter> template<typename _IIter1, typename _IIter2, typename _OIter>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
template<typename _IIter1, typename _IIter2, typename _OIter, template<typename _IIter1, typename _IIter2, typename _OIter,
typename _Compare> typename _Compare>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);
template<typename _IIter1, typename _IIter2, typename _OIter> template<typename _IIter1, typename _IIter2, typename _OIter>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
template<typename _IIter1, typename _IIter2, typename _OIter, template<typename _IIter1, typename _IIter2, typename _OIter,
typename _Compare> typename _Compare>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);
template<typename _IIter1, typename _IIter2, typename _OIter> template<typename _IIter1, typename _IIter2, typename _OIter>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
template<typename _IIter1, typename _IIter2, typename _OIter, template<typename _IIter1, typename _IIter2, typename _OIter,
typename _Compare> typename _Compare>
_GLIBCXX20_CONSTEXPR
_OIter _OIter
set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2,
_OIter, _Compare); _OIter, _Compare);
...@@ -453,34 +523,42 @@ namespace std ...@@ -453,34 +523,42 @@ namespace std
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
template<typename _RAIter> template<typename _RAIter>
_GLIBCXX20_CONSTEXPR
bool bool
is_heap(_RAIter, _RAIter); is_heap(_RAIter, _RAIter);
template<typename _RAIter, typename _Compare> template<typename _RAIter, typename _Compare>
_GLIBCXX20_CONSTEXPR
bool bool
is_heap(_RAIter, _RAIter, _Compare); is_heap(_RAIter, _RAIter, _Compare);
template<typename _RAIter> template<typename _RAIter>
_GLIBCXX20_CONSTEXPR
_RAIter _RAIter
is_heap_until(_RAIter, _RAIter); is_heap_until(_RAIter, _RAIter);
template<typename _RAIter, typename _Compare> template<typename _RAIter, typename _Compare>
_GLIBCXX20_CONSTEXPR
_RAIter _RAIter
is_heap_until(_RAIter, _RAIter, _Compare); is_heap_until(_RAIter, _RAIter, _Compare);
template<typename _FIter> template<typename _FIter>
_GLIBCXX20_CONSTEXPR
bool bool
is_sorted(_FIter, _FIter); is_sorted(_FIter, _FIter);
template<typename _FIter, typename _Compare> template<typename _FIter, typename _Compare>
_GLIBCXX20_CONSTEXPR
bool bool
is_sorted(_FIter, _FIter, _Compare); is_sorted(_FIter, _FIter, _Compare);
template<typename _FIter> template<typename _FIter>
_GLIBCXX20_CONSTEXPR
_FIter _FIter
is_sorted_until(_FIter, _FIter); is_sorted_until(_FIter, _FIter);
template<typename _FIter, typename _Compare> template<typename _FIter, typename _Compare>
_GLIBCXX20_CONSTEXPR
_FIter _FIter
is_sorted_until(_FIter, _FIter, _Compare); is_sorted_until(_FIter, _FIter, _Compare);
#endif #endif
...@@ -579,10 +657,12 @@ namespace std ...@@ -579,10 +657,12 @@ namespace std
#endif #endif
template<typename _IIter1, typename _IIter2> template<typename _IIter1, typename _IIter2>
_GLIBCXX20_CONSTEXPR
bool bool
lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2); lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2);
template<typename _IIter1, typename _IIter2, typename _Compare> template<typename _IIter1, typename _IIter2, typename _Compare>
_GLIBCXX20_CONSTEXPR
bool bool
lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2, _Compare); lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2, _Compare);
......
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
...@@ -37,3 +37,4 @@ test01() ...@@ -37,3 +37,4 @@ test01()
trivial_rvalstruct a[1], b[1]; trivial_rvalstruct a[1], b[1];
std::move(a, a + 1, b); std::move(a, a + 1, b);
} }
// { dg-prune-output "use of deleted" }
...@@ -37,3 +37,4 @@ test01() ...@@ -37,3 +37,4 @@ test01()
trivial_rvalstruct a[1], b[1]; trivial_rvalstruct a[1], b[1];
std::move_backward(a, a + 1, b); std::move_backward(a, a + 1, b);
} }
// { dg-prune-output "use of deleted" }
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
// 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());
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment