-
Notifications
You must be signed in to change notification settings - Fork 92
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
Reference specifiers #585
Reference specifiers #585
Conversation
FWIW: As I said on std-proposals, I think For example, IIUC, you want I assume (and seem to confirm by reading https://github.com/mpusz/mp-units/blob/master/docs/users_guide/framework_basics/design_overview.md#point-origin ) that it's already possible to write
(It's certainly possible to write
If those are already true, then I wouldn't expect anything else to be necessary. |
This comment was marked as resolved.
This comment was marked as resolved.
I didn't look at the code; I only read the summary. I like it! Yes, there are questions about the names, but I think the mechanisms are promising. I think it makes the multiply syntax for quantity points less objectionable than usual. It would still be nice if we could find a non-multiplicative spelling. |
@JohelEGP, right! My bad. I just decided not to go with the 3-argument constructor (comma) and replaced that with a multiply syntax in the description without thinking too much about it. Of course, this is a copy-constructor. I just fixed that in the description. Thanks! |
I used But I also like |
I decided to change the specifiers from being functions to variable templates. This is more consistent with the rest of library (e.g. |
Adds
absolute<Reference>
anddelta<Reference>
modifiers that will influence how:Here are the main points of this new design:
delta
by default. This means that42 * m
will create aquantity
and would be the same as calling42 * delta<m>
.42 * absolute<m>
syntax. This will provide an implicit zeroth point origin.4 * deg_C
does not compile4 * delta<deg_C>
creates aquantity
4 * absolute<deg_C>
creates aquantity_point
Please note the above would also apply to Kelvin and Fahrenheit.
The
delta
andabsolute
modifiers are stripped upon construction, so the resulting quantity and quantity_point types will just use the underlying unit in its instantiation.