File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,12 @@ Base.keys(d::AbstractDimensions) = static_fieldnames(typeof(d))
38
38
Base. iszero (d:: AbstractDimensions ) = all_dimensions (iszero, d)
39
39
Base. iszero (q:: AbstractQuantity ) = iszero (ustrip (q))
40
40
Base. getindex (d:: AbstractDimensions , k:: Symbol ) = getfield (d, k)
41
+
42
+ # Compatibility with `.*`
43
+ Base. length (:: Union{AbstractQuantity,AbstractDimensions} ) = 1
44
+ Base. iterate (qd:: Union{AbstractQuantity,AbstractDimensions} ) = (qd, nothing )
45
+ Base. iterate (:: Union{AbstractQuantity,AbstractDimensions} , :: Nothing ) = nothing
46
+
41
47
Base.:(== )(l:: AbstractDimensions , r:: AbstractDimensions ) = all_dimensions (== , l, r)
42
48
Base.:(== )(l:: AbstractQuantity , r:: AbstractQuantity ) = ustrip (l) == ustrip (r) && dimension (l) == dimension (r)
43
49
Base.:(== )(l, r:: AbstractQuantity ) = ustrip (l) == ustrip (r) && iszero (dimension (r))
You can’t perform that action at this time.
0 commit comments