]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Eliminate __gnu_cxx::__ops function objects
authorJonathan Wakely <jwakely@redhat.com>
Fri, 13 Jun 2025 16:27:51 +0000 (17:27 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Fri, 26 Sep 2025 10:05:49 +0000 (11:05 +0100)
This removes the indirect functors from <bits/predefined_ops.h> that are
used by our STL algorithms. Currently we wrap all predicates and values
into callables which accept iterator arguments, and automatically
dereference the iterators. With this change we no longer do that
dereferencing and so all predicates are passed values not iterators, and
the algorithms that invoke those predicates must dereference the
iterators.

This avoids wrapping user-provided predicates into another predicate
that does the dereferencing. User-provided predicates are now passed
unchanged to our internal algos like __search_n. For the overloads that
take a value instead of a predicate, we still need to create a predicate
that does comparison to the value, but we can now use std::less<void>
and std::equal_to<void> as the base predicate and bind the value to
those base predicates.

Because the "transparent operators" std::less<void> and
std::equal_to<void> were not added until C++14, this change defines
those explicit specializations unconditionally for C++98 and C++11 too
(but the default template arguments that make std::less<> and
std::equal_to<> refer to those specializations are still only present
for C++14 and later, because we don't need to rely on those default
template arguments for our internal uses).

When binding a predicate and a value into a new call wrapper, we now
decide whether to store the predicate by value when it's an empty type
or a scalar (such as a function pointer). This avoids a
double-indirection through function pointers, and avoids storing and
invoking stateless empty functors through a reference. For C++11 and
later we also use [[no_unique_address]] to avoid wasted storage for
empty predicates (which includes all standard relational ops, such as
std::less).

The call wrappers in bits/predefined_ops.h all have non-const operator()
because we can't be sure that the predicates they wrap are
const-invocable. The requirements in [algorithms.requirements] for
Predicate and BinaryPredicate template arguments require pred(*i) to be
valid, but do not require that std::to_const(pred)(*i) has to be valid,
and similarly for binary_pred.

libstdc++-v3/ChangeLog:

* include/bits/predefined_ops.h (equal_to, less): Define aliases
for std::equal_to<void> and std::less<void>.
(bind1st, bind2nd, not1, __equal_to): New object generator
functions for adapting predicates.
(__iter_less_iter, __iter_less_val, __iter_comp_val)
(__val_less_iter, __val_comp_iter, __iter_equal_to_iter)
(__iter_equal_to_val, __iter_comp_iter, __negate): Remove all
object generator functions and the class templates they return.
* include/bits/stl_algo.h (__move_median_to_first, __find_if_not)
(__find_if_not_n, __search_n_aux, find_end, find_if_not)
(__remove_copy_if, remove_copy, remove_copy_if, remove)
(remove_if, __adjacent_find, __unique, unique, __unique_copy)
(__unique_copy_1, __stable_partition_adaptive, stable_partition)
(__heap_select, __partial_sort_copy, partial_sort_copy)
(__unguarded_linear_insert, __insertion_sort)
(__unguarded_insertion_sort, __unguarded_partition)
(lower_bound, __upper_bound, upper_bound, __equal_range)
(equal_range, binary_search, __move_merge_adaptive)
(__move_merge_adaptive_backward, __merge_adaptive_resize)
(__merge_without_buffer, inplace_merge, __move_merge)
(__includes, includes, __next_permutation, next_permutation)
(__prev_permutation, prev_permutation, __replace_copy_if)
(replace_copy, replace_copy_if, __is_sorted_until)
(is_sorted_until, __minmax_element, minmax_element, minmax)
(is_permutation, __is_permutation, find, find_if, adjacent_find)
(count, count_if, search, search_n, unique_copy, partial_sort)
(nth_element, sort, __merge, merge, stable_sort, __set_union)
(set_union, __set_intersection, set_intersection)
(__set_difference, set_difference, __set_symmetric_difference)
(set_symmetric_difference, __min_element, min_element)
(__max_element, max_element, min, max): Use direct predicates
instead of __iter_equal_to_iter, __iter_comp_iter, and
__iter_less_iter, __negate etc. Dereference iterators when
invoking predicates.
* include/bits/stl_algobase.h (__lexicographical_compare_impl)
(__lexicographical_compare::__lc, __lower_bound, lower_bound)
(lexicographical_compare, __mismatch, mismatch, __find_if)
(__count_if, __remove_if, __search, __is_permutation)
(is_permutation, search): Likewise.
* include/bits/stl_function.h (equal_to<void>, less<void>):
Define transparent comparison functions for C++98 and C++11.
* include/bits/stl_heap.h (__is_heap_until, __is_heap)
(__push_heap, push_heap, __adjust_heap, pop_heap, make_heap)
(sort_heap, is_heap_until, is_heap): Likewise.
* include/std/deque (erase_if): Remove call to __pred_iter.
(erase): Replace __iter_equals_val with __equal_to.
* include/std/inplace_vector (erase_if, erase): Likewise.
* include/std/string (erase_if, erase): Likewise.
* include/std/vector (erase_if, erase): Likewise.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: François Dumont <frs.dumont@gmail.com>
libstdc++-v3/include/bits/predefined_ops.h
libstdc++-v3/include/bits/stl_algo.h
libstdc++-v3/include/bits/stl_algobase.h
libstdc++-v3/include/bits/stl_function.h
libstdc++-v3/include/bits/stl_heap.h
libstdc++-v3/include/std/deque
libstdc++-v3/include/std/inplace_vector
libstdc++-v3/include/std/string
libstdc++-v3/include/std/vector

index 5759ebd0e5bc2389402ec23a30d6f1b9c92fc213..d75b5c2ffc85ca32fefb8a1ddeb6ba769550c2d1 100644 (file)
 #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
index b296e12cf0f82fdd9cd91b41e11cb8e898367f4c..7ff5dd84a97af4bacb07c7be1bddd10a041a9890 100644 (file)
@@ -85,21 +85,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   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);
@@ -113,7 +113,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
                  _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
