Skip to content

Commit

Permalink
Make unarary operator+() and operator-() constexpr (#226)
Browse files Browse the repository at this point in the history
Co-authored-by: Nic Holthaus <nholthaus@gmail.com>
  • Loading branch information
alexdewar and nholthaus committed Oct 7, 2020
1 parent 0cab85a commit 37a3175
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/units.h
Expand Up @@ -2309,7 +2309,7 @@ namespace units

// unary addition: +T
template<class Units, typename T, template<typename> class NonLinearScale>
inline unit_t<Units, T, NonLinearScale> operator+(const unit_t<Units, T, NonLinearScale>& u) noexcept
constexpr inline unit_t<Units, T, NonLinearScale> operator+(const unit_t<Units, T, NonLinearScale>& u) noexcept
{
return u;
}
Expand All @@ -2333,7 +2333,7 @@ namespace units

// unary addition: -T
template<class Units, typename T, template<typename> class NonLinearScale>
inline unit_t<Units, T, NonLinearScale> operator-(const unit_t<Units, T, NonLinearScale>& u) noexcept
constexpr inline unit_t<Units, T, NonLinearScale> operator-(const unit_t<Units, T, NonLinearScale>& u) noexcept
{
return unit_t<Units, T, NonLinearScale>(-u());
}
Expand Down

0 comments on commit 37a3175

Please sign in to comment.