From 70ebc3b5989991140812fbc3c99fbec4e3d1305e Mon Sep 17 00:00:00 2001 From: Cheng Date: Mon, 21 Apr 2025 22:17:09 +0800 Subject: [PATCH] Return const ref in array::data_shared_ptr (#2100) --- mlx/array.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mlx/array.h b/mlx/array.h index d690dcd97..66a4702a6 100644 --- a/mlx/array.h +++ b/mlx/array.h @@ -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_shared_ptr() const { + // Return the shared pointer to the array::Data struct + const std::shared_ptr& data_shared_ptr() const { return array_desc_->data; } + // Return a raw pointer to the arrays data template T* data() {