X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=boost%2Fboost%2Futility%2Fswap.hpp;h=6845e7965b72c7e9dc9ffae09ffdb9b0032bd21d;hb=43c09d723435a5b203f2ac0c39e2086de836b386;hp=85de422c23bc83190c96bc819e96080547f26d18;hpb=1fc4cdd807cbdba7d43ff903e9c75b421f4a4644;p=lyx.git diff --git a/boost/boost/utility/swap.hpp b/boost/boost/utility/swap.hpp index 85de422c23..6845e7965b 100644 --- a/boost/boost/utility/swap.hpp +++ b/boost/boost/utility/swap.hpp @@ -1,55 +1,55 @@ -// Copyright (C) 2007, 2008 Steven Watanabe, Joseph Gauterin, Niels Dekker -// -// 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 - - -#ifndef BOOST_UTILITY_SWAP_HPP -#define BOOST_UTILITY_SWAP_HPP - -// Note: the implementation of this utility contains various workarounds: -// - swap_impl is put outside the boost namespace, to avoid infinite -// recursion (causing stack overflow) when swapping objects of a primitive -// type. -// - swap_impl has a using-directive, rather than a using-declaration, -// because some compilers (including MSVC 7.1, Borland 5.9.3, and -// Intel 8.1) don't do argument-dependent lookup when it has a -// using-declaration instead. -// - boost::swap has two template arguments, instead of one, to -// avoid ambiguity when swapping objects of a Boost type that does -// not have its own boost::swap overload. - -#include //for std::swap -#include //for std::size_t - -namespace boost_swap_impl -{ - template - void swap_impl(T& left, T& right) - { - using namespace std;//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 -{ - template - void swap(T1& left, T2& right) - { - ::boost_swap_impl::swap_impl(left, right); - } -} - -#endif +// Copyright (C) 2007, 2008 Steven Watanabe, Joseph Gauterin, Niels Dekker +// +// 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 + + +#ifndef BOOST_UTILITY_SWAP_HPP +#define BOOST_UTILITY_SWAP_HPP + +// Note: the implementation of this utility contains various workarounds: +// - swap_impl is put outside the boost namespace, to avoid infinite +// recursion (causing stack overflow) when swapping objects of a primitive +// type. +// - swap_impl has a using-directive, rather than a using-declaration, +// because some compilers (including MSVC 7.1, Borland 5.9.3, and +// Intel 8.1) don't do argument-dependent lookup when it has a +// using-declaration instead. +// - boost::swap has two template arguments, instead of one, to +// avoid ambiguity when swapping objects of a Boost type that does +// not have its own boost::swap overload. + +#include //for std::swap +#include //for std::size_t + +namespace boost_swap_impl +{ + template + void swap_impl(T& left, T& right) + { + using namespace std;//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 +{ + template + void swap(T1& left, T2& right) + { + ::boost_swap_impl::swap_impl(left, right); + } +} + +#endif