ΒΆtemplate <class T>
inline constexpr T clone_or_forward(
    const std::remove_reference_t<T>&
        source) noexcept

Description

Clones the input either by copying or cloning, producing an object of type `T`. As with [`forward`]($sus::mem::forward), the template argument `T` must always be specified when calling this function to deduce the correct return type. If `T` is a reference type, it copies and returns the reference instead of the underlying object.

Declared at: sus/mem/clone.h:131

Templates

T

Parameters

const std::remove_reference_t<T>& source