Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/compat/static_arrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ function ComponentArray{A}(::UndefInitializer, ax::Axes) where {
return ComponentArray(similar(A), ax...)
end

_maybe_SArray(x::SubArray, ::Val{N}, ::FlatAxis) where {N} = SVector{N}(x)
function _maybe_SArray(x::Base.ReshapedArray, ::Val, ::ShapedAxis{Sz}) where {Sz}
SArray{Tuple{Sz...}}(x)
function _maybe_SArray(x::SubArray{T}, ::Val{N}, ::FlatAxis) where {T, N}
SVector{N, T}(Tuple(x))
end
function _maybe_SArray(x::Base.ReshapedArray{T, N}, ::Val, ::ShapedAxis{Sz}) where {T, N, Sz}
SArray{Tuple{Sz...}, T, N, prod(Sz)}(Tuple(x))
end
function _maybe_SArray(x::AbstractArray{T}, ::Val, ::Shaped1DAxis{Sz}) where {T, Sz}
SVector{Sz[1], T}(Tuple(x))
end
_maybe_SArray(x, ::Val, ::Shaped1DAxis{Sz}) where {Sz} = SArray{Tuple{Sz...}}(x)
_maybe_SArray(x, vals...) = x

@generated function static_getproperty(ca::ComponentVector, ::Val{s}) where {s}
Expand Down
Loading