mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-03 20:34:26 +02:00
Disabled prefix/postfix increment/decrement operators (resolves #18)
This commit is contained in:
@@ -236,22 +236,28 @@ namespace units {
|
||||
[[nodiscard]] static constexpr quantity min() noexcept { return quantity(quantity_values<Rep>::min()); }
|
||||
[[nodiscard]] static constexpr quantity max() noexcept { return quantity(quantity_values<Rep>::max()); }
|
||||
|
||||
[[nodiscard]] constexpr quantity operator+() const { return quantity(*this); }
|
||||
[[nodiscard]] constexpr quantity operator+() const { return *this; }
|
||||
[[nodiscard]] constexpr quantity operator-() const { return quantity(-count()); }
|
||||
|
||||
constexpr quantity& operator++()
|
||||
// requires requires(rep v) { { ++v } -> std::same_as<rep&>; } // TODO gated by gcc-9 (fixed in gcc-10)
|
||||
{
|
||||
++value_;
|
||||
return *this;
|
||||
}
|
||||
constexpr quantity operator++(int) { return quantity(value_++); }
|
||||
constexpr quantity operator++(int)
|
||||
// requires requires(rep v) { { v++ } -> std::same_as<rep>; } // TODO gated by gcc-9 (fixed in gcc-10)
|
||||
{ return quantity(value_++); }
|
||||
|
||||
constexpr quantity& operator--()
|
||||
// requires requires(rep v) { { --v } -> std::same_as<rep&>; } // TODO gated by gcc-9 (fixed in gcc-10)
|
||||
{
|
||||
--value_;
|
||||
return *this;
|
||||
}
|
||||
constexpr quantity operator--(int) { return quantity(value_--); }
|
||||
constexpr quantity operator--(int)
|
||||
// requires requires(rep v) { { v-- } -> std::same_as<rep>; } // TODO gated by gcc-9 (fixed in gcc-10)
|
||||
{ return quantity(value_--); }
|
||||
|
||||
constexpr quantity& operator+=(const quantity& q)
|
||||
{
|
||||
|
Reference in New Issue
Block a user