#ifndef _GLIBCXX_PREDEFINED_OPS_H
#define _GLIBCXX_PREDEFINED_OPS_H 1
-#include <bits/move.h>
+#include <bits/stl_function.h> // less<void>, equal_to<void>
+#if __cplusplus >= 201103L
+# include <type_traits> // is_empty, is_scalar, __conditional_t, __or_
+#else
+# include <ext/type_traits.h> // __conditional_type
+#endif
namespace __gnu_cxx
{
namespace __ops
{
- struct _Iter_less_iter
- {
- template<typename _Iterator1, typename _Iterator2>
- _GLIBCXX14_CONSTEXPR
- bool
- operator()(_Iterator1 __it1, _Iterator2 __it2) const
- { return *__it1 < *__it2; }
- };
-
- _GLIBCXX14_CONSTEXPR
- inline _Iter_less_iter
- __iter_less_iter()
- { return _Iter_less_iter(); }
-
- struct _Iter_less_val
- {
-#if __cplusplus >= 201103L
- constexpr _Iter_less_val() = default;
-#else
- _Iter_less_val() { }
-#endif
+ // These two explicit specializations are always defined by libstdc++,
+ // even when __cpp_lib_transparent_operators is not defined.
+ typedef std::equal_to<void> equal_to;
+ typedef std::less<void> less;
- _GLIBCXX20_CONSTEXPR
- explicit
- _Iter_less_val(_Iter_less_iter) { }
-
- template<typename _Iterator, typename _Value>
- _GLIBCXX20_CONSTEXPR
- bool
- operator()(_Iterator __it, _Value& __val) const
- { return *__it < __val; }
- };
-
- _GLIBCXX20_CONSTEXPR
- inline _Iter_less_val
- __iter_less_val()
- { return _Iter_less_val(); }
-
- _GLIBCXX20_CONSTEXPR
- inline _Iter_less_val
- __iter_comp_val(_Iter_less_iter)
- { return _Iter_less_val(); }
-
- struct _Val_less_iter
- {
#if __cplusplus >= 201103L
- constexpr _Val_less_iter() = default;
-#else
- _Val_less_iter() { }
-#endif
- _GLIBCXX20_CONSTEXPR
- explicit
- _Val_less_iter(_Iter_less_iter) { }
-
- template<typename _Value, typename _Iterator>
- _GLIBCXX20_CONSTEXPR
- bool
- operator()(_Value& __val, _Iterator __it) const
- { return __val < *__it; }
- };
-
- _GLIBCXX20_CONSTEXPR
- inline _Val_less_iter
- __val_less_iter()
- { return _Val_less_iter(); }
-
- _GLIBCXX20_CONSTEXPR
- inline _Val_less_iter
- __val_comp_iter(_Iter_less_iter)
- { return _Val_less_iter(); }
-
- struct _Iter_equal_to_iter
- {
- template<typename _Iterator1, typename _Iterator2>
- _GLIBCXX20_CONSTEXPR
- bool
- operator()(_Iterator1 __it1, _Iterator2 __it2) const
- { return *__it1 == *__it2; }
- };
-
- _GLIBCXX20_CONSTEXPR
- inline _Iter_equal_to_iter
- __iter_equal_to_iter()
- { return _Iter_equal_to_iter(); }
-
- struct _Iter_equal_to_val
- {
- template<typename _Iterator, typename _Value>
- _GLIBCXX20_CONSTEXPR
- bool
- operator()(_Iterator __it, _Value& __val) const
- { return *__it == __val; }
- };
-
- _GLIBCXX20_CONSTEXPR
- inline _Iter_equal_to_val
- __iter_equal_to_val()
- { return _Iter_equal_to_val(); }
-
- _GLIBCXX20_CONSTEXPR
- inline _Iter_equal_to_val
- __iter_comp_val(_Iter_equal_to_iter)
- { return _Iter_equal_to_val(); }
-
- template<typename _Compare>
- struct _Iter_comp_iter
- {
- _Compare _M_comp;
-
- explicit _GLIBCXX14_CONSTEXPR
- _Iter_comp_iter(_Compare __comp)
- : _M_comp(_GLIBCXX_MOVE(__comp))
- { }
-
- template<typename _Iterator1, typename _Iterator2>
- _GLIBCXX14_CONSTEXPR
- bool
- operator()(_Iterator1 __it1, _Iterator2 __it2)
- { return bool(_M_comp(*__it1, *__it2)); }
- };
+ template<typename _Fn>
+ using __by_ref_or_value_fn
+ = std::__conditional_t<std::__or_<std::is_empty<_Fn>,
+ std::is_scalar<_Fn>>::value,
+ _Fn, _Fn&>;
- template<typename _Compare>
- _GLIBCXX14_CONSTEXPR
- inline _Iter_comp_iter<_Compare>
- __iter_comp_iter(_Compare __comp)
- { return _Iter_comp_iter<_Compare>(_GLIBCXX_MOVE(__comp)); }
+ // More generic replacements for the deprecated utilities
+ // std::bind1st, std::bind2nd, and std::not1.
+ // These aren't fully "transparent" like std::less<void> because they
+ // do not use perfect forwarding, everything is treated as an lvalue.
- template<typename _Compare>
- struct _Iter_comp_val
+ template<typename _Func, typename _Value, bool _Val_2nd = false>
+ struct _Comp_with_val
{
- _Compare _M_comp;
-
- _GLIBCXX20_CONSTEXPR
- explicit
- _Iter_comp_val(_Compare __comp)
- : _M_comp(_GLIBCXX_MOVE(__comp))
- { }
-
- _GLIBCXX20_CONSTEXPR
- explicit
- _Iter_comp_val(const _Iter_comp_iter<_Compare>& __comp)
- : _M_comp(__comp._M_comp)
- { }
-
-#if __cplusplus >= 201103L
- _GLIBCXX20_CONSTEXPR
- explicit
- _Iter_comp_val(_Iter_comp_iter<_Compare>&& __comp)
- : _M_comp(std::move(__comp._M_comp))
- { }
-#endif
-
- template<typename _Iterator, typename _Value>
- _GLIBCXX20_CONSTEXPR
- bool
- operator()(_Iterator __it, _Value& __val)
- { return bool(_M_comp(*__it, __val)); }
+ using _Fn = __by_ref_or_value_fn<_Func>;
+
+ explicit constexpr
+ _Comp_with_val(_Fn __f, const _Value& __v)
+ : _M_f(__f), _M_val(__v) { }
+
+ [[__no_unique_address__]] _Fn _M_f;
+ const _Value& _M_val;
+
+ template<typename _Tp>
+ _GLIBCXX14_CONSTEXPR bool
+ operator()(_Tp&& __arg)
+ {
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wc++17-extensions"
+ if constexpr (_Val_2nd)
+ return _M_f(__arg, _M_val);
+ else
+ return _M_f(_M_val, __arg);
+#pragma GCC diagnostic pop
+ }
};
- template<typename _Compare>
- _GLIBCXX20_CONSTEXPR
- inline _Iter_comp_val<_Compare>
- __iter_comp_val(_Compare __comp)
- { return _Iter_comp_val<_Compare>(_GLIBCXX_MOVE(__comp)); }
-
- template<typename _Compare>
- _GLIBCXX20_CONSTEXPR
- inline _Iter_comp_val<_Compare>
- __iter_comp_val(_Iter_comp_iter<_Compare> __comp)
- { return _Iter_comp_val<_Compare>(_GLIBCXX_MOVE(__comp)); }
+ template<typename _Func, typename _Value>
+ using _Comp_with_val_1st = _Comp_with_val<_Func, _Value, false>;
+ template<typename _Func, typename _Value>
+ using _Comp_with_val_2nd = _Comp_with_val<_Func, _Value, true>;
- template<typename _Compare>
- struct _Val_comp_iter
+ template<typename _Func>
+ struct _Unary_negate
{
- _Compare _M_comp;
+ using _Fn = __by_ref_or_value_fn<_Func>;
- _GLIBCXX20_CONSTEXPR
- explicit
- _Val_comp_iter(_Compare __comp)
- : _M_comp(_GLIBCXX_MOVE(__comp))
- { }
-
- _GLIBCXX20_CONSTEXPR
- explicit
- _Val_comp_iter(const _Iter_comp_iter<_Compare>& __comp)
- : _M_comp(__comp._M_comp)
- { }
+ explicit constexpr
+ _Unary_negate(_Fn __f) : _M_f(__f) { }
-#if __cplusplus >= 201103L
- _GLIBCXX20_CONSTEXPR
- explicit
- _Val_comp_iter(_Iter_comp_iter<_Compare>&& __comp)
- : _M_comp(std::move(__comp._M_comp))
- { }
-#endif
+ [[__no_unique_address__]] _Fn _M_f;
- template<typename _Value, typename _Iterator>
- _GLIBCXX20_CONSTEXPR
- bool
- operator()(_Value& __val, _Iterator __it)
- { return bool(_M_comp(__val, *__it)); }
+ template<typename _Tp>
+ _GLIBCXX14_CONSTEXPR bool
+ operator()(_Tp&& __arg) { return !_M_f(__arg); }
};
- template<typename _Compare>
- _GLIBCXX20_CONSTEXPR
- inline _Val_comp_iter<_Compare>
- __val_comp_iter(_Compare __comp)
- { return _Val_comp_iter<_Compare>(_GLIBCXX_MOVE(__comp)); }
+ template<typename _Func>
+ constexpr _Unary_negate<_Func>
+ not1(_Func& __f)
+ { return _Unary_negate<_Func>(__f); }
- template<typename _Compare>
- _GLIBCXX20_CONSTEXPR
- inline _Val_comp_iter<_Compare>
- __val_comp_iter(_Iter_comp_iter<_Compare> __comp)
- { return _Val_comp_iter<_Compare>(_GLIBCXX_MOVE(__comp)); }
+#else // <= C++11
- template<typename _Value>
- struct _Iter_equals_val
- {
- _Value& _M_value;
+ template<typename _Fn>
+ struct __by_ref_or_value_fn
+ : __conditional_type<__is_empty(_Fn), _Fn, _Fn&>
+ { };
- _GLIBCXX20_CONSTEXPR
- explicit
- _Iter_equals_val(_Value& __value)
- : _M_value(__value)
- { }
-
- template<typename _Iterator>
- _GLIBCXX20_CONSTEXPR
- bool
- operator()(_Iterator __it)
- { return *__it == _M_value; }
- };
+ template<typename _Fn>
+ struct __by_ref_or_value_fn<_Fn*>
+ { typedef _Fn* __type; };
- template<typename _Value>
- _GLIBCXX20_CONSTEXPR
- inline _Iter_equals_val<_Value>
- __iter_equals_val(_Value& __val)
- { return _Iter_equals_val<_Value>(__val); }
+ // We don't use std::binder1st, std::binder2nd, or std::unary_negate here
+ // because they require adaptable function objects, i.e. types with nested
+ // result_type and argument_type/first_argument_type/second_argument_type.
- template<typename _Iterator1>
- struct _Iter_equals_iter
+ template<typename _Func, typename _Value>
+ struct _Comp_with_val_1st
{
- _Iterator1 _M_it1;
+ typedef typename __by_ref_or_value_fn<_Func>::__type _Fn;
- _GLIBCXX20_CONSTEXPR
explicit
- _Iter_equals_iter(_Iterator1 __it1)
- : _M_it1(__it1)
- { }
+ _Comp_with_val_1st(_Fn __f, const _Value& __v)
+ : _M_f(__f), _M_val(__v) { }
- template<typename _Iterator2>
- _GLIBCXX20_CONSTEXPR
- bool
- operator()(_Iterator2 __it2)
- { return *__it2 == *_M_it1; }
- };
+ _Fn _M_f;
+ const _Value& _M_val;
- template<typename _Iterator>
- _GLIBCXX20_CONSTEXPR
- inline _Iter_equals_iter<_Iterator>
- __iter_comp_iter(_Iter_equal_to_iter, _Iterator __it)
- { return _Iter_equals_iter<_Iterator>(__it); }
+ template<typename _Tp>
+ bool operator()(_Tp& __arg) { return _M_f(_M_val, __arg); }
+ template<typename _Tp>
+ bool operator()(const _Tp& __arg) { return _M_f(_M_val, __arg); }
+ };
- template<typename _Predicate>
- struct _Iter_pred
+ template<typename _Func, typename _Value>
+ struct _Comp_with_val_2nd
{
- _Predicate _M_pred;
+ typedef typename __by_ref_or_value_fn<_Func>::__type _Fn;
- _GLIBCXX20_CONSTEXPR
explicit
- _Iter_pred(_Predicate __pred)
- : _M_pred(_GLIBCXX_MOVE(__pred))
- { }
-
- template<typename _Iterator>
- _GLIBCXX20_CONSTEXPR
- bool
- operator()(_Iterator __it)
- { return bool(_M_pred(*__it)); }
- };
+ _Comp_with_val_2nd(_Fn __f, const _Value& __v)
+ : _M_f(__f), _M_val(__v) { }
- template<typename _Predicate>
- _GLIBCXX20_CONSTEXPR
- inline _Iter_pred<_Predicate>
- __pred_iter(_Predicate __pred)
- { return _Iter_pred<_Predicate>(_GLIBCXX_MOVE(__pred)); }
+ _Fn _M_f;
+ const _Value& _M_val;
- template<typename _Compare, typename _Value>
- struct _Iter_comp_to_val
- {
- _Compare _M_comp;
- _Value& _M_value;
-
- _GLIBCXX20_CONSTEXPR
- _Iter_comp_to_val(_Compare __comp, _Value& __value)
- : _M_comp(_GLIBCXX_MOVE(__comp)), _M_value(__value)
- { }
-
- template<typename _Iterator>
- _GLIBCXX20_CONSTEXPR
- bool
- operator()(_Iterator __it)
- { return bool(_M_comp(*__it, _M_value)); }
+ template<typename _Tp>
+ bool operator()(_Tp& __arg) { return _M_f(__arg, _M_val); }
+ template<typename _Tp>
+ bool operator()(const _Tp& __arg) { return _M_f(__arg, _M_val); }
};
- template<typename _Compare, typename _Value>
- _Iter_comp_to_val<_Compare, _Value>
- _GLIBCXX20_CONSTEXPR
- __iter_comp_val(_Compare __comp, _Value &__val)
+ template<typename _Func>
+ struct _Unary_negate_1 // N.B. different name for C++98 to satisfy ODR
{
- return _Iter_comp_to_val<_Compare, _Value>(_GLIBCXX_MOVE(__comp), __val);
- }
+ typedef typename __by_ref_or_value_fn<_Func>::__type _Fn;
- template<typename _Compare, typename _Iterator1>
- struct _Iter_comp_to_iter
- {
- _Compare _M_comp;
- _Iterator1 _M_it1;
+ explicit _Unary_negate_1(_Fn __f) : _M_f(__f) { }
- _GLIBCXX20_CONSTEXPR
- _Iter_comp_to_iter(_Compare __comp, _Iterator1 __it1)
- : _M_comp(_GLIBCXX_MOVE(__comp)), _M_it1(__it1)
- { }
+ _Fn _M_f;
- template<typename _Iterator2>
- _GLIBCXX20_CONSTEXPR
+ template<typename _Tp>
+ bool
+ operator()(_Tp& __arg) { return !_M_f(__arg); }
+ template<typename _Tp>
bool
- operator()(_Iterator2 __it2)
- { return bool(_M_comp(*__it2, *_M_it1)); }
+ operator()(const _Tp& __arg) { return !_M_f(__arg); }
};
- template<typename _Compare, typename _Iterator>
- _GLIBCXX20_CONSTEXPR
- inline _Iter_comp_to_iter<_Compare, _Iterator>
- __iter_comp_iter(_Iter_comp_iter<_Compare> __comp, _Iterator __it)
- {
- return _Iter_comp_to_iter<_Compare, _Iterator>(
- _GLIBCXX_MOVE(__comp._M_comp), __it);
- }
+ template<typename _Func>
+ inline _Unary_negate_1<_Func>
+ not1(_Func& __f)
+ { return _Unary_negate_1<_Func>(__f); }
+#endif
- template<typename _Predicate>
- struct _Iter_negate
- {
- _Predicate _M_pred;
+ // N.B. these functions take lvalue references because we want to avoid
+ // returning a call wrapper that has a dangling reference to a prvalue.
- _GLIBCXX20_CONSTEXPR
- explicit
- _Iter_negate(_Predicate __pred)
- : _M_pred(_GLIBCXX_MOVE(__pred))
- { }
+ template<typename _Func, typename _Value>
+ _GLIBCXX_CONSTEXPR inline _Comp_with_val_1st<_Func, _Value>
+ bind1st(_Func& __f, const _Value& __val)
+ { return _Comp_with_val_1st<_Func, _Value>(__f, __val); }
- template<typename _Iterator>
- _GLIBCXX20_CONSTEXPR
- bool
- operator()(_Iterator __it)
- { return !bool(_M_pred(*__it)); }
- };
+ template<typename _Func, typename _Value>
+ _GLIBCXX_CONSTEXPR inline _Comp_with_val_2nd<_Func, _Value>
+ bind2nd(_Func& __f, const _Value& __val)
+ { return _Comp_with_val_2nd<_Func, _Value>(__f, __val); }
- template<typename _Predicate>
- _GLIBCXX20_CONSTEXPR
- inline _Iter_negate<_Predicate>
- __negate(_Iter_pred<_Predicate> __pred)
- { return _Iter_negate<_Predicate>(_GLIBCXX_MOVE(__pred._M_pred)); }
+ // Equivalent to bind2nd(equal_to{}, val)
+ template<typename _Value>
+ _GLIBCXX_CONSTEXPR inline _Comp_with_val_2nd<equal_to, _Value>
+ __equal_to(const _Value& __val)
+ { return _Comp_with_val_2nd<equal_to, _Value>(equal_to(), __val); }
} // namespace __ops
} // namespace __gnu_cxx
template<typename _Iterator, typename _Compare>
_GLIBCXX20_CONSTEXPR
void
- __move_median_to_first(_Iterator __result,_Iterator __a, _Iterator __b,
+ __move_median_to_first(_Iterator __result, _Iterator __a, _Iterator __b,
_Iterator __c, _Compare __comp)
{
- if (__comp(__a, __b))
+ if (__comp(*__a, *__b))
{
- if (__comp(__b, __c))
+ if (__comp(*__b, *__c))
std::iter_swap(__result, __b);
- else if (__comp(__a, __c))
+ else if (__comp(*__a, *__c))
std::iter_swap(__result, __c);
else
std::iter_swap(__result, __a);
}
- else if (__comp(__a, __c))
+ else if (__comp(*__a, *__c))
std::iter_swap(__result, __a);
- else if (__comp(__b, __c))
+ else if (__comp(*__b, *__c))
std::iter_swap(__result, __c);
else
std::iter_swap(__result, __b);
_Predicate __pred)
{
return std::__find_if(__first, __last,
- __gnu_cxx::__ops::__negate(__pred));
+ __gnu_cxx::__ops::not1(__pred));
}
/// Like find_if_not(), but uses and updates a count of the
__find_if_not_n(_InputIterator __first, _Distance& __len, _Predicate __pred)
{
for (; __len; --__len, (void) ++__first)
- if (!__pred(__first))
+ if (!__pred(*__first))
break;
return __first;
}
__n = __count;
_ForwardIterator __i = __first;
++__i;
- while (__i != __last && __n != 1 && __unary_pred(__i))
+ while (__i != __last && __n != 1 && __unary_pred(*__i))
{
++__i;
--__n;
// __first here is always pointing to one past the last element of
// next possible match.
_RandomAccessIter __backTrack = __first;
- while (__unary_pred(--__backTrack))
+ while (__unary_pred(*--__backTrack))
{
if (--__remainder == 0)
return __first - _DistanceType(__count); // Success
return std::__find_end(__first1, __last1, __first2, __last2,
std::__iterator_category(__first1),
std::__iterator_category(__first2),
- __gnu_cxx::__ops::__iter_equal_to_iter());
+ __gnu_cxx::__ops::equal_to());
}
/**
return std::__find_end(__first1, __last1, __first2, __last2,
std::__iterator_category(__first1),
std::__iterator_category(__first2),
- __gnu_cxx::__ops::__iter_comp_iter(__comp));
+ __comp);
}
#if __cplusplus >= 201103L
__glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,
typename iterator_traits<_InputIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- return std::__find_if_not(__first, __last,
- __gnu_cxx::__ops::__pred_iter(__pred));
+ return std::__find_if_not(__first, __last, __pred);
}
/**
_OutputIterator __result, _Predicate __pred)
{
for (; __first != __last; ++__first)
- if (!__pred(__first))
+ if (!__pred(*__first))
{
*__result = *__first;
++__result;
__glibcxx_requires_valid_range(__first, __last);
return std::__remove_copy_if(__first, __last, __result,
- __gnu_cxx::__ops::__iter_equals_val(__value));
+ __gnu_cxx::__ops::__equal_to(__value));
}
/**
typename iterator_traits<_InputIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- return std::__remove_copy_if(__first, __last, __result,
- __gnu_cxx::__ops::__pred_iter(__pred));
+ return std::__remove_copy_if(__first, __last, __result, __pred);
}
#if __cplusplus >= 201103L
__glibcxx_requires_valid_range(__first, __last);
return std::__remove_if(__first, __last,
- __gnu_cxx::__ops::__iter_equals_val(__value));
+ __gnu_cxx::__ops::__equal_to(__value));
}
/**
typename iterator_traits<_ForwardIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- return std::__remove_if(__first, __last,
- __gnu_cxx::__ops::__pred_iter(__pred));
+ return std::__remove_if(__first, __last, __pred);
}
template<typename _ForwardIterator, typename _BinaryPredicate>
_ForwardIterator __next = __first;
while (++__next != __last)
{
- if (__binary_pred(__first, __next))
+ if (__binary_pred(*__first, *__next))
return __first;
__first = __next;
}
_ForwardIterator __dest = __first;
++__first;
while (++__first != __last)
- if (!__binary_pred(__dest, __first))
+ if (!__binary_pred(*__dest, *__first))
*++__dest = _GLIBCXX_MOVE(*__first);
return ++__dest;
}
typename iterator_traits<_ForwardIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- return std::__unique(__first, __last,
- __gnu_cxx::__ops::__iter_equal_to_iter());
+ return std::__unique(__first, __last, __gnu_cxx::__ops::equal_to());
}
/**
typename iterator_traits<_ForwardIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- return std::__unique(__first, __last,
- __gnu_cxx::__ops::__iter_comp_iter(__binary_pred));
+ return std::__unique(__first, __last, __binary_pred);
}
// _GLIBCXX_RESOLVE_LIB_DEFECTS
_ForwardIterator __prev = __first;
*__result = *__first;
while (++__first != __last)
- if (!__binary_pred(__prev, __first))
+ if (!__binary_pred(*__prev, *__first))
{
*++__result = *__first;
__prev = __first;
_Val __value = *__first;
*__result = __value;
while (++__first != __last)
- if (!__binary_pred(std::__addressof(__value), __first))
+ if (!__binary_pred(__value, *__first))
{
__value = *__first;
*++__result = __value;
{
*__result = *__first;
while (++__first != __last)
- if (!__binary_pred(__result, __first))
+ if (!__binary_pred(*__result, *__first))
*++__result = *__first;
return ++__result;
}
// partition
/// This is a helper function...
- /// Requires __first != __last and !__pred(__first)
+ /// Requires __first != __last and !__pred(*__first)
/// and __len == distance(__first, __last).
///
- /// !__pred(__first) allows us to guarantee that we don't
+ /// !__pred(*__first) allows us to guarantee that we don't
/// move-assign an element onto itself.
template<typename _ForwardIterator, typename _Pointer, typename _Predicate,
typename _Distance>
_ForwardIterator __result1 = __first;
_Pointer __result2 = __buffer;
- // The precondition guarantees that !__pred(__first), so
+ // The precondition guarantees that !__pred(*__first), so
// move that element to the buffer before starting the loop.
// This ensures that we only call __pred once per element.
*__result2 = _GLIBCXX_MOVE(*__first);
++__result2;
++__first;
for (; __first != __last; ++__first)
- if (__pred(__first))
+ if (__pred(*__first))
{
*__result1 = _GLIBCXX_MOVE(*__first);
++__result1;
typename iterator_traits<_ForwardIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- return std::__stable_partition(__first, __last,
- __gnu_cxx::__ops::__pred_iter(__pred));
+ return std::__stable_partition(__first, __last, __pred);
}
#endif // HOSTED
{
std::__make_heap(__first, __middle, __comp);
for (_RandomAccessIterator __i = __middle; __i < __last; ++__i)
- if (__comp(__i, __first))
+ if (__comp(*__i, *__first))
std::__pop_heap(__first, __middle, __i, __comp);
}
std::__make_heap(__result_first, __result_real_last, __comp);
while (__first != __last)
{
- if (__comp(__first, __result_first))
+ if (__comp(*__first, *__result_first))
std::__adjust_heap(__result_first, _DistanceType(0),
_DistanceType(__result_real_last
- __result_first),
return std::__partial_sort_copy(__first, __last,
__result_first, __result_last,
- __gnu_cxx::__ops::__iter_less_iter());
+ __gnu_cxx::__ops::less());
}
/**
return std::__partial_sort_copy(__first, __last,
__result_first, __result_last,
- __gnu_cxx::__ops::__iter_comp_iter(__comp));
+ __comp);
}
/// @cond undocumented
__val = _GLIBCXX_MOVE(*__last);
_RandomAccessIterator __next = __last;
--__next;
- while (__comp(__val, __next))
+ while (__comp(__val, *__next))
{
*__last = _GLIBCXX_MOVE(*__next);
__last = __next;
for (_RandomAccessIterator __i = __first + _Dist(1); __i != __last; ++__i)
{
- if (__comp(__i, __first))
+ if (__comp(*__i, *__first))
{
typename _IterTraits::value_type __val = _GLIBCXX_MOVE(*__i);
_GLIBCXX_MOVE_BACKWARD3(__first, __i, __i + _Dist(1));
*__first = _GLIBCXX_MOVE(__val);
}
else
- std::__unguarded_linear_insert(__i,
- __gnu_cxx::__ops::__val_comp_iter(__comp));
+ std::__unguarded_linear_insert(__i, __comp);
}
}
_RandomAccessIterator __last, _Compare __comp)
{
for (_RandomAccessIterator __i = __first; __i != __last; ++__i)
- std::__unguarded_linear_insert(__i,
- __gnu_cxx::__ops::__val_comp_iter(__comp));
+ std::__unguarded_linear_insert(__i, __comp);
}
/**
{
while (true)
{
- while (__comp(__first, __pivot))
+ while (__comp(*__first, *__pivot))
++__first;
--__last;
- while (__comp(__pivot, __last))
+ while (__comp(*__pivot, *__last))
--__last;
if (!(__first < __last))
return __first;
__glibcxx_requires_partitioned_lower_pred(__first, __last,
__val, __comp);
- return std::__lower_bound(__first, __last, __val,
- __gnu_cxx::__ops::__iter_comp_val(__comp));
+ return std::__lower_bound(__first, __last, __val, __comp);
}
template<typename _ForwardIterator, typename _Tp, typename _Compare>
_DistanceType __half = __len >> 1;
_ForwardIterator __middle = __first;
std::advance(__middle, __half);
- if (__comp(__val, __middle))
+ if (__comp(__val, *__middle))
__len = __half;
else
{
__glibcxx_requires_partitioned_upper(__first, __last, __val);
return std::__upper_bound(__first, __last, __val,
- __gnu_cxx::__ops::__val_less_iter());
+ __gnu_cxx::__ops::less());
}
/**
__glibcxx_requires_partitioned_upper_pred(__first, __last,
__val, __comp);
- return std::__upper_bound(__first, __last, __val,
- __gnu_cxx::__ops::__val_comp_iter(__comp));
+ return std::__upper_bound(__first, __last, __val, __comp);
}
- template<typename _ForwardIterator, typename _Tp,
- typename _CompareItTp, typename _CompareTpIt>
+ template<typename _ForwardIterator, typename _Tp, typename _Compare>
_GLIBCXX20_CONSTEXPR
pair<_ForwardIterator, _ForwardIterator>
__equal_range(_ForwardIterator __first, _ForwardIterator __last,
- const _Tp& __val,
- _CompareItTp __comp_it_val, _CompareTpIt __comp_val_it)
+ const _Tp& __val, _Compare __comp)
{
typedef typename iterator_traits<_ForwardIterator>::difference_type
_DistanceType;
_DistanceType __half = __len >> 1;
_ForwardIterator __middle = __first;
std::advance(__middle, __half);
- if (__comp_it_val(__middle, __val))
+ if (__comp(*__middle, __val))
{
__first = __middle;
++__first;
__len = __len - __half - 1;
}
- else if (__comp_val_it(__val, __middle))
+ else if (__comp(__val, *__middle))
__len = __half;
else
{
_ForwardIterator __left
- = std::__lower_bound(__first, __middle, __val, __comp_it_val);
+ = std::__lower_bound(__first, __middle, __val, __comp);
std::advance(__first, __len);
_ForwardIterator __right
- = std::__upper_bound(++__middle, __first, __val, __comp_val_it);
+ = std::__upper_bound(++__middle, __first, __val, __comp);
return pair<_ForwardIterator, _ForwardIterator>(__left, __right);
}
}
__glibcxx_requires_partitioned_upper(__first, __last, __val);
return std::__equal_range(__first, __last, __val,
- __gnu_cxx::__ops::__iter_less_val(),
- __gnu_cxx::__ops::__val_less_iter());
+ __gnu_cxx::__ops::less());
}
/**
__glibcxx_requires_partitioned_upper_pred(__first, __last,
__val, __comp);
- return std::__equal_range(__first, __last, __val,
- __gnu_cxx::__ops::__iter_comp_val(__comp),
- __gnu_cxx::__ops::__val_comp_iter(__comp));
+ return std::__equal_range(__first, __last, __val, __comp);
}
/**
__glibcxx_requires_partitioned_upper(__first, __last, __val);
_ForwardIterator __i
- = std::__lower_bound(__first, __last, __val,
- __gnu_cxx::__ops::__iter_less_val());
+ = std::__lower_bound(__first, __last, __val, __gnu_cxx::__ops::less());
return __i != __last && !(__val < *__i);
}
__val, __comp);
_ForwardIterator __i
- = std::__lower_bound(__first, __last, __val,
- __gnu_cxx::__ops::__iter_comp_val(__comp));
+ = std::__lower_bound(__first, __last, __val, __comp);
return __i != __last && !bool(__comp(__val, *__i));
}
{
while (__first1 != __last1 && __first2 != __last2)
{
- if (__comp(__first2, __first1))
+ if (__comp(*__first2, *__first1))
{
*__result = _GLIBCXX_MOVE(*__first2);
++__first2;
--__last2;
while (true)
{
- if (__comp(__last2, __last1))
+ if (__comp(*__last2, *__last1))
{
*--__result = _GLIBCXX_MOVE(*__last1);
if (__first1 == __last1)
__len11 = __len1 / 2;
std::advance(__first_cut, __len11);
__second_cut
- = std::__lower_bound(__middle, __last, *__first_cut,
- __gnu_cxx::__ops::__iter_comp_val(__comp));
+ = std::__lower_bound(__middle, __last, *__first_cut, __comp);
__len22 = std::distance(__middle, __second_cut);
}
else
__len22 = __len2 / 2;
std::advance(__second_cut, __len22);
__first_cut
- = std::__upper_bound(__first, __middle, *__second_cut,
- __gnu_cxx::__ops::__val_comp_iter(__comp));
+ = std::__upper_bound(__first, __middle, *__second_cut, __comp);
__len11 = std::distance(__first, __first_cut);
}
if (__len1 + __len2 == 2)
{
- if (__comp(__middle, __first))
+ if (__comp(*__middle, *__first))
std::iter_swap(__first, __middle);
return;
}
__len11 = __len1 / 2;
std::advance(__first_cut, __len11);
__second_cut
- = std::__lower_bound(__middle, __last, *__first_cut,
- __gnu_cxx::__ops::__iter_comp_val(__comp));
+ = std::__lower_bound(__middle, __last, *__first_cut, __comp);
__len22 = std::distance(__middle, __second_cut);
}
else
__len22 = __len2 / 2;
std::advance(__second_cut, __len22);
__first_cut
- = std::__upper_bound(__first, __middle, *__second_cut,
- __gnu_cxx::__ops::__val_comp_iter(__comp));
+ = std::__upper_bound(__first, __middle, *__second_cut, __comp);
__len11 = std::distance(__first, __first_cut);
}
__glibcxx_requires_irreflexive(__first, __last);
std::__inplace_merge(__first, __middle, __last,
- __gnu_cxx::__ops::__iter_less_iter());
+ __gnu_cxx::__ops::less());
}
/**
__glibcxx_requires_sorted_pred(__middle, __last, __comp);
__glibcxx_requires_irreflexive_pred(__first, __last, __comp);
- std::__inplace_merge(__first, __middle, __last,
- __gnu_cxx::__ops::__iter_comp_iter(__comp));
+ std::__inplace_merge(__first, __middle, __last, __comp);
}
{
while (__first1 != __last1 && __first2 != __last2)
{
- if (__comp(__first2, __first1))
+ if (__comp(*__first2, *__first1))
{
*__result = _GLIBCXX_MOVE(*__first2);
++__first2;
{
while (__first1 != __last1 && __first2 != __last2)
{
- if (__comp(__first2, __first1))
+ if (__comp(*__first2, *__first1))
return false;
- if (!__comp(__first1, __first2))
+ if (!__comp(*__first1, *__first2))
++__first2;
++__first1;
}
__glibcxx_requires_irreflexive2(__first2, __last2);
return std::__includes(__first1, __last1, __first2, __last2,
- __gnu_cxx::__ops::__iter_less_iter());
+ __gnu_cxx::__ops::less());
}
/**
__glibcxx_requires_irreflexive_pred2(__first1, __last1, __comp);
__glibcxx_requires_irreflexive_pred2(__first2, __last2, __comp);
- return std::__includes(__first1, __last1, __first2, __last2,
- __gnu_cxx::__ops::__iter_comp_iter(__comp));
+ return std::__includes(__first1, __last1, __first2, __last2, __comp);
}
// nth_element
{
_BidirectionalIterator __ii = __i;
--__i;
- if (__comp(__i, __ii))
+ if (__comp(*__i, *__ii))
{
_BidirectionalIterator __j = __last;
- while (!__comp(__i, --__j))
+ while (!__comp(*__i, *--__j))
{}
std::iter_swap(__i, __j);
std::__reverse(__ii, __last,
__glibcxx_requires_valid_range(__first, __last);
__glibcxx_requires_irreflexive(__first, __last);
- return std::__next_permutation
- (__first, __last, __gnu_cxx::__ops::__iter_less_iter());
+ return std::__next_permutation(__first, __last, __gnu_cxx::__ops::less());
}
/**
__glibcxx_requires_valid_range(__first, __last);
__glibcxx_requires_irreflexive_pred(__first, __last, __comp);
- return std::__next_permutation
- (__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp));
+ return std::__next_permutation(__first, __last, __comp);
}
template<typename _BidirectionalIterator, typename _Compare>
{
_BidirectionalIterator __ii = __i;
--__i;
- if (__comp(__ii, __i))
+ if (__comp(*__ii, *__i))
{
_BidirectionalIterator __j = __last;
- while (!__comp(--__j, __i))
+ while (!__comp(*--__j, *__i))
{}
std::iter_swap(__i, __j);
std::__reverse(__ii, __last,
__glibcxx_requires_valid_range(__first, __last);
__glibcxx_requires_irreflexive(__first, __last);
- return std::__prev_permutation(__first, __last,
- __gnu_cxx::__ops::__iter_less_iter());
+ return std::__prev_permutation(__first, __last, __gnu_cxx::__ops::less());
}
/**
__glibcxx_requires_valid_range(__first, __last);
__glibcxx_requires_irreflexive_pred(__first, __last, __comp);
- return std::__prev_permutation(__first, __last,
- __gnu_cxx::__ops::__iter_comp_iter(__comp));
+ return std::__prev_permutation(__first, __last, __comp);
}
// replace
_Predicate __pred, const _Tp& __new_value)
{
for (; __first != __last; ++__first, (void)++__result)
- if (__pred(__first))
+ if (__pred(*__first))
*__result = __new_value;
else
*__result = *__first;
__glibcxx_requires_valid_range(__first, __last);
return std::__replace_copy_if(__first, __last, __result,
- __gnu_cxx::__ops::__iter_equals_val(__old_value),
- __new_value);
+ __gnu_cxx::__ops::__equal_to(__old_value),
+ __new_value);
}
/**
typename iterator_traits<_InputIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- return std::__replace_copy_if(__first, __last, __result,
- __gnu_cxx::__ops::__pred_iter(__pred),
- __new_value);
+ return std::__replace_copy_if(__first, __last, __result, __pred,
+ __new_value);
}
#if __cplusplus >= 201103L
_ForwardIterator __next = __first;
for (++__next; __next != __last; __first = __next, (void)++__next)
- if (__comp(__next, __first))
+ if (__comp(*__next, *__first))
return __next;
return __next;
}
__glibcxx_requires_irreflexive(__first, __last);
return std::__is_sorted_until(__first, __last,
- __gnu_cxx::__ops::__iter_less_iter());
+ __gnu_cxx::__ops::less());
}
/**
__glibcxx_requires_valid_range(__first, __last);
__glibcxx_requires_irreflexive_pred(__first, __last, __comp);
- return std::__is_sorted_until(__first, __last,
- __gnu_cxx::__ops::__iter_comp_iter(__comp));
+ return std::__is_sorted_until(__first, __last, __comp);
}
/**
return std::make_pair(__first, __first);
_ForwardIterator __min{}, __max{};
- if (__comp(__next, __first))
+ if (__comp(*__next, *__first))
{
__min = __next;
__max = __first;
__next = __first;
if (++__next == __last)
{
- if (__comp(__first, __min))
+ if (__comp(*__first, *__min))
__min = __first;
- else if (!__comp(__first, __max))
+ else if (!__comp(*__first, *__max))
__max = __first;
break;
}
- if (__comp(__next, __first))
+ if (__comp(*__next, *__first))
{
- if (__comp(__next, __min))
+ if (__comp(*__next, *__min))
__min = __next;
- if (!__comp(__first, __max))
+ if (!__comp(*__first, *__max))
__max = __first;
}
else
{
- if (__comp(__first, __min))
+ if (__comp(*__first, *__min))
__min = __first;
- if (!__comp(__next, __max))
+ if (!__comp(*__next, *__max))
__max = __next;
}
__glibcxx_requires_valid_range(__first, __last);
__glibcxx_requires_irreflexive(__first, __last);
- return std::__minmax_element(__first, __last,
- __gnu_cxx::__ops::__iter_less_iter());
+ return std::__minmax_element(__first, __last, __gnu_cxx::__ops::less());
}
/**
__glibcxx_requires_valid_range(__first, __last);
__glibcxx_requires_irreflexive_pred(__first, __last, __comp);
- return std::__minmax_element(__first, __last,
- __gnu_cxx::__ops::__iter_comp_iter(__comp));
+ return std::__minmax_element(__first, __last, __comp);
}
template<typename _Tp>
__glibcxx_requires_irreflexive(__l.begin(), __l.end());
pair<const _Tp*, const _Tp*> __p =
std::__minmax_element(__l.begin(), __l.end(),
- __gnu_cxx::__ops::__iter_less_iter());
+ __gnu_cxx::__ops::less());
return std::make_pair(*__p.first, *__p.second);
}
{
__glibcxx_requires_irreflexive_pred(__l.begin(), __l.end(), __comp);
pair<const _Tp*, const _Tp*> __p =
- std::__minmax_element(__l.begin(), __l.end(),
- __gnu_cxx::__ops::__iter_comp_iter(__comp));
+ std::__minmax_element(__l.begin(), __l.end(), __comp);
return std::make_pair(*__p.first, *__p.second);
}
typename iterator_traits<_ForwardIterator2>::value_type>)
__glibcxx_requires_valid_range(__first1, __last1);
- return std::__is_permutation(__first1, __last1, __first2,
- __gnu_cxx::__ops::__iter_comp_iter(__pred));
+ return std::__is_permutation(__first1, __last1, __first2, __pred);
}
#if __glibcxx_robust_nonmodifying_seq_ops // C++ >= 14
// have the same elements in the same order.
for (; __first1 != __last1 && __first2 != __last2;
++__first1, (void)++__first2)
- if (!__pred(__first1, __first2))
+ if (!__pred(*__first1, *__first2))
break;
if constexpr (__ra_iters)
for (_ForwardIterator1 __scan = __first1; __scan != __last1; ++__scan)
{
if (__scan != std::__find_if(__first1, __scan,
- __gnu_cxx::__ops::__iter_comp_iter(__pred, __scan)))
+ __gnu_cxx::__ops::bind1st(__pred,
+ *__scan)))
continue; // We've seen this one before.
auto __matches = std::__count_if(__first2, __last2,
- __gnu_cxx::__ops::__iter_comp_iter(__pred, __scan));
+ __gnu_cxx::__ops::bind1st(__pred,
+ *__scan));
if (0 == __matches
|| std::__count_if(__scan, __last1,
- __gnu_cxx::__ops::__iter_comp_iter(__pred, __scan))
+ __gnu_cxx::__ops::bind1st(__pred, *__scan))
!= __matches)
return false;
}
__glibcxx_requires_valid_range(__first1, __last1);
__glibcxx_requires_valid_range(__first2, __last2);
- return
- std::__is_permutation(__first1, __last1, __first2, __last2,
- __gnu_cxx::__ops::__iter_equal_to_iter());
+ return std::__is_permutation(__first1, __last1, __first2, __last2,
+ __gnu_cxx::__ops::equal_to());
}
/**
__glibcxx_requires_valid_range(__first2, __last2);
return std::__is_permutation(__first1, __last1, __first2, __last2,
- __gnu_cxx::__ops::__iter_comp_iter(__pred));
+ __pred);
}
#endif // __glibcxx_robust_nonmodifying_seq_ops
#endif
return std::__find_if(__first, __last,
- __gnu_cxx::__ops::__iter_equals_val(__val));
+ __gnu_cxx::__ops::__equal_to(__val));
}
/**
typename iterator_traits<_InputIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- return std::__find_if(__first, __last,
- __gnu_cxx::__ops::__pred_iter(__pred));
+ return std::__find_if(__first, __last, __pred);
}
/**
__glibcxx_requires_valid_range(__first, __last);
return std::__adjacent_find(__first, __last,
- __gnu_cxx::__ops::__iter_equal_to_iter());
+ __gnu_cxx::__ops::equal_to());
}
/**
typename iterator_traits<_ForwardIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- return std::__adjacent_find(__first, __last,
- __gnu_cxx::__ops::__iter_comp_iter(__binary_pred));
+ return std::__adjacent_find(__first, __last, __binary_pred);
}
/**
__glibcxx_requires_valid_range(__first, __last);
return std::__count_if(__first, __last,
- __gnu_cxx::__ops::__iter_equals_val(__value));
+ __gnu_cxx::__ops::__equal_to(__value));
}
/**
typename iterator_traits<_InputIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- return std::__count_if(__first, __last,
- __gnu_cxx::__ops::__pred_iter(__pred));
+ return std::__count_if(__first, __last, __pred);
}
/**
__glibcxx_requires_valid_range(__first2, __last2);
return std::__search(__first1, __last1, __first2, __last2,
- __gnu_cxx::__ops::__iter_equal_to_iter());
+ __gnu_cxx::__ops::equal_to());
}
/**
__glibcxx_requires_valid_range(__first, __last);
return std::__search_n(__first, __last, __count,
- __gnu_cxx::__ops::__iter_equals_val(__val));
+ __gnu_cxx::__ops::__equal_to(__val));
}
__glibcxx_requires_valid_range(__first, __last);
return std::__search_n(__first, __last, __count,
- __gnu_cxx::__ops::__iter_comp_val(__binary_pred, __val));
+ __gnu_cxx::__ops::bind2nd(__binary_pred, __val));
}
#if __cplusplus >= 201703L
if (__first == __last)
return __result;
return std::__unique_copy(__first, __last, __result,
- __gnu_cxx::__ops::__iter_equal_to_iter(),
+ __gnu_cxx::__ops::equal_to(),
std::__iterator_category(__first));
}
if (__first == __last)
return __result;
- return std::__unique_copy(__first, __last, __result,
- __gnu_cxx::__ops::__iter_comp_iter(__binary_pred),
+ return std::__unique_copy(__first, __last, __result, __binary_pred,
std::__iterator_category(__first));
}
__glibcxx_requires_irreflexive(__first, __last);
std::__partial_sort(__first, __middle, __last,
- __gnu_cxx::__ops::__iter_less_iter());
+ __gnu_cxx::__ops::less());
}
/**
__glibcxx_requires_valid_range(__middle, __last);
__glibcxx_requires_irreflexive_pred(__first, __last, __comp);
- std::__partial_sort(__first, __middle, __last,
- __gnu_cxx::__ops::__iter_comp_iter(__comp));
+ std::__partial_sort(__first, __middle, __last, __comp);
}
/**
std::__introselect(__first, __nth, __last,
std::__lg(__last - __first) * 2,
- __gnu_cxx::__ops::__iter_less_iter());
+ __gnu_cxx::__ops::less());
}
/**
std::__introselect(__first, __nth, __last,
std::__lg(__last - __first) * 2,
- __gnu_cxx::__ops::__iter_comp_iter(__comp));
+ __comp);
}
/**
__glibcxx_requires_valid_range(__first, __last);
__glibcxx_requires_irreflexive(__first, __last);
- std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
+ std::__sort(__first, __last, __gnu_cxx::__ops::less());
}
/**
__glibcxx_requires_valid_range(__first, __last);
__glibcxx_requires_irreflexive_pred(__first, __last, __comp);
- std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp));
+ std::__sort(__first, __last, __comp);
}
template<typename _InputIterator1, typename _InputIterator2,
{
while (__first1 != __last1 && __first2 != __last2)
{
- if (__comp(__first2, __first1))
+ if (__comp(*__first2, *__first1))
{
*__result = *__first2;
++__first2;
__glibcxx_requires_irreflexive2(__first1, __last1);
__glibcxx_requires_irreflexive2(__first2, __last2);
- return _GLIBCXX_STD_A::__merge(__first1, __last1,
- __first2, __last2, __result,
- __gnu_cxx::__ops::__iter_less_iter());
+ return _GLIBCXX_STD_A::__merge(__first1, __last1, __first2, __last2,
+ __result, __gnu_cxx::__ops::less());
}
/**
__glibcxx_requires_irreflexive_pred2(__first1, __last1, __comp);
__glibcxx_requires_irreflexive_pred2(__first2, __last2, __comp);
- return _GLIBCXX_STD_A::__merge(__first1, __last1,
- __first2, __last2, __result,
- __gnu_cxx::__ops::__iter_comp_iter(__comp));
+ return _GLIBCXX_STD_A::__merge(__first1, __last1, __first2, __last2,
+ __result, __comp);
}
template<typename _RandomAccessIterator, typename _Compare>
__glibcxx_requires_irreflexive(__first, __last);
_GLIBCXX_STD_A::__stable_sort(__first, __last,
- __gnu_cxx::__ops::__iter_less_iter());
+ __gnu_cxx::__ops::less());
}
/**
__glibcxx_requires_valid_range(__first, __last);
__glibcxx_requires_irreflexive_pred(__first, __last, __comp);
- _GLIBCXX_STD_A::__stable_sort(__first, __last,
- __gnu_cxx::__ops::__iter_comp_iter(__comp));
+ _GLIBCXX_STD_A::__stable_sort(__first, __last, __comp);
}
template<typename _InputIterator1, typename _InputIterator2,
- typename _OutputIterator,
- typename _Compare>
+ typename _OutputIterator, typename _Compare>
_GLIBCXX20_CONSTEXPR
_OutputIterator
__set_union(_InputIterator1 __first1, _InputIterator1 __last1,
{
while (__first1 != __last1 && __first2 != __last2)
{
- if (__comp(__first1, __first2))
+ if (__comp(*__first1, *__first2))
{
*__result = *__first1;
++__first1;
}
- else if (__comp(__first2, __first1))
+ else if (__comp(*__first2, *__first1))
{
*__result = *__first2;
++__first2;
__glibcxx_requires_irreflexive2(__first1, __last1);
__glibcxx_requires_irreflexive2(__first2, __last2);
- return _GLIBCXX_STD_A::__set_union(__first1, __last1,
- __first2, __last2, __result,
- __gnu_cxx::__ops::__iter_less_iter());
+ return _GLIBCXX_STD_A::__set_union(__first1, __last1, __first2, __last2,
+ __result, __gnu_cxx::__ops::less());
}
/**
__glibcxx_requires_irreflexive_pred2(__first1, __last1, __comp);
__glibcxx_requires_irreflexive_pred2(__first2, __last2, __comp);
- return _GLIBCXX_STD_A::__set_union(__first1, __last1,
- __first2, __last2, __result,
- __gnu_cxx::__ops::__iter_comp_iter(__comp));
+ return _GLIBCXX_STD_A::__set_union(__first1, __last1, __first2, __last2,
+ __result, __comp);
}
template<typename _InputIterator1, typename _InputIterator2,
- typename _OutputIterator,
- typename _Compare>
+ typename _OutputIterator, typename _Compare>
_GLIBCXX20_CONSTEXPR
_OutputIterator
__set_intersection(_InputIterator1 __first1, _InputIterator1 __last1,
_OutputIterator __result, _Compare __comp)
{
while (__first1 != __last1 && __first2 != __last2)
- if (__comp(__first1, __first2))
+ if (__comp(*__first1, *__first2))
++__first1;
- else if (__comp(__first2, __first1))
+ else if (__comp(*__first2, *__first1))
++__first2;
else
{
__glibcxx_requires_irreflexive2(__first1, __last1);
__glibcxx_requires_irreflexive2(__first2, __last2);
- return _GLIBCXX_STD_A::__set_intersection(__first1, __last1,
- __first2, __last2, __result,
- __gnu_cxx::__ops::__iter_less_iter());
+ return _GLIBCXX_STD_A::
+ __set_intersection(__first1, __last1, __first2, __last2,
+ __result, __gnu_cxx::__ops::less());
}
/**
__glibcxx_requires_irreflexive_pred2(__first1, __last1, __comp);
__glibcxx_requires_irreflexive_pred2(__first2, __last2, __comp);
- return _GLIBCXX_STD_A::__set_intersection(__first1, __last1,
- __first2, __last2, __result,
- __gnu_cxx::__ops::__iter_comp_iter(__comp));
+ return _GLIBCXX_STD_A::
+ __set_intersection(__first1, __last1, __first2, __last2,
+ __result, __comp);
}
template<typename _InputIterator1, typename _InputIterator2,
- typename _OutputIterator,
- typename _Compare>
+ typename _OutputIterator, typename _Compare>
_GLIBCXX20_CONSTEXPR
_OutputIterator
__set_difference(_InputIterator1 __first1, _InputIterator1 __last1,
_OutputIterator __result, _Compare __comp)
{
while (__first1 != __last1 && __first2 != __last2)
- if (__comp(__first1, __first2))
+ if (__comp(*__first1, *__first2))
{
*__result = *__first1;
++__first1;
++__result;
}
- else if (__comp(__first2, __first1))
+ else if (__comp(*__first2, *__first1))
++__first2;
else
{
__glibcxx_requires_irreflexive2(__first1, __last1);
__glibcxx_requires_irreflexive2(__first2, __last2);
- return _GLIBCXX_STD_A::__set_difference(__first1, __last1,
- __first2, __last2, __result,
- __gnu_cxx::__ops::__iter_less_iter());
+ return _GLIBCXX_STD_A::
+ __set_difference(__first1, __last1, __first2, __last2, __result,
+ __gnu_cxx::__ops::less());
}
/**
__glibcxx_requires_irreflexive_pred2(__first1, __last1, __comp);
__glibcxx_requires_irreflexive_pred2(__first2, __last2, __comp);
- return _GLIBCXX_STD_A::__set_difference(__first1, __last1,
- __first2, __last2, __result,
- __gnu_cxx::__ops::__iter_comp_iter(__comp));
+ return _GLIBCXX_STD_A::
+ __set_difference(__first1, __last1, __first2, __last2, __result,
+ __comp);
}
template<typename _InputIterator1, typename _InputIterator2,
_Compare __comp)
{
while (__first1 != __last1 && __first2 != __last2)
- if (__comp(__first1, __first2))
+ if (__comp(*__first1, *__first2))
{
*__result = *__first1;
++__first1;
++__result;
}
- else if (__comp(__first2, __first1))
+ else if (__comp(*__first2, *__first1))
{
*__result = *__first2;
++__first2;
__glibcxx_requires_irreflexive2(__first1, __last1);
__glibcxx_requires_irreflexive2(__first2, __last2);
- return _GLIBCXX_STD_A::__set_symmetric_difference(__first1, __last1,
- __first2, __last2, __result,
- __gnu_cxx::__ops::__iter_less_iter());
+ return _GLIBCXX_STD_A::
+ __set_symmetric_difference(__first1, __last1, __first2, __last2,
+ __result, __gnu_cxx::__ops::less());
}
/**
__glibcxx_requires_irreflexive_pred2(__first1, __last1, __comp);
__glibcxx_requires_irreflexive_pred2(__first2, __last2, __comp);
- return _GLIBCXX_STD_A::__set_symmetric_difference(__first1, __last1,
- __first2, __last2, __result,
- __gnu_cxx::__ops::__iter_comp_iter(__comp));
+ return _GLIBCXX_STD_A::
+ __set_symmetric_difference(__first1, __last1, __first2, __last2,
+ __result, __comp);
}
template<typename _ForwardIterator, typename _Compare>
return __first;
_ForwardIterator __result = __first;
while (++__first != __last)
- if (__comp(__first, __result))
+ if (__comp(*__first, *__result))
__result = __first;
return __result;
}
*/
template<typename _ForwardIterator>
_GLIBCXX_NODISCARD _GLIBCXX14_CONSTEXPR
- _ForwardIterator
- inline min_element(_ForwardIterator __first, _ForwardIterator __last)
+ inline _ForwardIterator
+ min_element(_ForwardIterator __first, _ForwardIterator __last)
{
// concept requirements
__glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
__glibcxx_requires_irreflexive(__first, __last);
return _GLIBCXX_STD_A::__min_element(__first, __last,
- __gnu_cxx::__ops::__iter_less_iter());
+ __gnu_cxx::__ops::less());
}
/**
__glibcxx_requires_valid_range(__first, __last);
__glibcxx_requires_irreflexive_pred(__first, __last, __comp);
- return _GLIBCXX_STD_A::__min_element(__first, __last,
- __gnu_cxx::__ops::__iter_comp_iter(__comp));
+ return _GLIBCXX_STD_A::__min_element(__first, __last, __comp);
}
template<typename _ForwardIterator, typename _Compare>
if (__first == __last) return __first;
_ForwardIterator __result = __first;
while (++__first != __last)
- if (__comp(__result, __first))
+ if (__comp(*__result, *__first))
__result = __first;
return __result;
}
__glibcxx_requires_irreflexive(__first, __last);
return _GLIBCXX_STD_A::__max_element(__first, __last,
- __gnu_cxx::__ops::__iter_less_iter());
+ __gnu_cxx::__ops::less());
}
/**
__glibcxx_requires_valid_range(__first, __last);
__glibcxx_requires_irreflexive_pred(__first, __last, __comp);
- return _GLIBCXX_STD_A::__max_element(__first, __last,
- __gnu_cxx::__ops::__iter_comp_iter(__comp));
+ return _GLIBCXX_STD_A::__max_element(__first, __last, __comp);
}
#if __cplusplus >= 201103L
{
__glibcxx_requires_irreflexive(__l.begin(), __l.end());
return *_GLIBCXX_STD_A::__min_element(__l.begin(), __l.end(),
- __gnu_cxx::__ops::__iter_less_iter());
+ __gnu_cxx::__ops::less());
}
template<typename _Tp, typename _Compare>
min(initializer_list<_Tp> __l, _Compare __comp)
{
__glibcxx_requires_irreflexive_pred(__l.begin(), __l.end(), __comp);
- return *_GLIBCXX_STD_A::__min_element(__l.begin(), __l.end(),
- __gnu_cxx::__ops::__iter_comp_iter(__comp));
+ return *_GLIBCXX_STD_A::__min_element(__l.begin(), __l.end(), __comp);
}
template<typename _Tp>
{
__glibcxx_requires_irreflexive(__l.begin(), __l.end());
return *_GLIBCXX_STD_A::__max_element(__l.begin(), __l.end(),
- __gnu_cxx::__ops::__iter_less_iter());
+ __gnu_cxx::__ops::less());
}
template<typename _Tp, typename _Compare>
max(initializer_list<_Tp> __l, _Compare __comp)
{
__glibcxx_requires_irreflexive_pred(__l.begin(), __l.end(), __comp);
- return *_GLIBCXX_STD_A::__max_element(__l.begin(), __l.end(),
- __gnu_cxx::__ops::__iter_comp_iter(__comp));
+ return *_GLIBCXX_STD_A::__max_element(__l.begin(), __l.end(), __comp);
}
#endif // C++11