From cb289a6e5f8babd4a2c98e0b86fcec7816613ebd Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Wed, 7 Aug 2024 15:18:31 +0530 Subject: [PATCH] fixup! feat: change `remake_buffer` signature, deprecate old one --- src/remake.jl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/remake.jl b/src/remake.jl index 8ffbcaa..40444ae 100644 --- a/src/remake.jl +++ b/src/remake.jl @@ -15,7 +15,13 @@ This method is already implemented for `oldbuffer::AbstractArray` and `oldbuffer and supports static arrays as well. The deprecated version of this method which takes a `Dict` mapping symbols to values -instead of `idxs` and `vals` will dispatch to the new method. +instead of `idxs` and `vals` will dispatch to the new method. In addition if +no `remake_buffer` method exists with the new signature, it will call +`remake_buffer(sys, oldbuffer, Dict(idxs .=> vals))`. + +Note that the new method signature allows `idxs` to be indexes, instead of requiring +that they be symbolic variables. Thus, any type which implements the new method must +also support indexes in `idxs`. """ function remake_buffer(sys, oldbuffer::AbstractArray, idxs, vals) # similar when used with an `MArray` and nonconcrete eltype returns a @@ -48,6 +54,10 @@ function remake_buffer(sys, oldbuffer::AbstractArray, idxs, vals) return newbuffer end +function remake_buffer(sys, oldbuffer, idxs, vals) + remake_buffer(sys, oldbuffer, Dict(idxs .=> vals)) +end + mutable struct TupleRemakeWrapper t::Tuple end