mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-04 20:54:28 +02:00
refactor(example): quantity_from_zero()
used in exchange_to
This commit is contained in:
@@ -89,8 +89,7 @@ template<ReferenceOf<currency> auto To, ReferenceOf<currency> auto From, auto PO
|
|||||||
quantity_point<To, PO, Rep> exchange_to(quantity_point<From, PO, Rep> q)
|
quantity_point<To, PO, Rep> exchange_to(quantity_point<From, PO, Rep> q)
|
||||||
{
|
{
|
||||||
return quantity_point{
|
return quantity_point{
|
||||||
static_cast<Rep>(exchange_rate<q.unit, get_unit(To)>() * (q - q.absolute_point_origin).numerical_value_in(q.unit)) *
|
static_cast<Rep>(exchange_rate<q.unit, get_unit(To)>() * q.quantity_from_zero().numerical_value_in(q.unit)) * To};
|
||||||
To};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
Reference in New Issue
Block a user