@@ -125,7 +125,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     __find_if_not_n(_InputIterator __first, _Distance& __len, _Predicate __pred)
     {
       for (; __len; --__len,  (void) ++__first)
-       if (!__pred(__first))
+       if (!__pred(*__first))
          break;
       return __first;
     }
@@ -162,7 +162,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
            __n = __count;
          _ForwardIterator __i = __first;
          ++__i;
-         while (__i != __last && __n != 1 && __unary_pred(__i))
+         while (__i != __last && __n != 1 && __unary_pred(*__i))
            {
              ++__i;
              --__n;
@@ -201,7 +201,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
          // __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
@@ -339,7 +339,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       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());
     }
 
   /**
@@ -390,7 +390,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       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
@@ -470,8 +470,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       __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);
     }
 
   /**
@@ -551,7 +550,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
                     _OutputIterator __result, _Predicate __pred)
     {
       for (; __first != __last; ++__first)
-       if (!__pred(__first))
+       if (!__pred(*__first))
          {
            *__result = *__first;
            ++__result;
@@ -588,7 +587,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       __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));
     }
 
   /**
@@ -621,8 +620,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
            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
@@ -780,7 +778,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       __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));
     }
 
   /**
@@ -813,8 +811,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
            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>
@@ -828,7 +825,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       _ForwardIterator __next = __first;
       while (++__next != __last)
        {
-         if (__binary_pred(__first, __next))
+         if (__binary_pred(*__first, *__next))
            return __first;
          __first = __next;
        }
@@ -850,7 +847,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       _ForwardIterator __dest = __first;
       ++__first;
       while (++__first != __last)
-       if (!__binary_pred(__dest, __first))
+       if (!__binary_pred(*__dest, *__first))
          *++__dest = _GLIBCXX_MOVE(*__first);
       return ++__dest;
     }
@@ -881,8 +878,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
                     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());
     }
 
   /**
@@ -914,8 +910,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
                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
@@ -934,7 +929,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       _ForwardIterator __prev = __first;
       *__result = *__first;
       while (++__first != __last)
-       if (!__binary_pred(__prev, __first))
+       if (!__binary_pred(*__prev, *__first))
          {
            *++__result = *__first;
            __prev = __first;
@@ -956,7 +951,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       _Val __value = *__first;
       *__result = __value;
       while (++__first != __last)
-       if (!__binary_pred(std::__addressof(__value), __first))
+       if (!__binary_pred(__value, *__first))
          {
            __value = *__first;
            *++__result = __value;
@@ -975,7 +970,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     {
       *__result = *__first;
       while (++__first != __last)
-       if (!__binary_pred(__result, __first))
+       if (!__binary_pred(*__result, *__first))
          *++__result = *__first;
       return ++__result;
     }
@@ -1445,10 +1440,10 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
   // 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>
@@ -1468,14 +1463,14 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
          _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;
@@ -1581,8 +1576,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
            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
 
@@ -1598,7 +1592,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
     {
       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);
     }
 
@@ -1631,7 +1625,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
       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),
@@ -1689,7 +1683,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
 
       return std::__partial_sort_copy(__first, __last,
                                      __result_first, __result_last,
-                                     __gnu_cxx::__ops::__iter_less_iter());
+                                     __gnu_cxx::__ops::less());
     }
 
   /**
@@ -1744,7 +1738,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
 
       return std::__partial_sort_copy(__first, __last,
                                      __result_first, __result_last,
-                               __gnu_cxx::__ops::__iter_comp_iter(__comp));
+                                     __comp);
     }
 
   /// @cond undocumented
@@ -1760,7 +1754,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
        __val = _GLIBCXX_MOVE(*__last);
       _RandomAccessIterator __next = __last;
       --__next;
-      while (__comp(__val, __next))
+      while (__comp(__val, *__next))
        {
          *__last = _GLIBCXX_MOVE(*__next);
          __last = __next;
@@ -1784,15 +1778,14 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
 
       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);
        }
     }
 
@@ -1804,8 +1797,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
                               _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);
     }
 
   /**
@@ -1844,10 +1836,10 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
     {
       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;
@@ -1989,8 +1981,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
       __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>
@@ -2009,7 +2000,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
          _DistanceType __half = __len >> 1;
          _ForwardIterator __middle = __first;
          std::advance(__middle, __half);
-         if (__comp(__val, __middle))
+         if (__comp(__val, *__middle))
            __len = __half;
          else
            {
@@ -2045,7 +2036,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
       __glibcxx_requires_partitioned_upper(__first, __last, __val);
 
       return std::__upper_bound(__first, __last, __val,
-                               __gnu_cxx::__ops::__val_less_iter());
+                               __gnu_cxx::__ops::less());
     }
 
   /**
@@ -2076,17 +2067,14 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
       __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;
@@ -2098,21 +2086,21 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
          _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);
            }
        }
@@ -2152,8 +2140,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
       __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());
     }
 
   /**
@@ -2190,9 +2177,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
       __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);
     }
 
   /**
@@ -2221,8 +2206,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
       __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);
     }
 
@@ -2257,8 +2241,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
                                                __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));
     }
 
@@ -2274,7 +2257,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
     {
       while (__first1 != __last1 && __first2 != __last2)
        {
-         if (__comp(__first2, __first1))
+         if (__comp(*__first2, *__first1))
            {
              *__result = _GLIBCXX_MOVE(*__first2);
              ++__first2;
@@ -2313,7 +2296,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
       --__last2;
       while (true)
        {
-         if (__comp(__last2, __last1))
+         if (__comp(*__last2, *__last1))
            {
              *--__result = _GLIBCXX_MOVE(*__last1);
              if (__first1 == __last1)
@@ -2419,8 +2402,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
              __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
@@ -2428,8 +2410,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
              __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);
            }
 
@@ -2463,7 +2444,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
 
       if (__len1 + __len2 == 2)
        {
-         if (__comp(__middle, __first))
+         if (__comp(*__middle, *__first))
            std::iter_swap(__first, __middle);
          return;
        }
@@ -2477,8 +2458,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
          __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
@@ -2486,8 +2466,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
          __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);
        }
 
@@ -2581,7 +2560,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
       __glibcxx_requires_irreflexive(__first, __last);
 
       std::__inplace_merge(__first, __middle, __last,
-                          __gnu_cxx::__ops::__iter_less_iter());
+                          __gnu_cxx::__ops::less());
     }
 
   /**
@@ -2624,8 +2603,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
       __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);
     }
 
 
@@ -2639,7 +2617,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
     {
       while (__first1 != __last1 && __first2 != __last2)
        {
-         if (__comp(__first2, __first1))
+         if (__comp(*__first2, *__first1))
            {
              *__result = _GLIBCXX_MOVE(*__first2);
              ++__first2;
@@ -2804,9 +2782,9 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
     {
       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;
        }
@@ -2853,7 +2831,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
       __glibcxx_requires_irreflexive2(__first2, __last2);
 
       return std::__includes(__first1, __last1, __first2, __last2,
-                            __gnu_cxx::__ops::__iter_less_iter());
+                            __gnu_cxx::__ops::less());
     }
 
   /**
@@ -2899,8 +2877,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
       __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
@@ -2932,10 +2909,10 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
        {
          _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,
@@ -2977,8 +2954,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
       __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());
     }
 
   /**
@@ -3011,8 +2987,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
       __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>
@@ -3034,10 +3009,10 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
        {
          _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,
@@ -3080,8 +3055,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
       __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());
     }
 
   /**
@@ -3114,8 +3088,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
       __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
@@ -3130,7 +3103,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
                      _Predicate __pred, const _Tp& __new_value)
     {
       for (; __first != __last; ++__first, (void)++__result)
-       if (__pred(__first))
+       if (__pred(*__first))
          *__result = __new_value;
        else
          *__result = *__first;
@@ -3167,8 +3140,8 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
       __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);
     }
 
   /**
@@ -3202,9 +3175,8 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
            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
@@ -3248,7 +3220,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
 
       _ForwardIterator __next = __first;
       for (++__next; __next != __last; __first = __next, (void)++__next)
-       if (__comp(__next, __first))
+       if (__comp(*__next, *__first))
          return __next;
       return __next;
     }
@@ -3274,7 +3246,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
       __glibcxx_requires_irreflexive(__first, __last);
 
       return std::__is_sorted_until(__first, __last,
-                                   __gnu_cxx::__ops::__iter_less_iter());
+                                   __gnu_cxx::__ops::less());
     }
 
   /**
@@ -3300,8 +3272,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
       __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);
     }
 
   /**
@@ -3354,7 +3325,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
        return std::make_pair(__first, __first);
 
       _ForwardIterator __min{}, __max{};
-      if (__comp(__next, __first))
+      if (__comp(*__next, *__first))
        {
          __min = __next;
          __max = __first;
@@ -3373,25 +3344,25 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
          __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;
            }
 
@@ -3425,8 +3396,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
       __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());
     }
 
   /**
@@ -3455,8 +3425,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
       __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>
@@ -3467,7 +3436,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
       __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);
     }
 
@@ -3478,8 +3447,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
     {
       __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);
     }
 
@@ -3512,8 +3480,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
            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
@@ -3544,7 +3511,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
       // 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)
@@ -3565,14 +3532,16 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
       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;
        }
@@ -3602,9 +3571,8 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
       __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());
     }
 
   /**
@@ -3633,7 +3601,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
       __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
 
@@ -3912,7 +3880,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
 #endif
 
       return std::__find_if(__first, __last,
-                           __gnu_cxx::__ops::__iter_equals_val(__val));
+                           __gnu_cxx::__ops::__equal_to(__val));
     }
 
   /**
@@ -3937,8 +3905,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
              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);
     }
 
   /**
@@ -4043,7 +4010,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __glibcxx_requires_valid_range(__first, __last);
 
       return std::__adjacent_find(__first, __last,
-                                 __gnu_cxx::__ops::__iter_equal_to_iter());
+                                 __gnu_cxx::__ops::equal_to());
     }
 
   /**
@@ -4070,8 +4037,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
            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);
     }
 
   /**
@@ -4095,7 +4061,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __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));
     }
 
   /**
@@ -4118,8 +4084,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
            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);
     }
 
   /**
@@ -4164,7 +4129,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __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());
     }
 
   /**
@@ -4195,7 +4160,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __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));
     }
 
 
@@ -4231,7 +4196,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __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
@@ -4488,7 +4453,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       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));
     }
 
@@ -4529,8 +4494,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
 
       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));
     }
 
@@ -4717,7 +4681,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __glibcxx_requires_irreflexive(__first, __last);
 
       std::__partial_sort(__first, __middle, __last,
-                         __gnu_cxx::__ops::__iter_less_iter());
+                         __gnu_cxx::__ops::less());
     }
 
   /**
@@ -4757,8 +4721,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __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);
     }
 
   /**
@@ -4796,7 +4759,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
 
       std::__introselect(__first, __nth, __last,
                         std::__lg(__last - __first) * 2,
-                        __gnu_cxx::__ops::__iter_less_iter());
+                        __gnu_cxx::__ops::less());
     }
 
   /**
@@ -4837,7 +4800,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
 
       std::__introselect(__first, __nth, __last,
                         std::__lg(__last - __first) * 2,
-                        __gnu_cxx::__ops::__iter_comp_iter(__comp));
+                        __comp);
     }
 
   /**
@@ -4867,7 +4830,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __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());
     }
 
   /**
@@ -4900,7 +4863,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __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,
@@ -4913,7 +4876,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
     {
       while (__first1 != __last1 && __first2 != __last2)
        {
-         if (__comp(__first2, __first1))
+         if (__comp(*__first2, *__first1))
            {
              *__result = *__first2;
              ++__first2;
@@ -4971,9 +4934,8 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __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());
     }
 
   /**
@@ -5022,9 +4984,8 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __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>
@@ -5098,7 +5059,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __glibcxx_requires_irreflexive(__first, __last);
 
       _GLIBCXX_STD_A::__stable_sort(__first, __last,
-                                   __gnu_cxx::__ops::__iter_less_iter());
+                                   __gnu_cxx::__ops::less());
     }
 
   /**
@@ -5134,13 +5095,11 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __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,
@@ -5149,12 +5108,12 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
     {
       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;
@@ -5216,9 +5175,8 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __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());
     }
 
   /**
@@ -5267,14 +5225,12 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __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,
@@ -5282,9 +5238,9 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
                       _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
          {
@@ -5338,9 +5294,9 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __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());
     }
 
   /**
@@ -5388,14 +5344,13 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __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,
@@ -5403,13 +5358,13 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
                     _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
          {
@@ -5463,9 +5418,9 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __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());
     }
 
   /**
@@ -5515,9 +5470,9 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __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,
@@ -5533,13 +5488,13 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
                               _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;
@@ -5598,9 +5553,9 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __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());
     }
 
   /**
@@ -5651,9 +5606,9 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __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>
@@ -5666,7 +5621,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
        return __first;
       _ForwardIterator __result = __first;
       while (++__first != __last)
-       if (__comp(__first, __result))
+       if (__comp(*__first, *__result))
          __result = __first;
       return __result;
     }
@@ -5680,8 +5635,8 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
   */
   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>)
