Skip to content

LiteFX::asShared

Transfers a unique pointer to a shared pointer. The unique pointer will be released during this process.

Synopsis

Declared in <litefx/containers.hpp>

template<class T>
[[nodiscard]] constexpr SharedPtr<T> asShared(UniquePtr<T>&& ptr);

Return Value

A new shared pointer.

Note

The return value should not be discarded.

Template Parameters

NameDescription
TThe type of the object, the pointer points to.

Parameters

NameDescription
ptrThe unique pointer that should be turned into a shared pointer.