-
Notifications
You must be signed in to change notification settings - Fork 87
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: unit constants #184
feat: unit constants #184
Conversation
d98ff74
to
8e316ea
Compare
This comment has been minimized.
This comment has been minimized.
bc67845
to
95e1c52
Compare
|
0f646bb
to
8133fba
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like this approach. Thanks!
However, in order to be able to merge it, CI issues have to be resolved first.
Thank you. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
435b3fe
to
ef0c616
Compare
This comment has been minimized.
This comment has been minimized.
Here's the time taken by the main step of the CI.
|
ef0c616
to
f052b1a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for all those massive changes. A lot of good work!
I have two general comments:
- When we leave some code commented out it would be good to provide a comment on why it is commented out.
- Please use
TODO
comments if we should return to some lines of code in the future
and one question:
- Do you think that we need
*_per_*
constants? It is good to have them for now to experiment, but I think that it might be better to just use* / *
syntax which probably is easier to understand? It also allows fewer values to maintain and potentially standardize in the future. What is your experience here?
src/include/units/bits/one_rep.h
Outdated
return lhs; | ||
} | ||
template<QuantityValue Rep> | ||
[[nodiscard]] friend constexpr Rep operator*(one_rep, const Rep& rhs) // pending #185 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add TODO
in a comment so it will be easier to find and resolve.
BTW, I really recommend Todo Tree VS Code extension.
template<QuantityValue Rep> | ||
[[nodiscard]] constexpr operator Rep() const noexcept | ||
{ | ||
return quantity_values<Rep>::one(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:-)
This seems to happen when an |
I do not think we should be concerned about it. This library is designed with C++20 modules in mind. Everything we will predefine in the library will be compiled once and will speed up the compilation of the users' code later on. Also, now when I fixed VS compilation again and provided a CI for it, I plan to play a bit with vcperf to analyze and possibly improve the build times. Another round of compile-time optimization will come when clang will finally catch up... |
|
||
static_assert(2 * m == 2_q_m); | ||
static_assert(2 * s == 2_q_s); | ||
#if !defined(_MSC_VER) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please use COMP_MSVC
?
BTW, if you feel we can do better here, we can think about an alternative/better way to refer to compilers in a unified way...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For starters, all kind of global identifiers should be "namespaced". In this case, they should be prefixed with UNITS_
or MP_UNITS_
(just like the CMake options).
They should definitely go away. The purpose is to have natural syntax. |
791d1ef
to
89359ca
Compare
89359ca
to
2a522e3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!!!
Resolves #160.
Resolves #48.
The tests handles all comments raised in #48.