Skip to content

Commit

Permalink
use createinstance
Browse files Browse the repository at this point in the history
  • Loading branch information
piever committed Dec 6, 2023
1 parent df9441b commit 8c772b7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ext/StructArraysSparseArraysExt.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module StructArraysSparseArraysExt

using StructArrays: StructArray, components
using StructArrays: StructArray, components, createinstance
import SparseArrays: sparse, issparse

function sparse(S::StructArray{T}) where {T}
sparse_components = map(sparse, components(S))
T.(sparse_components...)
return createinstance.(T, sparse_components...)
end

issparse(S::StructArray) = all(issparse, components(S))
Expand Down

0 comments on commit 8c772b7

Please sign in to comment.