Patchwork shared_ptr comparisons

login
register
mail settings
Submitter Jonathan Wakely
Date Nov. 27, 2010, 6:32 p.m.
Message ID <AANLkTikxC+1f2RFXXMuT+74UqNKiDW8bvKGmjh9n+VuN@mail.gmail.com>
Download mbox | patch
Permalink /patch/73286/
State New
Headers show

Comments

Jonathan Wakely - Nov. 27, 2010, 6:32 p.m.
On 17 November 2010 00:42, Paolo Carlini wrote:
> On 11/17/2010 12:46 AM, Jonathan Wakely wrote:
>> Unless I'm mistaken we should only have operators <, == and != for shared_ptr.
>>
>> Any objections to this change?
>>
> Not from me. To be honest I have no idea where those operators comes
> from, and certainly we don't have anything similar for the actual
> std::shared_ptr...

2010-11-27  Jonathan Wakely  <jwakely.gcc@gmail.com>

        * include/bits/shared_ptr_base.h (operator>, operator>=, operator<=):
        Remove comparisons not specified in the C++0x draft.

tested x86_64-linux and committed to trunk
H.J. Lu - Nov. 27, 2010, 11:30 p.m.
On Sat, Nov 27, 2010 at 10:32 AM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On 17 November 2010 00:42, Paolo Carlini wrote:
>> On 11/17/2010 12:46 AM, Jonathan Wakely wrote:
>>> Unless I'm mistaken we should only have operators <, == and != for shared_ptr.
>>>
>>> Any objections to this change?
>>>
>> Not from me. To be honest I have no idea where those operators comes
>> from, and certainly we don't have anything similar for the actual
>> std::shared_ptr...
>
> 2010-11-27  Jonathan Wakely  <jwakely.gcc@gmail.com>
>
>        * include/bits/shared_ptr_base.h (operator>, operator>=, operator<=):
>        Remove comparisons not specified in the C++0x draft.
>
> tested x86_64-linux and committed to trunk
>

This may have caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46689

Patch

Index: include/bits/shared_ptr_base.h
===================================================================
--- include/bits/shared_ptr_base.h	(revision 167056)
+++ 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