Boost logo

Boost :

From: Niels Dekker - mail address until 2008-12-31 (nd_mail_address_valid_until_2008-12-31_at_[hidden])
Date: 2008-08-16 03:11:45


David Abrahams wrote:
> Or, you might say that it "swaps" its arguments. Hey, maybe we
> should call it swap(T&,T&)!
>
>> Anyway, its name is not that important,
>
> I think the name is important.

I hope it's clear that at that point we were discussing the name of
boost_swap_impl::swap_impl. Its name would become far more important if
it would become part of the public interface. At the moment, it's only
intended to be an "implementation detail".

On the other hand, the following lines were about the name of the
boost::swap utility:
>> Because of its name, the boost::swap utility is overloaded by swap
>> functions from other Boost libraries. And of course, when boost::swap is
>> called for a type that has its own boost::swap overload, this overload
>> will be called directly. Isn't that nice? :-)

Isaac Dupree wrote:
> On the possibility of calling specific overloads for
> swapping boost types directly, iff we name it "swap": is
> there any compiler where that actually makes a difference?

It clearly saves two function calls. (Boost's swap utility calling
swap_impl, and swap_impl calling the most appropriate swap.) Which
/might/ be relevant when running in debug mode. At least, it wouldn't
harm. :-)

Anyway, I'm certainly in favor of having Boost's swap utility named
boost::swap.

Kind regards, Niels


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk