nholthaus / units

a compile-time, header-only, dimensional analysis and unit conversion library built on c++14 with no dependencies.
http://nholthaus.github.io/units/
MIT License
947 stars 135 forks source link

Make unarary ``operator+()`` and ``operator-()`` ``constexpr`` #226

Closed alexdewar closed 3 years ago

alexdewar commented 5 years ago

These two functions can be safely marked constexpr.

At present, if you try to write:

constexpr meter_t x = -1_m;

you get an error.

This PR fixes this.

JohelEGP commented 5 years ago

Note to self: Check commits between master..v3.x that could be reasonably backported.