Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2008-06-20 20:40:33


Apologies in advance for overquoting; iPhone doesn't make it easy to
cut lot of text.

Whether or not this is a good idea depends on whether you think swap
is fundamentally an O(1) and/or nonthrowing operation.

Sent from my iPhone

On Jun 19, 2008, at 2:35 PM, "Niels Dekker - mail address until
2008-12-31" <nd_mail_address_valid_until_2008-12-31_at_[hidden]> wrote:

> Hi Joe, hi Steven,
>
> Would it be okay to you if we would add support for array types to
> the Boost.Swap utility that is located in the sandbox?
>
> I'm asking now, because I wrote an issue, asking the C++ Standards
> Committee to add an overload of std::swap for array types. And
> Howard Hinnant just mailed me the other day that the issue has
> reached status Ready. :-)
> LWG issue 809, "std::swap should be overloaded for array types"
> http://home.twcny.rr.com/hinnant/cpp_extensions/issues_preview/lwg-active.html#809
>
> Of course, it will still take a while before STL implementations
> will actually add such an std::swap overload. It isn't yet part of
> the Standard, officially. So I would very much appreciate if
> boost::swap would already start supporting array types. And I think
> it would be helpful when implementing swap member functions for
> templates like boost::value_initialized<T>.
>
> Array support could easily be added to swap/boost/utility/swap.hpp
> (http://svn.boost.org/trac/boost/browser/sandbox/swap/boost/utility/swap.hpp
> ), by overloading boost_swap_impl::swap_impl, as follows:
>
> template<class T, std::size_t N>
> void swap_impl(T (& left)[N], T (& right)[N])
> {
> for (std::size_t i = 0; i < N; ++i)
> {
> ::boost_swap_impl::swap_impl(left[i], right[i]);
> }
> }
>
> Please tell me what you think. I do have SVN write access, so I
> wouldn't mind committing the necessary changes. :-)
>
> Kind regards,
> --
> Niels Dekker
> http://www.xs4all.nl/~nd/dekkerware
> Scientific programmer at LKEB, Leiden University Medical Center
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>


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