@@ -16,11 +16,12 @@ julia> ev[2]
16
16
0x0000000000000002
17
17
```
18
18
"""
19
- struct StaticElementVector{N,S,C}
19
+ struct StaticElementVector{N,S,C} <: AbstractVector{UInt64}
20
20
data:: NTuple{C,UInt64}
21
21
end
22
22
23
23
Base. length (:: StaticElementVector{N,S,C} ) where {N,S,C} = N
24
+ Base. size (:: StaticElementVector{N,S,C} ) where {N,S,C} = (N,)
24
25
Base.:(== )(x:: StaticElementVector , y:: AbstractVector ) = [x... ] == [y... ]
25
26
Base.:(== )(x:: AbstractVector , y:: StaticElementVector ) = [x... ] == [y... ]
26
27
Base.:(== )(x:: StaticElementVector{N,S,C} , y:: StaticElementVector{N,S,C} ) where {N,S,C} = x. data == y. data
@@ -137,6 +138,7 @@ function Base.iterate(x::StaticElementVector{N,S,C}, state=1) where {N,S,C}
137
138
end
138
139
139
140
Base. show (io:: IO , t:: StaticElementVector ) = Base. print (io, " $(join (Int .(t), " " )) " )
141
+ Base. show (io:: IO , :: MIME"text/plain" , t:: StaticElementVector ) = Base. show (io, t)
140
142
141
143
function Base. count_ones (x:: StaticBitVector )
142
144
sum (v-> count_ones (v),x. data)
@@ -166,4 +168,4 @@ function parse_vector(nflavor::Int, str::String)
166
168
end
167
169
end
168
170
return StaticElementVector (nflavor, val)
169
- end
171
+ end
0 commit comments