@@ -5691,7 +5646,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __glibcxx_requires_irreflexive(__first, __last);
 
       return _GLIBCXX_STD_A::__min_element(__first, __last,
-                               __gnu_cxx::__ops::__iter_less_iter());
+                                          __gnu_cxx::__ops::less());
     }
 
   /**
@@ -5717,8 +5672,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __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>
@@ -5730,7 +5684,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       if (__first == __last) return __first;
       _ForwardIterator __result = __first;
       while (++__first != __last)
-       if (__comp(__result, __first))
+       if (__comp(*__result, *__first))
          __result = __first;
       return __result;
     }
@@ -5755,7 +5709,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __glibcxx_requires_irreflexive(__first, __last);
 
       return _GLIBCXX_STD_A::__max_element(__first, __last,
-                               __gnu_cxx::__ops::__iter_less_iter());
+                                          __gnu_cxx::__ops::less());
     }
 
   /**
@@ -5781,8 +5735,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __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
@@ -5794,7 +5747,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
     {
       __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>
@@ -5803,8 +5756,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
     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>
@@ -5814,7 +5766,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
     {
       __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>
@@ -5823,8 +5775,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
     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
 
index 0226680761386fdc4cadb4bffa19b597ab2edb4c..03f64fb3e6c30893eb72c467d1f0d8931086079f 100644 (file)
@@ -1340,9 +1340,9 @@ _GLIBCXX_END_NAMESPACE_CONTAINER
       for (; __first1 != __last1 && __rai_type::__cnd2(__first2, __last2);
           ++__first1, (void)++__first2)
        {
-         if (__comp(__first1, __first2))
+         if (__comp(*__first1, *__first2))
            return true;
-         if (__comp(__first2, __first1))
+         if (__comp(*__first2, *__first1))
            return false;
        }
       return __first1 == __last1 && __first2 != __last2;
@@ -1356,10 +1356,10 @@ _GLIBCXX_END_NAMESPACE_CONTAINER
        static bool
        __lc(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2)
        {
-         using __gnu_cxx::__ops::__iter_less_iter;
+         using __gnu_cxx::__ops::less;
          return std::__lexicographical_compare_impl(__first1, __last1,
                                                     __first2, __last2,
-                                                    __iter_less_iter());
+                                                    less());
        }
 
       template<typename _II1, typename _II2>
@@ -1515,7 +1515,7 @@ _GLIBCXX_END_NAMESPACE_CONTAINER
          _DistanceType __half = __len >> 1;
          _ForwardIterator __middle = __first;
          std::advance(__middle, __half);
-         if (__comp(__middle, __val))
+         if (__comp(*__middle, __val))
            {
              __first = __middle;
              ++__first;
@@ -1551,7 +1551,7 @@ _GLIBCXX_END_NAMESPACE_CONTAINER
       __glibcxx_requires_partitioned_lower(__first, __last, __val);
 
       return std::__lower_bound(__first, __last, __val,
-                               __gnu_cxx::__ops::__iter_less_val());
+                               __gnu_cxx::__ops::less());
     }
 
   /// This is a helper function for the sort routines and for random.tcc.
@@ -1825,8 +1825,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __glibcxx_requires_valid_range(__first2, __last2);
 
       return std::__lexicographical_compare_impl
-       (__first1, __last1, __first2, __last2,
-        __gnu_cxx::__ops::__iter_comp_iter(__comp));
+       (__first1, __last1, __first2, __last2, __comp);
     }
 
 #if __cpp_lib_three_way_comparison
@@ -1934,7 +1933,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
     __mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
               _InputIterator2 __first2, _BinaryPredicate __binary_pred)
     {
-      while (__first1 != __last1 && __binary_pred(__first1, __first2))
+      while (__first1 != __last1 && __binary_pred(*__first1, *__first2))
        {
          ++__first1;
          ++__first2;
@@ -1970,7 +1969,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __glibcxx_requires_valid_range(__first1, __last1);
 
       return _GLIBCXX_STD_A::__mismatch(__first1, __last1, __first2,
-                            __gnu_cxx::__ops::__iter_equal_to_iter());
+                                       __gnu_cxx::__ops::equal_to());
     }
 
   /**
@@ -2002,7 +2001,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __glibcxx_requires_valid_range(__first1, __last1);
 
       return _GLIBCXX_STD_A::__mismatch(__first1, __last1, __first2,
-       __gnu_cxx::__ops::__iter_comp_iter(__binary_pred));
+                                       __binary_pred);
     }
 
 #if __glibcxx_robust_nonmodifying_seq_ops // C++ >= 14
@@ -2015,7 +2014,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
               _BinaryPredicate __binary_pred)
     {
       while (__first1 != __last1 && __first2 != __last2
-            && __binary_pred(__first1, __first2))
+            && __binary_pred(*__first1, *__first2))
        {
          ++__first1;
          ++__first2;
@@ -2053,7 +2052,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __glibcxx_requires_valid_range(__first2, __last2);
 
       return _GLIBCXX_STD_A::__mismatch(__first1, __last1, __first2, __last2,
-                            __gnu_cxx::__ops::__iter_equal_to_iter());
+                                       __gnu_cxx::__ops::equal_to());
     }
 
   /**
@@ -2088,7 +2087,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __glibcxx_requires_valid_range(__first2, __last2);
 
       return _GLIBCXX_STD_A::__mismatch(__first1, __last1, __first2, __last2,
-                            __gnu_cxx::__ops::__iter_comp_iter(__binary_pred));
+                            __binary_pred);
     }
 #endif // __glibcxx_robust_nonmodifying_seq_ops
 
@@ -2101,7 +2100,7 @@ _GLIBCXX_END_NAMESPACE_ALGO
     __find_if(_Iterator __first, _Iterator __last, _Predicate __pred)
     {
 #pragma GCC unroll 4
-      while (__first != __last && !__pred(__first))
+      while (__first != __last && !__pred(*__first))
        ++__first;
       return __first;
     }
@@ -2113,7 +2112,7 @@ _GLIBCXX_END_NAMESPACE_ALGO
     {
       typename iterator_traits<_InputIterator>::difference_type __n = 0;
       for (; __first != __last; ++__first)
-       if (__pred(__first))
+       if (__pred(*__first))
          ++__n;
       return __n;
     }
@@ -2130,7 +2129,7 @@ _GLIBCXX_END_NAMESPACE_ALGO
       _ForwardIterator __result = __first;
       ++__first;
       for (; __first != __last; ++__first)
-       if (!__pred(__first))
+       if (!__pred(*__first))
          {
            *__result = _GLIBCXX_MOVE(*__first);
            ++__result;
@@ -2154,7 +2153,8 @@ _GLIBCXX_END_NAMESPACE_ALGO
       _ForwardIterator2 __p1(__first2);
       if (++__p1 == __last2)
        return std::__find_if(__first1, __last1,
-               __gnu_cxx::__ops::__iter_comp_iter(__predicate, __first2));
+                             __gnu_cxx::__ops::bind2nd(__predicate,
+                                                       *__first2));
 
       // General case.
       _ForwardIterator1 __current = __first1;
@@ -2163,7 +2163,7 @@ _GLIBCXX_END_NAMESPACE_ALGO
        {
          __first1 =
            std::__find_if(__first1, __last1,
-               __gnu_cxx::__ops::__iter_comp_iter(__predicate, __first2));
+                          __gnu_cxx::__ops::bind2nd(__predicate, *__first2));
 
          if (__first1 == __last1)
            return __last1;
@@ -2173,7 +2173,7 @@ _GLIBCXX_END_NAMESPACE_ALGO
          if (++__current == __last1)
            return __last1;
 
-         while (__predicate(__current, __p))
+         while (__predicate(*__current, *__p))
            {
              if (++__p == __last2)
                return __first1;
@@ -2196,7 +2196,7 @@ _GLIBCXX_END_NAMESPACE_ALGO
       // Efficiently compare identical prefixes:  O(N) if sequences
       // have the same elements in the same order.
       for (; __first1 != __last1; ++__first1, (void)++__first2)
-       if (!__pred(__first1, __first2))
+       if (!__pred(*__first1, *__first2))
          break;
 
       if (__first1 == __last1)
@@ -2209,15 +2209,16 @@ _GLIBCXX_END_NAMESPACE_ALGO
       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;
        }
@@ -2251,7 +2252,7 @@ _GLIBCXX_END_NAMESPACE_ALGO
       __glibcxx_requires_valid_range(__first1, __last1);
 
       return std::__is_permutation(__first1, __last1, __first2,
-                                  __gnu_cxx::__ops::__iter_equal_to_iter());
+                                  __gnu_cxx::__ops::equal_to());
     }
 #endif // C++11
 
@@ -2295,8 +2296,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       __glibcxx_requires_valid_range(__first1, __last1);
       __glibcxx_requires_valid_range(__first2, __last2);
 
-      return std::__search(__first1, __last1, __first2, __last2,
-                          __gnu_cxx::__ops::__iter_comp_iter(__predicate));
+      return std::__search(__first1, __last1, __first2, __last2, __predicate);
     }
 
 _GLIBCXX_END_NAMESPACE_ALGO
index 136fd01c984764fa6663516d2d1036a49adbc92f..ff3f8f4c6e79a62de7e98fa13b90468ccaaa7814 100644 (file)
@@ -762,6 +762,58 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
              is_convertible<_Tp, const volatile void*>,
              is_convertible<_Up, const volatile void*>>;
     };
+#else // < C++14
+
+  // We need less<void> and equal_to<void> for <bits/predefined_ops.h>
+
+  template<>
+    struct equal_to<void>
+    {
+#ifdef __cpp_rvalue_references
+      template<typename _Tp, typename _Up>
+       bool
+       operator()(_Tp&& __t, _Up&& __u) const
+       { return __t == __u; }
+#else // C++98
+      template<typename _Tp, typename _Up>
+       bool
+       operator()(_Tp& __t, _Up& __u) const { return __t == __u; }
+      template<typename _Tp, typename _Up>
+       bool
+       operator()(const _Tp& __t, _Up& __u) const { return __t == __u; }
+      template<typename _Tp, typename _Up>
+       bool
+       operator()(_Tp& __t, const _Up& __u) const { return __t == __u; }
+      template<typename _Tp, typename _Up>
+       bool
+       operator()(const _Tp& __t, const _Up& __u) const { return __t == __u; }
+#endif
+    };
+
+  template<>
+    struct less<void>
+    {
+#ifdef __cpp_rvalue_references
+      template<typename _Tp, typename _Up>
+       bool
+       operator()(_Tp&& __t, _Up&& __u) const
+       { return __t < __u; }
+#else // C++98
+      template<typename _Tp, typename _Up>
+       bool
+       operator()(_Tp& __t, _Up& __u) const { return __t < __u; }
+      template<typename _Tp, typename _Up>
+       bool
+       operator()(const _Tp& __t, _Up& __u) const { return __t < __u; }
+      template<typename _Tp, typename _Up>
+       bool
+       operator()(_Tp& __t, const _Up& __u) const { return __t < __u; }
+      template<typename _Tp, typename _Up>
+       bool
+       operator()(const _Tp& __t, const _Up& __u) const { return __t < __u; }
+#endif
+    };
+
 #endif // __glibcxx_transparent_operators
   /** @}  */
 
