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 BHO_CORE_SWAP_HPP
  8. #define BHO_CORE_SWAP_HPP
  9. // Note: the implementation of this utility contains various workarounds:
  10. // - bho::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 bho::swap overload.
  13. #include <asio2/bho/core/enable_if.hpp>
  14. #include <asio2/bho/config.hpp>
  15. #include <asio2/bho/config/header_deprecated.hpp>
  16. #include <asio2/bho/core/invoke_swap.hpp>
  17. #ifdef BHO_HAS_PRAGMA_ONCE
  18. #pragma once
  19. #endif
  20. BHO_HEADER_DEPRECATED("asio2/bho/core/invoke_swap.hpp")
  21. namespace bho
  22. {
  23. template<class T1, class T2>
  24. BHO_GPU_ENABLED
  25. BHO_DEPRECATED("This function is deprecated, use bho::core::invoke_swap instead.")
  26. inline typename enable_if_c< !bho_swap_impl::is_const<T1>::value && !bho_swap_impl::is_const<T2>::value >::type
  27. swap(T1& left, T2& right)
  28. {
  29. bho::core::invoke_swap(left, right);
  30. }
  31. }
  32. #endif // BHO_CORE_SWAP_HPP