Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 5 commits into from
Feb 21, 2024

Conversation

mpusz
Copy link
Owner

@mpusz mpusz commented Feb 5, 2024

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?

@mpusz mpusz merged commit cc05323 into master Feb 21, 2024
119 checks passed
@mpusz mpusz deleted the typed_references branch February 21, 2024 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider using two types instead of values for the template parameters of the reference type
2 participants