mpusz / mp-units

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

feat: improve types readability by eliminating extraneous () for a value of a type for references #551

Closed mpusz closed 4 months ago

mpusz commented 4 months ago

improve types readability by eliminating extraneous () for a value of a type for references

-error: no matching function for call to 'Box::Box(quantity<reference<isq::height(), si::metre()>(), int>, quantity<reference<horizontal_length(), si::metre()>(), int>, 
+error: no matching function for call to 'Box::Box(quantity<reference<isq::height, si::metre>(), int>, quantity<reference<horizontal_length, si::metre>(), int>, 
-                                                  quantity<reference<isq::width(), si::metre()>(), int>)'
+                                                  quantity<reference<isq::width, si::metre>(), int>)'
   27 | Box my_box(isq::height(1 * m), horizontal_length(2 * m), isq::width(3 * m));
      |                                                                           ^
-<source>:19:3: note: candidate: 'Box::Box(quantity<reference<horizontal_length(), si::metre()>()>, quantity<reference<isq::width(), si::metre()>()>,
+<source>:19:3: note: candidate: 'Box::Box(quantity<reference<horizontal_length, si::metre>()>, quantity<reference<isq::width, si::metre>()>,
-                                          quantity<reference<isq::height(), si::metre()>()>)'
+                                          quantity<reference<isq::height, si::metre>()>)'
   19 |   Box(quantity<horizontal_length[m]> l, quantity<isq::width[m]> w, quantity<isq::height[m]> h):
      |   ^~~
-<source>:19:38: note:   no known conversion for argument 1 from 'quantity<reference<isq::height(), si::metre()>(),int>'
+<source>:19:38: note:   no known conversion for argument 1 from 'quantity<reference<isq::height, si::metre>(),int>'
-                        to 'quantity<reference<horizontal_length(), si::metre()>(),double>'
+                        to 'quantity<reference<horizontal_length, si::metre>(),double>'
   19 |   Box(quantity<horizontal_length[m]> l, quantity<isq::width[m]> w, quantity<isq::height[m]> h):
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

Resolves #533

Is it worth it?