From: Warren Young Date: November 29 2007 1:49pm Subject: Re: Eyeballs needed on new reference counted pointer template List-Archive: http://lists.mysql.com/plusplus/7199 Message-Id: <474EC356.6030406@etr-usa.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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.