¶template <class T>
void copy_nonoverlapping(
::sus::marker::UnsafeFnMarker,
const T* src,
T* dst,
::sus::num::usize count) noexcept
template <class T>
void copy_nonoverlapping(
::sus::marker::UnsafeFnMarker,
const T* src,
T* dst,
::sus::num::usize count) noexcept
Description
Copies `count * size_of <T >()` bytes from `src` to `dst`. The source and destination must not overlap. For regions of memory which might overlap, use [`copy`]($sus::ptr::copy) instead. [`copy_nonoverlapping`]($sus::ptr::copy_nonoverlapping) is semantically equivalent to [`memcpy`](https://en.cppreference.com/w/cpp/string/byte/memcpy), but with the argument order swapped. The copy is “untyped” in the sense that data may be uninitialized or otherwise violate the requirements of `T`. The initialization state is preserved exactly. # Panics This function will panic if the number of bytes, `count * size_of <T >()`, overflows. # Safety Behavior is undefined if any of the following conditions are violated: * `src` must be valid for reads of `count * size_of <T >()` bytes. * `dst` must be valid for writes of `count * size_of <T >()` bytes. * The region of memory beginning at `src` with a size of `count * size_of <T >()` bytes must not overlap with the region of memory beginning at `dst` with the same size. * `dst` must not have an overlapping object in its tail padding. If `dst` is in an array, or was heap allocated, then this will always be satisfied. Like [`copy`]($sus::ptr::copy), [`copy_nonoverlapping`]($sus::ptr::copy_nonoverlapping) creates a bitwise copy of `T`, regardless of whether `T` is [`TrivialCopy`]($sus::mem::TrivialCopy) or [`TriviallyRelocatable`]($sus::mem::TriviallyRelocatable). If `T` is not [`TrivialCopy`]($sus::mem::TrivialCopy), using the value in `*dst` can violate memory safety. If `T` is not [`TriviallyRelocatable`]($sus::mem::TriviallyRelocatable), using both the values in `*src` and in `*dst` can violate memory safety. Note that even if the effectively copied size (`count * size_of <T >()`) is 0, the pointers must be non-null and properly aligned.
Declared at: sus/ptr/copy.h:70
Templates
- T
Parameters
- ::sus::marker::UnsafeFnMarker
- const T* src
- T* dst
- ::sus::num::usize count