Skip to content

Commit

Permalink
better setall on tuples
Browse files Browse the repository at this point in the history
  • Loading branch information
aplavin committed Feb 26, 2024
1 parent dc42b02 commit 18f85de
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/getsetall.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function setall(obj, ::Properties, vs)
end
setall(obj::Tuple, ::Properties, vs) = setproperties(obj, vs)
setall(obj::NamedTuple{NS}, ::Elements, vs) where {NS} = NamedTuple{NS}(NTuple{length(NS)}(vs))
setall(obj::NTuple{N, Any}, ::Elements, vs) where {N} = (@assert length(vs) == N; NTuple{N}(vs))
setall(obj::NTuple{N, Any}, ::Elements, vs) where {N} = (@assert length(vs) == N; ntuple(i -> vs[i], Val(N)))
setall(obj::AbstractArray, ::Elements, vs::AbstractArray) = (@assert length(obj) == length(vs); reshape(vs, size(obj)))
setall(obj::AbstractArray, ::Elements, vs) = setall(obj, Elements(), collect(vs))
setall(obj::Set, ::Elements, vs) = Set(vs)
Expand Down

0 comments on commit 18f85de

Please sign in to comment.