Ticket #2056: array_support_for_sandbox_swap.patch
File array_support_for_sandbox_swap.patch, 1.1 KB (added by , 14 years ago) |
---|
-
swap.hpp
1 // Copyright (C) 2007 Steven Watanabe, Joseph Gauterin1 // Copyright (C) 2007, 2008 Steven Watanabe, Joseph Gauterin 2 2 // 3 3 // Distributed under the Boost Software License, Version 1.0. (See 4 4 // accompanying file LICENSE_1_0.txt or copy at 5 5 // http://www.boost.org/LICENSE_1_0.txt) 6 6 // For more information, see http://www.boost.org 7 // 8 // Update: 9 // 29 June 2008 (Added support for built-in arrays.) Niels Dekker 7 10 8 11 9 12 #ifndef BOOST_UTILITY_SWAP_HPP 10 13 #define BOOST_UTILITY_SWAP_HPP 11 14 12 15 #include <algorithm> //for std::swap 16 #include <cstddef> //for std::size_t 13 17 14 18 namespace boost_swap_impl 15 19 { … … 19 23 using std::swap;//use std::swap if argument dependent lookup fails 20 24 swap(left,right); 21 25 } 26 27 template<class T, std::size_t N> 28 void swap_impl(T (& left)[N], T (& right)[N]) 29 { 30 for (std::size_t i = 0; i < N; ++i) 31 { 32 ::boost_swap_impl::swap_impl(left[i], right[i]); 33 } 34 } 22 35 } 23 36 24 37 namespace boost