We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d99febb commit eb29a36Copy full SHA for eb29a36
src/utils.jl
@@ -25,7 +25,9 @@ end
25
return output
26
end
27
28
-Base.convert(::Type{Number}, q::AbstractQuantity) = q
+for (type, base_type, _) in ABSTRACT_QUANTITY_TYPES
29
+ @eval Base.convert(::Type{$base_type}, q::$type) = q
30
+end
31
function Base.convert(::Type{T}, q::UnionAbstractQuantity) where {T<:Number}
32
@assert iszero(dimension(q)) "$(typeof(q)): $(q) has dimensions! Use `ustrip` instead."
33
return convert(T, ustrip(q))
0 commit comments