CGAL / cgal

The public CGAL repository, see the README below
https://github.com/CGAL/cgal#readme
Other
4.88k stars 1.38k forks source link

[RFE] Support for mp-units in CGAL #8270

Open lrineau opened 3 months ago

lrineau commented 3 months ago

Previous discussion, in a PR

However, if I understand correctly, you already use fundamental unsafe types in your interfaces. If so, you can easily conditionally add additional type-safe overloads to them.

In case you already have some Simple strong-type wrappers for units, mp-units provides powerful conversation traits that give us full control of how we can interact with such interfaces.

Originally posted by @mpusz in https://github.com/CGAL/cgal/issues/8262#issuecomment-2157785595

Proposal for enhancement

In CGAL::Epick, we could try to support mp-units's abstraction for the affine space (in our case that would be the 2D and 3D Euclidean spaces).

That would be a way to verify if CGAL is correct about units.

If the CGAL kernel testsuite passes with a variant of Epick using mp-units, that would be a big achievement.

chiphogg commented 3 months ago

mp-units is an excellent library. However, I understand from that issue that in order to use it, you would need to add macros to disable that support for C++17 users, which seems undesirable.

There are other high-quality modern C++ units libraries that have a less stringent minimum version requirement. In particular, many are compatible with C++14, and more still with C++17. Here's a GitHub query giving a list of C++ units libraries.

I've done a detailed feature comparison of the top libraries by GitHub stars, plus Boost Units. (Full disclosure: I'm the author of one of these libraries, and the comparison is hosted on its documentation website.)

Before picking a library to use, it might be good to compare the feature diff between mp-units and the best C++17-compatible alternative. Then, decide whether those extra features for the C++20 users are worth completely excluding the C++17 users.