libycxx

function template

std::exchange

Header
<utility>
Scope
std
cppreference
std::exchange

Synopsis

template<class T, class U = T>
constexpr T exchange(
    T& obj,
    U&& new_val) noexcept(std::is_nothrow_constructible_v<T, T &&> && std::is_nothrow_assignable_v<T &, U &&>);