index f2b1e87e42a88445462d9ab34a5348104edf1647..b10495bc8052d5b829cc35bd7b6bcd25a375514b 100644 (file)
@@ -85,7 +85,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       _Distance __parent = 0;
       for (_Distance __child = 1; __child < __n; ++__child)
        {
-         if (__comp(__first + __parent, __first + __child))
+         if (__comp(__first[__parent], __first[__child]))
            return __child;
          if ((__child & 1) == 0)
            ++__parent;
@@ -101,7 +101,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     __is_heap(_RandomAccessIterator __first, _Distance __n)
     {
       typename iterator_traits<_RandomAccessIterator>::difference_type __d(__n);
-      __gnu_cxx::__ops::_Iter_less_iter __comp;
+      __gnu_cxx::__ops::less __comp;
       return std::__is_heap_until(__first, __d, __comp) == __n;
     }
 
@@ -112,9 +112,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     __is_heap(_RandomAccessIterator __first, _Compare __comp, _Distance __n)
     {
       typename iterator_traits<_RandomAccessIterator>::difference_type __d(__n);
-      typedef __decltype(__comp) _Cmp;
-      __gnu_cxx::__ops::_Iter_comp_iter<_Cmp> __cmp(_GLIBCXX_MOVE(__comp));
-      return std::__is_heap_until(__first, __d, __cmp) == __n;
+      return std::__is_heap_until(__first, __d, __comp) == __n;
     }
 
   template<typename _RandomAccessIterator>
@@ -145,7 +143,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
                _Compare& __comp)
     {
       _Distance __parent = (__holeIndex - 1) / 2;
-      while (__holeIndex > __topIndex && __comp(__first + __parent, __value))
+      while (__holeIndex > __topIndex && __comp(__first[__parent], __value))
        {
          *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __parent));
          __holeIndex = __parent;
