shared_ptr comparisons

Jonathan Wakely jwakely.gcc@gmail.com
Tue Nov 16 23:46:00 GMT 2010


Unless I'm mistaken we should only have operators <, == and != for shared_ptr.

Any objections to this change?

Tested x86_64-linux
-------------- next part --------------
Index: include/bits/shared_ptr_base.h
===================================================================
--- include/bits/shared_ptr_base.h	(revision 166459)
+++ include/bits/shared_ptr_base.h	(working copy)
@@ -1098,25 +1098,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     : public _Sp_less<__shared_ptr<_Tp, _Lp>>
     { };
 
-  // XXX LessThanComparable<_Tp> concept should provide >, >= and <=
-  template<typename _Tp, _Lock_policy _Lp>
-    inline bool
-    operator>(const __shared_ptr<_Tp, _Lp>& __a,
-	      const __shared_ptr<_Tp, _Lp>& __b)
-    { return __a.get() > __b.get(); }
-
-  template<typename _Tp, _Lock_policy _Lp>
-    inline bool
-    operator>=(const __shared_ptr<_Tp, _Lp>& __a,
-	       const __shared_ptr<_Tp, _Lp>& __b)
-    { return __a.get() >= __b.get(); }
-
-  template<typename _Tp, _Lock_policy _Lp>
-    inline bool
-    operator<=(const __shared_ptr<_Tp, _Lp>& __a,
-	       const __shared_ptr<_Tp, _Lp>& __b)
-    { return __a.get() <= __b.get(); }
-
   // 2.2.3.8 shared_ptr specialized algorithms.
   template<typename _Tp, _Lock_policy _Lp>
     inline void


More information about the Libstdc++ mailing list