swap.hpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /// \file
  2. // Range v3 library
  3. //
  4. // Copyright Eric Niebler 2013-present
  5. //
  6. // Use, modification and distribution is subject to the
  7. // Boost Software License, Version 1.0. (See accompanying
  8. // file LICENSE_1_0.txt or copy at
  9. // http://www.boost.org/LICENSE_1_0.txt)
  10. //
  11. // Project home: https://github.com/ericniebler/range-v3
  12. //
  13. // The implementation of swap (see below) has been adapted from libc++
  14. // (http://libcxx.llvm.org).
  15. #ifndef RANGES_V3_UTILITY_SWAP_HPP
  16. #define RANGES_V3_UTILITY_SWAP_HPP
  17. #include <concepts/swap.hpp>
  18. #include <range/v3/range_fwd.hpp>
  19. #include <range/v3/utility/static_const.hpp>
  20. #include <range/v3/detail/prologue.hpp>
  21. namespace ranges
  22. {
  23. template<typename T>
  24. using is_swappable = concepts::is_swappable<T>;
  25. template<typename T>
  26. using is_nothrow_swappable = concepts::is_nothrow_swappable<T>;
  27. template<typename T, typename U>
  28. using is_swappable_with = concepts::is_swappable_with<T, U>;
  29. template<typename T, typename U>
  30. using is_nothrow_swappable_with = concepts::is_nothrow_swappable_with<T, U>;
  31. using concepts::exchange;
  32. /// \ingroup group-utility
  33. /// \relates concepts::adl_swap_detail::swap_fn
  34. RANGES_DEFINE_CPO(uncvref_t<decltype(concepts::swap)>, swap)
  35. namespace cpp20
  36. {
  37. using ranges::swap;
  38. }
  39. } // namespace ranges
  40. #include <range/v3/detail/epilogue.hpp>
  41. #endif