@@ -182,7 +180,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       __glibcxx_requires_irreflexive(__first, __last);
       __glibcxx_requires_heap(__first, __last - _DistanceType(1));
 
-      __gnu_cxx::__ops::_Iter_less_val __comp;
+      __gnu_cxx::__ops::less __comp;
       _ValueType __value = _GLIBCXX_MOVE(*(__last - _DistanceType(1)));
       std::__push_heap(__first, _DistanceType((__last - __first) - 1),
                       _DistanceType(0), _GLIBCXX_MOVE(__value), __comp);
@@ -218,11 +216,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       __glibcxx_requires_irreflexive_pred(__first, __last, __comp);
       __glibcxx_requires_heap_pred(__first, __last - _DistanceType(1), __comp);
 
-      __decltype(__gnu_cxx::__ops::__iter_comp_val(_GLIBCXX_MOVE(__comp)))
-       __cmp(_GLIBCXX_MOVE(__comp));
       _ValueType __value = _GLIBCXX_MOVE(*(__last - _DistanceType(1)));
       std::__push_heap(__first, _DistanceType((__last - __first) - 1),
-                      _DistanceType(0), _GLIBCXX_MOVE(__value), __cmp);
+                      _DistanceType(0), _GLIBCXX_MOVE(__value), __comp);
     }
 
   template<typename _RandomAccessIterator, typename _Distance,
