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

Units unary operators are not constexpr #4137

Closed
akmin04 opened this issue Mar 29, 2022 · 1 comment · Fixed by #4138
Closed

Units unary operators are not constexpr #4137

akmin04 opened this issue Mar 29, 2022 · 1 comment · Fixed by #4138

Comments

@akmin04
Copy link

akmin04 commented Mar 29, 2022

Describe the bug
Unary operators on units are not constexpr. Fixed in nholthaus/units#226, but the change not reflected in wpilib's units files (I'm not sure how/when wpilib's version of the units library is updated)

constexpr meter_t x = 1_m; works
constexpr meter_t x = -1_m; doesn't

Desktop (please complete the following information):

  • WPILib Version: 2022.4.1
@calcmogul
Copy link
Member

calcmogul commented Mar 29, 2022

We've permanently forked from them at this point. Having one header with every unit in it had measurably worse compilation time and compiler memory usage compared to separate headers for each unit and a base header for common macro definitions.

When we get C++20, we plan to look into migrating to https://github.com/mpusz/units/.

calcmogul added a commit to calcmogul/allwpilib that referenced this issue Mar 29, 2022
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 a pull request may close this issue.

2 participants