Index: swap.hpp =================================================================== --- swap.hpp (revision 46869) +++ swap.hpp (working copy) @@ -1,15 +1,19 @@ -// Copyright (C) 2007 Steven Watanabe, Joseph Gauterin +// Copyright (C) 2007, 2008 Steven Watanabe, Joseph Gauterin // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // For more information, see http://www.boost.org +// +// Update: +// 29 June 2008 (Added support for built-in arrays.) Niels Dekker #ifndef BOOST_UTILITY_SWAP_HPP #define BOOST_UTILITY_SWAP_HPP #include //for std::swap +#include //for std::size_t namespace boost_swap_impl { @@ -19,6 +23,15 @@ using std::swap;//use std::swap if argument dependent lookup fails swap(left,right); } + + template + 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]); + } + } } namespace boost