@@ -237,8 +233,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       while (__secondChild < (__len - 1) / 2)
        {
          __secondChild = 2 * (__secondChild + 1);
-         if (__comp(__first + __secondChild,
-                    __first + (__secondChild - 1)))
+         if (__comp(__first[__secondChild],
+                    __first[__secondChild - 1]))
            __secondChild--;
          *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild));
          __holeIndex = __secondChild;
@@ -250,10 +246,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
                                                     + (__secondChild - 1)));
          __holeIndex = __secondChild - 1;
        }
-      __decltype(__gnu_cxx::__ops::__iter_comp_val(_GLIBCXX_MOVE(__comp)))
-       __cmp(_GLIBCXX_MOVE(__comp));
       std::__push_heap(__first, __holeIndex, __topIndex,
-                      _GLIBCXX_MOVE(__value), __cmp);
+                      _GLIBCXX_MOVE(__value), __comp);
     }
 
   template<typename _RandomAccessIterator, typename _Compare>
@@ -303,7 +297,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       if (__last - __first > 1)
        {
          --__last;
-         __gnu_cxx::__ops::_Iter_less_iter __comp;
+         __gnu_cxx::__ops::less __comp;
          std::__pop_heap(__first, __last, __last, __comp);
        }
     }
@@ -335,10 +329,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
       if (__last - __first > 1)
        {
-         typedef __decltype(__comp) _Cmp;
-         __gnu_cxx::__ops::_Iter_comp_iter<_Cmp> __cmp(_GLIBCXX_MOVE(__comp));
          --__last;
-         std::__pop_heap(__first, __last, __last, __cmp);
+         std::__pop_heap(__first, __last, __last, __comp);
        }
     }
 
