Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion include/matx/core/storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ namespace matx
}
}

// Constructor from existing shared_ptr
Storage(std::shared_ptr<T> ptr, size_t size)
: size_(size), data_(ptr) {}

// Owning constructor with memory space
Storage(size_t size, matxMemorySpace_t space, cudaStream_t stream = 0)
: size_(size) {
Expand Down Expand Up @@ -193,7 +197,15 @@ namespace matx
return Storage<T>(size, space, stream);
}

/**
/**
* @brief Factory function to create storage from existing shared_ptr
*/
template <typename T>
Storage<T> make_storage_from_shared_ptr(std::shared_ptr<T> ptr, size_t size) {
return Storage<T>(ptr, size);
}

/**
* @brief Factory function to create non-owning storage
*/
template <typename T>
Expand Down