Closed JohelEGP closed 6 years ago
Ideally lossy conversions would result in warnings rather than compile-time errors (mimicking existing c++ behavior). Nothing obvious springs to mind, but I'll play with it.
The streaming operator for ephemeral units streams coherent derived unit.
Printing an object of type unit<millimeter, int>
fails to compile because converting to its coherent form of type unit<meter, int>
is lossy.
When the conversion to the base unit is lossy, it is a compile-time error. This solution might incur accuracy loss as the unit is converted to a base unit of
double
underlying type.Any idea on how to avoid the accuracy loss?