quantity_point::quantity_from(PointOrigin) was added as a type safety interface over the previous getter quantity_point::quantity_from_origin() which was deemed unsafe.
Also, we now have quantity_point::quantity_ref_from(PointOrigin) that returns the reference to the underlying storage if the provided origin is the same as the one used in the quantity_point.
The question is, should we add an overload quantity_point::quantity_from(QuantityPoint) that takes QuantityPoint as an argument? I can see some benefits from doing so. On the other hand, quantity_point::quantity_ref_from(QuantityPoint) has no sense and should not be exposed.
quantity_from just subtracts the argument from *this, so it is not something that is complicated, and the user could not easily do it just with a subtraction. It was added mostly to extend quantity_point::quantity_ref_from(QuantityPoint), which had to be there. Also, I noticed that it helps do subtraction in the correct order. I already made the mistake of accidentally exchanging the argument, and I got a negative quantity as a result when a positive one was expected.
quantity_point::quantity_from(PointOrigin)
was added as a type safety interface over the previous getterquantity_point::quantity_from_origin()
which was deemed unsafe.Also, we now have
quantity_point::quantity_ref_from(PointOrigin)
that returns the reference to the underlying storage if the provided origin is the same as the one used in thequantity_point
.The question is, should we add an overload
quantity_point::quantity_from(QuantityPoint)
that takesQuantityPoint
as an argument? I can see some benefits from doing so. On the other hand,quantity_point::quantity_ref_from(QuantityPoint)
has no sense and should not be exposed.quantity_from
just subtracts the argument from*this
, so it is not something that is complicated, and the user could not easily do it just with a subtraction. It was added mostly to extendquantity_point::quantity_ref_from(QuantityPoint)
, which had to be there. Also, I noticed that it helps do subtraction in the correct order. I already made the mistake of accidentally exchanging the argument, and I got a negative quantity as a result when a positive one was expected.