Boost logo

Boost :

From: Niels Dekker - mail address until 2008-12-31 (nd_mail_address_valid_until_2008-12-31_at_[hidden])
Date: 2008-06-19 14:35:59

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"

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

Array support could easily be added to 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
Scientific programmer at LKEB, Leiden University Medical Center 

Boost list run by bdawes at, gregod at, cpdaniel at, john at