Closed knatten closed 4 years ago
Thanks for the PR! I clearly see the point of adding those operators. To give more flexibility, what would you think of breaking down the skills into UnarySubtractable and BinarySubtractable, with Subtractable being the combination of the two? I'll accept your PR, and break down Subtractable into two. Let me know what you think!
Fyi here is the commit to break them down: https://github.com/joboccara/NamedType/commit/d7828c6295863ff2f4af021682a1778807f98746
I like that idea! Thanks for accepting the PR.
Unary minus is needed to make user defined literals work nicely, since the minus is not a part of the literal, but rather applied as a unary operator afterwards. For instance:
The last line will first construct a
DegreesCelcius{45.}
, and then applyoperator-
to it.I also included unary plus in
Addable
for symmetry, even if it's a lot less useful than unary minus.(The compilation error in
main.cpp
is also fixed in #30, but I included it here as well so it's possible to run tests.)