ΒΆtemplate <class T>
inline constexpr void swap_nonoverlapping(
    ::sus::marker::UnsafeFnMarker,
    T* x,
    T* y,
    sus::num::usize count) noexcept

Description

Swaps the object array at `x` with the object array at `y`, where both arrays have a length of `count`. If `T` is trivially relocatable (`sus::mem::TriviallyRelocatable <T >` is true), then the swap may be done by memcpy() or equivalent to be more efficient. # Safety To avoid Undefined Behaviour, the following must be met: * The pointers `x` and `y` must both be non-null and properly aligned for `T`. * The memory region at `x` and including `count` elements must not overlap the region at `y` including `count` elements. * The objects at `x` and `y` must not have an overlapping object in their tail padding. If `x` and `y` are arrays, or were heap allocated, then this will always be satisfied.

Declared at: sus/ptr/swap.h:45

Templates

T

Parameters

::sus::marker::UnsafeFnMarker
T* x
T* y
sus::num::usize count