Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static arrays: index & property access #261

Closed
aplavin opened this issue Jan 11, 2023 · 0 comments
Closed

Static arrays: index & property access #261

aplavin opened this issue Jan 11, 2023 · 0 comments

Comments

@aplavin
Copy link
Member

aplavin commented Jan 11, 2023

Static arrays support accessing by index or by property name:

julia> using StaticArrays, StructArrays

julia> v = SVector(1, 2)

julia> v[1]
1

julia> v.x
1

However, a struct array of static arrays can only retrieve components by index:

julia> a = StructArray([v])
1-element StructArray(::Vector{Int64}, ::Vector{Int64}) with eltype SVector{2, Int64}:
 [1, 2]

julia> a.:1
1-element Vector{Int64}:
 1

julia> a.x
ERROR: type Tuple has no field x

Can both be supported? I understand this isn't straightforward, but would be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant