|
Boost Users : |
Subject: Re: [Boost-users] [utility] swap
From: Robert Jones (robertgbjones_at_[hidden])
Date: 2010-03-05 08:44:23
On Fri, Mar 5, 2010 at 1:37 PM, Neil Groves <neil_at_[hidden]>wrote:
>
>
> On Fri, Mar 5, 2010 at 1:29 PM, Robert Jones <robertgbjones_at_[hidden]>wrote:
>
>> I'm sure I'm being a bit dense here, but apart from handling native arrays
>> what does boost::swap give
>> you that std::swap doesn't?
>>
>>
> Extensibility. You call the qualified boost::swap but you can have
> implementations of swap in a namespace along with the swapee (is that a
> word?!). This facility is hugely useful when creating your own types and
> libraries for which you desire swap support. Users that call boost::swap
> will automatically leverage your customized swap behaviour.
>
>
>
Ahh, so it's a universal solution? "swap(a,b)" would use ADL but not find
std::swap, and "std::swap(a,b)" would not find via ADL, whereas
"boost::swap(a,b)" does both? Ok, cool!
Any many boost libs define a swap(), but not a std::swap()!
- Rob
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net