
Thanks for all your feedback, David, Frank, Steven, Howard, and Matt. I think it's safe to conclude that we agree by now that it's acceptable for boost::array to have a custom swap function, and that it would be acceptable for boost::swap to support built-in arrays. So I'll create a ticket, requesting built-in array support for boost::swap, referring to our discussion, and including a patch. It may be slightly unusual to create a ticket for an item that's still in the sandbox, but I guess it's the best I can do right now. I'll create two more tickets, for boost::array and boost::value_initialized: boost::array<T,N>::swap doesn't always use the custom swap of T, if there is one. And value_initialized<T> should have a custom swap overload as well. Both of these two issues can be solved very elegantly when boost::swap is patched, and moved from the sandbox to the trunk.
Within generic code, people typically use the well-known idiom to swap a pair of Swappable objects:
// Allow argument-dependent lookup to find a custom swap. using std::swap; swap(lhs, rhs);
As long as boost::swap hasn't come out of the sandbox, of course (hint)!
??
Once boost::swap is out, the "using std::swap" idiom doesn't need to be used anymore. My "hint" was just an attempt to draw the attention of anyone involved, hoping to get boost::swap out of the sandbox... It very much looks like it's ready for review, having documentation and tests included: http://svn.boost.org/svn/boost/sandbox/swap/ But I guess it very much depends on when Joseph Gauterin, the first author, has found the time... Kind regards, Niels