libycxx

function object

std::ranges::swap

Scope
std::ranges

Synopsis

inline constexpr /* implementation-defined */ swap = {};

Call signatures

swap is a function object; these are its call operators as libycxx declares them, written as the functions the draft declares.

  1. template<class T>
      requires (!adl-swappable<T&, T&>) && move-and-assign<T>
    constexpr void swap(
        T& a,
        T& b) noexcept(is_nothrow_constructible(T, T &&) && is_nothrow_assignable(T &, T &&));
    (1)
  2. template<class T, class U>
      requires adl-swappable<T, U>
    constexpr void swap(
        T&& t,
        U&& u) noexcept(noexcept(swap(static_cast<T &&>(t), static_cast<U &&>(u))));
    (2)
  3. template<class T, class U, size_t N>
      requires (!adl-swappable<T (&)[N], U (&)[N]>) && requires(const fn& f, T& a, U& b) { f(
        a,
        b); }
    constexpr void swap(T(& t)[], U(& u)[]) noexcept(noexcept((*this)(*t, *u)));
    (3)