On Fri, Mar 5, 2010 at 1:37 PM, Neil Groves <neil@grovescomputing.com> wrote:


On Fri, Mar 5, 2010 at 1:29 PM, Robert Jones <robertgbjones@gmail.com> 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