[PATCH v1 05/12] libstdc++: Eliminate __gnu_cxx::__ops function objects (V)

tkaminsk via Sourceware Forge forge-bot+tkaminsk@forge-stage.sourceware.org
Wed Apr 22 18:44:03 GMT 2026


From: Jonathan Wakely <jwakely@redhat.com>

find_if, search, search_n, count, count_if, copy_if, remove_copy_if

	* include/bits/predefined_ops.h (bind1st, bind2nd, not1)
	(__equal_to): New factory functions for predicates.
	* include/bits/stl_algo.h (__find_if_not, __search_n_aux)
	(__search_n_aux, __remove_copy_if, __replace_copy_if)
	(__is_permutation): Dereference iterators when invoking predicate.
	(find_end, find_if_not, remove_copy, remove_copy_if, remove)
	(remove_if, replace_copy, replace_copy_if, is_permutation, find)
	(find_if, count, count_if, search, search_n): Do not use
	indirect __ops function objects.
	* include/bits/stl_algobase.h (__find_if, __count_if)
	(__remove_if, __search, __is_permutation): Dereference iterators
	when invoking predicates.
	(is_permutation, search): Do not use indirect __ops function
	objects.
	* 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.
---
 libstdc++-v3/include/bits/predefined_ops.h | 171 ++++++++++++++++++++-
 libstdc++-v3/include/bits/stl_algo.h       |  72 ++++-----
 libstdc++-v3/include/bits/stl_algobase.h   |  27 ++--
 libstdc++-v3/include/std/deque             |   4 +-
 libstdc++-v3/include/std/inplace_vector    |   4 +-
 libstdc++-v3/include/std/string            |   4 +-
 libstdc++-v3/include/std/vector            |   4 +-
 7 files changed, 225 insertions(+), 61 deletions(-)

