Template Function librapid::detail::safePointerCopy(T *, size_t, bool)#

Function Documentation#

template<typename T>
std::shared_ptr<T> librapid::detail::safePointerCopy(T *ptr, size_t size, bool ownsData)#

Safely copy a pointer to a shared pointer. If ownsData is true, then the shared pointer will be initialized with a custom deleter that will call safeDeallocate on the pointer. Otherwise, the shared pointer will be initialized with a no-op deleter.

Template Parameters

T – Type of the pointer

Parameters
  • ptr – Raw pointer to copy

  • ownsData – Whether the shared pointer should own the data

Returns

Shared pointer to the data