From f59ddb399ced64663131ffb923106e497a485eb4 Mon Sep 17 00:00:00 2001 From: Cheng Date: Mon, 21 Apr 2025 19:41:01 +0800 Subject: [PATCH] Return const ref in array::data_shared_ptr --- 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() {