@@ -390,7 +382,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       __glibcxx_requires_valid_range(__first, __last);
       __glibcxx_requires_irreflexive(__first, __last);
 
-      __gnu_cxx::__ops::_Iter_less_iter __comp;
+      __gnu_cxx::__ops::less __comp;
       std::__make_heap(__first, __last, __comp);
     }
 
@@ -416,9 +408,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       __glibcxx_requires_valid_range(__first, __last);
       __glibcxx_requires_irreflexive_pred(__first, __last, __comp);
 
-      typedef __decltype(__comp) _Cmp;
-      __gnu_cxx::__ops::_Iter_comp_iter<_Cmp> __cmp(_GLIBCXX_MOVE(__comp));
-      std::__make_heap(__first, __last, __cmp);
+      std::__make_heap(__first, __last, __comp);
     }
 
   template<typename _RandomAccessIterator, typename _Compare>
@@ -456,7 +446,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       __glibcxx_requires_irreflexive(__first, __last);
       __glibcxx_requires_heap(__first, __last);
 
-      __gnu_cxx::__ops::_Iter_less_iter __comp;
+      __gnu_cxx::__ops::less __comp;
       std::__sort_heap(__first, __last, __comp);
     }
 
@@ -483,9 +473,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       __glibcxx_requires_irreflexive_pred(__first, __last, __comp);
       __glibcxx_requires_heap_pred(__first, __last, __comp);
 
