My Project
Functions
swap.hpp File Reference
#include "cstdint.hpp"
#include "move.hpp"
#include "enable_if.hpp"
#include "is_movable.hpp"
#include "is_nothrow_movable.hpp"

Go to the source code of this file.

Functions

template<typename T >
constexpr enable_if_t< is_movable< T >::value > bsl::swap (T &lhs, T &rhs) noexcept(is_nothrow_movable< T >::value)
 Swaps the given values. More...
 

Detailed Description

Function Documentation

◆ swap()

template<typename T >
constexpr enable_if_t<is_movable<T>::value> bsl::swap ( T &  lhs,
T &  rhs 
)
noexcept

Swaps the given values.

#include <bsl/swap.hpp>
#include <bsl/debug.hpp>
namespace bsl
{
inline void
example_swap_overview() noexcept
{
bool val1{};
bool val2{true};
bsl::swap(val1, val2);
if (val1) {
bsl::print() << "success\n";
}
}
}
Template Parameters
Tthe type that defines the values being swapped
Parameters
lhsthe value being swapped with rhs
rhsthe value being swapped with lhs
Returns
return's void
Exceptions
throwsif move construction or assignment of T throws