Skip to content

Commit

Permalink
Update src/MVector.jl
Browse files Browse the repository at this point in the history
Co-authored-by: Neven Sajko <[email protected]>
  • Loading branch information
aplavin and nsajko authored Jan 6, 2025
1 parent 7bb789e commit 3cd1a1f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/MVector.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ end
let dimension_names = QuoteNode.([:x, :y, :z, :w])
body = :(getfield(v, name))
for (i,dim_name) in enumerate(dimension_names)
@eval @inline Base.propertynames(v::Union{SVector{$i},MVector{$i}}, private::Bool = false) =
private ? ($(first(dimension_names, i)...), :data) : ($(first(dimension_names, i)...),)
@eval @inline function Base.propertynames(v::Union{SVector{$i},MVector{$i}}, private::Bool = false)
named_dims = $(first(dimension_names, i)...)
private ? (named_dims..., :data) : named_dims
end

body = :(name === $(dimension_names[i]) ? getfield(v, :data)[$i] : $body)
@eval @inline function Base.getproperty(v::Union{SVector{$i},MVector{$i}},
Expand Down

0 comments on commit 3cd1a1f

Please sign in to comment.