diff --git a/libstdc++-v3/include/bits/predefined_ops.h b/libstdc++-v3/include/bits/predefined_ops.h
index cb7a70ffe347..c6c3505a520e 100644
--- a/libstdc++-v3/include/bits/predefined_ops.h
+++ b/libstdc++-v3/include/bits/predefined_ops.h
@@ -30,8 +30,12 @@
 #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
 {
@@ -42,6 +46,171 @@ namespace __ops
   typedef std::equal_to<void> equal_to;
   typedef std::less<void> less;
 
+#if __cplusplus >= 201103L
+
+  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&>;
+
+  // 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 _Func, typename _Value, bool _Val_2nd = false>
+    struct _Comp_with_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>
+	constexpr bool
+	operator()(_Tp&& __arg) const
+	{
+#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 _Func, typename _Value>
+    constexpr _Comp_with_val<_Func, _Value>
+    bind1st(_Func&& __f, const _Value& __val)
+    { return _Comp_with_val<_Func, _Value>(__f, __val); }
+
+  template<typename _Func, typename _Value>
+    constexpr _Comp_with_val<_Func, _Value, true>
+    bind2nd(_Func&& __f, const _Value& __val)
+    { return _Comp_with_val<_Func, _Value, true>(__f, __val); }
+
+  // Equivalent to bind2nd(equal_to{}, val)
+  template<typename _Value>
+    constexpr _Comp_with_val<equal_to, _Value, true>
+    __equal_to(const _Value& __val)
+    { return _Comp_with_val<equal_to, _Value, true>(equal_to(), __val); }
+
+    template<typename _Func>
+    struct _Unary_negate
+    {
+      using _Fn = __by_ref_or_value_fn<_Func>;
+
+      explicit constexpr
+      _Unary_negate(_Fn __f) : _M_f(__f) { }
+
+      [[__no_unique_address__]] _Fn _M_f;
+
+      template<typename _Tp>
+	constexpr bool
+	operator()(_Tp&& __arg) const { return !_M_f(__arg); }
+    };
+
+  template<typename _Func>
+    constexpr _Unary_negate<_Func>
+    not1(_Func&& __f)
+    { return _Unary_negate<_Func>(__f); }
+
+#else // <= C++11
+
+  template<typename _Fn>
+    struct __by_ref_or_value_fn
+    : __conditional_type<__is_empty(_Fn), _Fn, _Fn&>
+    { };
+
+  template<typename _Fn>
+    struct __by_ref_or_value_fn<_Fn*>
+    { typedef _Fn* __type; };
+
+  // We don't use std::bind1st, std::bind2nd, or std::not1 here because they
+  // require adaptable function objects, i.e. with nested result_type and
+  // either argument_type or first_argument_type and second_argument_type.
+
+  template<typename _Func, typename _Value>
+    struct _Comp_with_val_1st
+    {
+      typedef typename __by_ref_or_value_fn<_Func>::__type _Fn;
+
+      explicit
+      _Comp_with_val_1st(_Fn __f, const _Value& __v)
+      : _M_f(__f), _M_val(__v) { }
+
+      _Fn _M_f;
+      const _Value& _M_val;
+
+      template<typename _Tp>
+	bool operator()(_Tp& __arg) const { return _M_f(_M_val, __arg); }
+      template<typename _Tp>
+	bool operator()(const _Tp& __arg) const { return _M_f(_M_val, __arg); }
+    };
+
+  template<typename _Func, typename _Value>
+    struct _Comp_with_val_2nd
+    {
+      typedef typename __by_ref_or_value_fn<_Func>::__type _Fn;
+
+      explicit
+      _Comp_with_val_2nd(_Fn __f, const _Value& __v)
+      : _M_f(__f), _M_val(__v) { }
+
+      _Fn _M_f;
+      const _Value& _M_val;
+
+      template<typename _Tp>
+	bool operator()(_Tp& __arg) const { return _M_f(__arg, _M_val); }
+      template<typename _Tp>
+	bool operator()(const _Tp& __arg) const { return _M_f(__arg, _M_val); }
+    };
+
+  template<typename _Func, typename _Value>
+    inline _Comp_with_val_1st<_Func, _Value>
+    bind1st(_Func& __f, const _Value& __val)
+    { return _Comp_with_val_1st<_Func, _Value>(__f, __val); }
+
+  template<typename _Func, typename _Value>
+    inline _Comp_with_val_2nd<_Func, _Value>
+    bind2nd(_Func& __f, const _Value& __val)
+    { return _Comp_with_val_2nd<_Func, _Value>(__f, __val); }
+
+  template<typename _Value>
+    inline _Comp_with_val_2nd<equal_to, _Value>
+    __equal_to(const _Value& __val)
+    { return _Comp_with_val_2nd<equal_to, _Value>(equal_to(), __val); }
+
+  template<typename _Func>
+    struct _Unary_negate_1 // N.B. different name for C++98 to satisfy ODR
+    {
+      typedef typename __by_ref_or_value_fn<_Func>::__type _Fn;
+
+      explicit _Unary_negate_1(_Fn __f) : _M_f(__f) { }
+
+      _Fn _M_f;
+
+      template<typename _Tp>
+	bool
+	operator()(_Tp& __arg) const { return !_M_f(__arg); }
+      template<typename _Tp>
+	bool
+	operator()(const _Tp& __arg) const { return !_M_f(__arg); }
+    };
+
+  template<typename _Func>
+    inline _Unary_negate_1<_Func>
+    not1(_Func& __f)
+    { return _Unary_negate_1<_Func>(__f); }
+#endif
+
+
   struct _Iter_less_iter
   {
     template<typename _Iterator1, typename _Iterator2>
diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h
index 056488ba6e36..b606e1f0e2a6 100644
--- a/libstdc++-v3/include/bits/stl_algo.h
+++ b/libstdc++-v3/include/bits/stl_algo.h
@@ -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
@@ -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>
@@ -3124,7 +3121,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;
@@ -3161,8 +3158,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);
     }
 
   /**
@@ -3196,9 +3193,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
@@ -3503,8 +3499,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 __cplusplus > 201103L
@@ -3535,7 +3530,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)
@@ -3556,14 +3551,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;
 	}
@@ -3593,9 +3590,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());
     }
 
   /**
@@ -3624,7 +3620,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 // C++14
 
@@ -3903,7 +3899,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));
     }
 
   /**
@@ -3928,8 +3924,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);
     }
 
   /**
@@ -4085,7 +4080,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));
     }
 
   /**
@@ -4108,8 +4103,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);
     }
 
   /**
@@ -4154,7 +4148,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());
     }
 
   /**
@@ -4185,7 +4179,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));
     }
 
 
@@ -4221,7 +4215,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
diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h
index 820091aee2dc..0393d3318ed8 100644
--- a/libstdc++-v3/include/bits/stl_algobase.h
+++ b/libstdc++-v3/include/bits/stl_algobase.h
@@ -2101,7 +2101,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 +2113,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 +2130,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 +2154,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 +2164,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 +2174,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 +2197,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 +2210,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 +2253,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 +2297,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
diff --git a/libstdc++-v3/include/std/deque b/libstdc++-v3/include/std/deque
index 2badab80a6dc..3b1a7dea2b10 100644
--- a/libstdc++-v3/include/std/deque
+++ b/libstdc++-v3/include/std/deque
@@ -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),
diff --git a/libstdc++-v3/include/std/inplace_vector b/libstdc++-v3/include/std/inplace_vector
index b5a81bed3c98..b32aa4f3708c 100644
--- a/libstdc++-v3/include/std/inplace_vector
+++ b/libstdc++-v3/include/std/inplace_vector
@@ -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),
diff --git a/libstdc++-v3/include/std/string b/libstdc++-v3/include/std/string
index 71864715ff75..74e0c7f2be58 100644
--- a/libstdc++-v3/include/std/string
+++ b/libstdc++-v3/include/std/string
@@ -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();
     }
diff --git a/libstdc++-v3/include/std/vector b/libstdc++-v3/include/std/vector
index a98ffb179ec0..47105210bc0c 100644
--- a/libstdc++-v3/include/std/vector
+++ b/libstdc++-v3/include/std/vector
@@ -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),
-- 
2.54.0



More information about the Gcc-patches mailing list