mpusz / mp-units

The quantities and units library for C++
https://mpusz.github.io/mp-units/
MIT License
997 stars 79 forks source link

refactor: deprecate `QUANTITY_SPEC` #489

Closed JohelEGP closed 10 months ago

JohelEGP commented 10 months ago

https://mpusz.github.io/mp-units/2.0/users_guide/framework_basics/basic_concepts/#QuantitySpec's examples shows: 1693939686 1693939690 1693939694 It seems to me that QUANTITY_SPEC can be refactored into the library by:

  1. Allowing only the first version.
  2. Having the library defer to an implementation detail that does what the second version does when necessary.
  3. The library does what is has to do to make this formulation work.
mpusz commented 10 months ago

I am sorry, but I do not know what you mean. The QUANTITY_SPEC macro is exactly meant to do it depending on the available C++ features. Do you have some other, better solution in mind that does not use macro and does not require duplicating all definitions?

JohelEGP commented 10 months ago

Oh, no, sorry, I was confused. The macro exists to not have to repeat the name of the type being defined. And there currently is no way to workaround the repetition without macros.