diff --git a/src/broadcasting.jl b/src/broadcasting.jl index c4cbd543..220c6ef6 100644 --- a/src/broadcasting.jl +++ b/src/broadcasting.jl @@ -71,10 +71,7 @@ end # of respecting Union eltypes than the default method in Base. function Base.Broadcast.broadcasted(f, x::ComponentArray) data = getdata(x) - new_data = similar(data) - @inbounds for i in eachindex(data) - new_data[i] = f(data[i]) - end + new_data = map(f, x) return ComponentArray(new_data, getaxes(x)) end @@ -116,4 +113,4 @@ function fill_flat(Ax::VarAxes, N) axs = (axs..., ntuple(x -> FlatAxis(), N-n)...) end return axs -end \ No newline at end of file +end