@@ -74,6 +74,7 @@ fieldarrays(s::StructArray) = getfield(s, :fieldarrays)
74
74
Base. getproperty (s:: StructArray , key:: Symbol ) = getfield (fieldarrays (s), key)
75
75
Base. getproperty (s:: StructArray , key:: Int ) = getfield (fieldarrays (s), key)
76
76
Base. propertynames (s:: StructArray ) = fieldnames (typeof (fieldarrays (s)))
77
+ staticschema (:: Type{<:StructArray{T}} ) where {T} = staticschema (T)
77
78
78
79
Base. size (s:: StructArray ) = size (fieldarrays (s)[1 ])
79
80
Base. axes (s:: StructArray ) = axes (fieldarrays (s)[1 ])
97
98
98
99
function Base. setindex! (s:: StructArray , vals, I:: Int... )
99
100
@boundscheck checkbounds (s, I... )
100
- @inbounds foreachcolumn ((col, val) -> (col[I... ] = val), s, vals)
101
+ @inbounds foreachfield ((col, val) -> (col[I... ] = val), s, vals)
101
102
s
102
103
end
103
104
104
105
@inline getfieldindex (v:: Tuple , field:: Symbol , index:: Integer ) = getfield (v, index)
105
106
@inline getfieldindex (v, field:: Symbol , index:: Integer ) = getproperty (v, field)
106
107
107
108
function Base. push! (s:: StructArray , vals)
108
- foreachcolumn (push!, s, vals)
109
+ foreachfield (push!, s, vals)
109
110
return s
110
111
end
111
112
112
113
function Base. append! (s:: StructArray , vals)
113
- foreachcolumn (append!, s, vals)
114
+ foreachfield (append!, s, vals)
114
115
return s
115
116
end
116
117
117
- Base. copyto! (I:: StructArray , J:: StructArray ) = (foreachcolumn (copyto!, I, J); I)
118
+ Base. copyto! (I:: StructArray , J:: StructArray ) = (foreachfield (copyto!, I, J); I)
118
119
119
120
function Base. cat (args:: StructArray... ; dims)
120
121
f = key -> cat ((getproperty (t, key) for t in args). .. ; dims= dims)
@@ -130,7 +131,7 @@ function Base.resize!(s::StructArray, i::Integer)
130
131
end
131
132
132
133
function Base. empty! (s:: StructArray )
133
- foreachcolumn (empty!, s)
134
+ foreachfield (empty!, s)
134
135
end
135
136
136
137
for op in [:hcat , :vcat ]
0 commit comments