Return const ref in array::data_shared_ptr

This commit is contained in:
Cheng 2025-04-21 19:41:01 +08:00
parent b13f2aed16
commit f59ddb399c

View File

@ -339,11 +339,11 @@ class array {
return allocator::allocator().size(buffer());
}
// Return a copy of the shared pointer
// to the array::Data struct
std::shared_ptr<Data> data_shared_ptr() const {
// Return the shared pointer to the array::Data struct
const std::shared_ptr<Data>& data_shared_ptr() const {
return array_desc_->data;
}
// Return a raw pointer to the arrays data
template <typename T>
T* data() {