swap.hpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright (C) 2007, 2008 Steven Watanabe, Joseph Gauterin, Niels Dekker
  2. //
  3. // Distributed under the Boost Software License, Version 1.0. (See
  4. // accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. // For more information, see http://www.boost.org
  7. #ifndef BOOST_CORE_SWAP_HPP
  8. #define BOOST_CORE_SWAP_HPP
  9. // Note: the implementation of this utility contains various workarounds:
  10. // - boost::swap has two template arguments, instead of one, to
  11. // avoid ambiguity when swapping objects of a Boost type that does
  12. // not have its own boost::swap overload.
  13. #include <boost/core/enable_if.hpp>
  14. #include <boost/config.hpp>
  15. #include <boost/config/header_deprecated.hpp>
  16. #include <boost/core/invoke_swap.hpp>
  17. #ifdef BOOST_HAS_PRAGMA_ONCE
  18. #pragma once
  19. #endif
  20. BOOST_HEADER_DEPRECATED("boost/core/invoke_swap.hpp")
  21. namespace boost
  22. {
  23. template<class T1, class T2>
  24. BOOST_GPU_ENABLED
  25. BOOST_DEPRECATED("This function is deprecated, use boost::core::invoke_swap instead.")
  26. inline typename enable_if_c< !boost_swap_impl::is_const<T1>::value && !boost_swap_impl::is_const<T2>::value >::type
  27. swap(T1& left, T2& right)
  28. {
  29. boost::core::invoke_swap(left, right);
  30. }
  31. }
  32. #endif // BOOST_CORE_SWAP_HPP