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

refactor!: replace one_rep with reference<D, U> #261

Merged
merged 15 commits into from
Mar 18, 2021
Merged

Conversation

JohelEGP
Copy link
Collaborator

@JohelEGP JohelEGP commented Mar 17, 2021

Resolves #243.

Drive-by:

  • Add rad unit constant.
  • Use pragmas for -Wshadow and -Wmissing-braces.

Copy link
Owner

@mpusz mpusz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!!! Thanks!

Please see my comments...

src/core/include/units/quantity.h Outdated Show resolved Hide resolved
src/core/include/units/quantity.h Outdated Show resolved Hide resolved
src/core/include/units/quantity.h Outdated Show resolved Hide resolved
src/core/include/units/reference.h Outdated Show resolved Hide resolved
src/core/include/units/reference.h Outdated Show resolved Hide resolved
src/core/include/units/reference.h Outdated Show resolved Hide resolved
@JohelEGP
Copy link
Collaborator Author

Note to self: Update docs.

@JohelEGP
Copy link
Collaborator Author

While it looks great in code, I'm not sure about updating the documentation from "unit constant(s)" to "reference(s)". I'll keep those as "unit reference(s)".

@mpusz
Copy link
Owner

mpusz commented Mar 18, 2021

"quantity references"?

src/core/include/units/quantity.h Outdated Show resolved Hide resolved
src/core/include/units/quantity.h Outdated Show resolved Hide resolved
src/core/include/units/reference.h Outdated Show resolved Hide resolved
test/unit_test/static/unit_constants.cpp Show resolved Hide resolved
src/core/include/units/reference.h Outdated Show resolved Hide resolved
@mpusz
Copy link
Owner

mpusz commented Mar 18, 2021

BTW, while adding Hidden Friends please always add:

  // Hidden Friends
  // Below friend functions are to be found via argument-dependent lookup only

See more in http://wg21.link/p1601.

@JohelEGP
Copy link
Collaborator Author

There's https://wg21.link/hidden.friends now. Should I still add that?

@mpusz
Copy link
Owner

mpusz commented Mar 18, 2021

Yes, I believe we should add those as later on it may be needed to provide appropriate Remarks: ... clause while writing standardeese. Those comments are meant to remind us about this.

@JohelEGP
Copy link
Collaborator Author

The standard iterator and range adaptors have no such wording. [hidden.friends] makes that redundant.

@mpusz
Copy link
Owner

mpusz commented Mar 18, 2021

I believe that this paper was provided only recently and it is a recommendation for the upcoming proposals. Anyway, I hope we will be able to check this in practice in a few years from now ;-)

@JohelEGP
Copy link
Collaborator Author

The docs: commit is for the header files. The .rst under docs/ will come later.

Copy link
Owner

@mpusz mpusz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

test/unit_test/static/CMakeLists.txt Outdated Show resolved Hide resolved
@JohelEGP
Copy link
Collaborator Author

JohelEGP commented Mar 18, 2021

All that's left is updating the docs.

+And removing `width{0} / m` too.

Copy link
Owner

@mpusz mpusz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thanks!!!

@mpusz mpusz merged commit 376c402 into mpusz:master Mar 18, 2021
mpusz pushed a commit that referenced this pull request Mar 18, 2021
mpusz pushed a commit that referenced this pull request Mar 18, 2021
mpusz pushed a commit that referenced this pull request Mar 18, 2021
mpusz pushed a commit that referenced this pull request Mar 18, 2021
mpusz pushed a commit that referenced this pull request Mar 18, 2021
@mpusz mpusz added the enhancement New feature or request label Mar 18, 2021
@JohelEGP JohelEGP deleted the reference branch March 18, 2021 21:39
Comment on lines +111 to +115
template<QuantityValue Rep>
[[nodiscard]] friend constexpr Quantity auto operator/(const Rep& lhs, reference)
{
return lhs / quantity<D, U, Rep>::one();
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is no use for this operator? Probably we should get rid of it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess so. Right now, it's a shortcut for 33 / (1 * s).

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case I would also prefer to be explicit. With this our * serves exactly as in a quantity notation.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So let's get rid of it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. #262 does that.

JohelEGP added a commit to JohelEGP/units-1 that referenced this pull request Mar 18, 2021
mpusz pushed a commit that referenced this pull request Mar 19, 2021
@mpusz mpusz added this to the v0.7.0 milestone May 10, 2021
benediktmoedl pushed a commit to benediktmoedl/mp-units-src that referenced this pull request Sep 4, 2023
benediktmoedl pushed a commit to benediktmoedl/mp-units-src that referenced this pull request Sep 4, 2023
benediktmoedl pushed a commit to benediktmoedl/mp-units-src that referenced this pull request Sep 4, 2023
benediktmoedl pushed a commit to benediktmoedl/mp-units-src that referenced this pull request Sep 4, 2023
benediktmoedl pushed a commit to benediktmoedl/mp-units-src that referenced this pull request Sep 4, 2023
benediktmoedl pushed a commit to benediktmoedl/mp-units-src that referenced this pull request Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

refactor!: replace one_rep and unit constants with reference<Dimension, Unit>
2 participants