Hacker News new | ask | show | jobs
by einpoklum 487 days ago
In C++, there are a few very nice libraries for computation with units, e.g.:

https://github.com/mpusz/mp-units

which does all sorts of checking, allows arithmetic with proper accounting for units and so on. But yes, the basic notion is wrapping things in structs which can't be simply assigned to each other.