-      typedef __decltype(__comp) _Cmp;
-      __gnu_cxx::__ops::_Iter_comp_iter<_Cmp> __cmp(_GLIBCXX_MOVE(__comp));
-      std::__sort_heap(__first, __last, __cmp);
+      std::__sort_heap(__first, __last, __comp);
     }
 
 #if __cplusplus >= 201103L
@@ -512,7 +500,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       __glibcxx_requires_valid_range(__first, __last);
       __glibcxx_requires_irreflexive(__first, __last);
 
-      __gnu_cxx::__ops::_Iter_less_iter __comp;
+      __gnu_cxx::__ops::less __comp;
       return __first +
        std::__is_heap_until(__first, std::distance(__first, __last), __comp);
     }
@@ -540,10 +528,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       __glibcxx_requires_valid_range(__first, __last);
       __glibcxx_requires_irreflexive_pred(__first, __last, __comp);
 
-      typedef __decltype(__comp) _Cmp;
-      __gnu_cxx::__ops::_Iter_comp_iter<_Cmp> __cmp(_GLIBCXX_MOVE(__comp));
       return __first
-       + std::__is_heap_until(__first, std::distance(__first, __last), __cmp);
+       + std::__is_heap_until(__first, std::distance(__first, __last),
+                              __comp);
     }
 
   /**
@@ -580,9 +567,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       __glibcxx_requires_irreflexive_pred(__first, __last, __comp);
 
       const auto __dist = std::distance(__first, __last);
-      typedef __decltype(__comp) _Cmp;
-      __gnu_cxx::__ops::_Iter_comp_iter<_Cmp> __cmp(_GLIBCXX_MOVE(__comp));
-      return std::__is_heap_until(__first, __dist, __cmp) == __dist;
+      return std::__is_heap_until(__first, __dist, __comp) == __dist;
     }
 #endif
 
index 2badab80a6dc6175a860df9bcf624061218973f4..3b1a7dea2b1006a6e000007cda8b9d938aa400f6 100644 (file)
@@ -109,7 +109,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       const auto __osz = __cont.size();
       const auto __end = __ucont.end();
       auto __removed = std::__remove_if(__ucont.begin(), __end,
-                                       __ops::__pred_iter(std::ref(__pred)));
+                                       std::ref(__pred));
       if (__removed != __end)
        {
          __cont.erase(__niter_wrap(__cont.begin(), __removed),
@@ -130,7 +130,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       const auto __osz = __cont.size();
       const auto __end = __ucont.end();
       auto __removed = std::__remove_if(__ucont.begin(), __end,
-                                       __ops::__iter_equals_val(__value));
+                                       __ops::__equal_to(__value));
       if (__removed != __end)
        {
          __cont.erase(__niter_wrap(__cont.begin(), __removed),
index b5a81bed3c98326dd050a5f8ab03fe4b5e7371ef..b32aa4f3708cbf01478d25fb08870ffb408f1014 100644 (file)
@@ -1343,7 +1343,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       const auto __osz = __cont.size();
       const auto __end = __cont.end();
       auto __removed = std::__remove_if(__cont.begin(), __end,
-                                       __ops::__pred_iter(std::ref(__pred)));
+                                       std::ref(__pred));
       if (__removed != __end)
        {
          __cont.erase(__niter_wrap(__cont.begin(), __removed),
@@ -1362,7 +1362,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       const auto __osz = __cont.size();
       const auto __end = __cont.end();
       auto __removed = std::__remove_if(__cont.begin(), __end,
-                                       __ops::__iter_equals_val(__value));
+                                       __ops::__equal_to(__value));
       if (__removed != __end)
        {
          __cont.erase(__niter_wrap(__cont.begin(), __removed),
index 71864715ff755fb44fbd4b600c16dd8a61a8ac3a..74e0c7f2be5855bdb89eb298b0375cd2c54ff414 100644 (file)
@@ -104,7 +104,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       const auto __osz = __cont.size();
       const auto __end = __cont.end();
       auto __removed = std::__remove_if(__cont.begin(), __end,
-                                       __ops::__pred_iter(std::ref(__pred)));
+                                       std::ref(__pred));
       __cont.erase(__removed, __end);
       return __osz - __cont.size();
     }
@@ -119,7 +119,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       const auto __osz = __cont.size();
       const auto __end = __cont.end();
       auto __removed = std::__remove_if(__cont.begin(), __end,
-                                       __ops::__iter_equals_val(__value));
+                                       __ops::__equal_to(__value));
       __cont.erase(__removed, __end);
       return __osz - __cont.size();
     }
index a98ffb179ec0ebc7900fade334b229f797a3eb95..47105210bc0c64f21f566ce67b7f6e57d81389b6 100644 (file)
@@ -122,7 +122,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       const auto __osz = __cont.size();
       const auto __end = __ucont.end();
       auto __removed = std::__remove_if(__ucont.begin(), __end,
-                                       __ops::__pred_iter(std::ref(__pred)));
+                                       std::ref(__pred));
       if (__removed != __end)
        {
          __cont.erase(__niter_wrap(__cont.begin(), __removed),
@@ -144,7 +144,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       const auto __osz = __cont.size();
       const auto __end = __ucont.end();
       auto __removed = std::__remove_if(__ucont.begin(), __end,
-                                       __ops::__iter_equals_val(__value));
+                                       __ops::__equal_to(__value));
       if (__removed != __end)
        {
          __cont.erase(__niter_wrap(__cont.begin(), __removed),