My Project
swap.hpp
Go to the documentation of this file.
1 
28 #ifndef BSL_SWAP_HPP
29 #define BSL_SWAP_HPP
30 
31 #include "cstdint.hpp"
32 #include "move.hpp"
33 #include "enable_if.hpp"
34 #include "is_movable.hpp"
35 #include "is_nothrow_movable.hpp"
36 
37 namespace bsl
38 {
52  template<typename T>
53  constexpr enable_if_t<is_movable<T>::value>
54  swap(T &lhs, T &rhs) noexcept(is_nothrow_movable<T>::value)
55  {
56  T tmp{bsl::move(lhs)};
57  lhs = bsl::move(rhs);
58  rhs = bsl::move(tmp);
59  }
60 }
61 
62 #endif
constexpr enable_if_t< is_movable< T >::value > swap(T &lhs, T &rhs) noexcept(is_nothrow_movable< T >::value)
Swaps the given values.
Definition: swap.hpp:54
constexpr void move(fmt< V > &&val) noexcept=delete
Used to prevent a move of bsl::fmt as it must always be a temporary r-value.
If the provided type is nothrow move assignable and constructible, provides the member constant value...
Definition: is_nothrow_movable.hpp:49