List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:November 29 2007 1:49pm
Subject:Re: Eyeballs needed on new reference counted pointer template
View as plain text  
Joseph Artsimovich wrote:
>>> (Should probably define a global
>>> swap(x, y) to use this member)
>> Why?
>>
> I am not the original poster, but I can explain that.  The global swap()
> function is usually created so that template code such as std::sort()
> would use class-specific swap() implementation, rather than a generic
> one.

Ah, this also explains why you'd want member swap() to be public.  But 
it begs the question: why would one want to sort a collection of 
refcounted pointers?  Is it even appropriate to do so without comparison 
operators that delegate to the pointed-to-type?

I'm not going to do anything about this immediately, so if someone comes 
up with a reason for needing global swap() and thus keeping member 
swap() public, I'm all ears.  But if I don't hear anything I like before 
the v3 development effort starts winding up, I'm going to hide member 
swap().  If we discover the need for global swap() after v3 is released 
and can't wait for v4 to break the ABI again, we can make it a friend.
Thread
Re: Eyeballs needed on new reference counted pointer templateWarren Young29 Nov
  • Re: Eyeballs needed on new reference counted pointer templateJoseph Artsimovich29 Nov
    • Re: Eyeballs needed on new reference counted pointer templateWarren Young29 Nov
      • Re: Eyeballs needed on new reference counted pointer templateJonathan Wakely30 Nov
        • Re: Eyeballs needed on new reference counted pointer templateWarren Young1 Dec
  • Re: Eyeballs needed on new reference counted pointer templateJonathan Wakely30 Nov
    • Re: Eyeballs needed on new reference counted pointer templateWarren Young1 Dec
  • Re: Eyeballs needed on new reference counted pointer templateJonathan Wakely30 Nov
    • Re: Eyeballs needed on new reference counted pointer templateWarren Young1 Dec