Generic using Arithmetic #1528
Unanswered
byzantium0001
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to create a type in my application that is a generic over unit types and allows arithmetic. Something like this:
The goal would be to have something like:
The trouble I'm having is figuring out how to do arithmetic over the type
T
. I'm not exactly sure how to useIArtihmeticQuantity
because I don't know how to get theIUnitType
fromT
in the type constraint.Is there another way to do arithmetic over a generic type
T
?Can you point me to any examples that do something similar that I can learn from ?
Beta Was this translation helpful? Give feedback.
All reactions