mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-04 04:44:27 +02:00
feat: nodiscard for postfix increment and decrement
This commit is contained in:
committed by
Mateusz Pusz
parent
5cb6d93099
commit
69dddaf1f6
Submodule cmake/common updated: eb5fbd40d1...a12d699507
@@ -141,7 +141,7 @@ public:
|
|||||||
|
|
||||||
template<typename T = Rep>
|
template<typename T = Rep>
|
||||||
requires requires(T v) { { v++ } -> SAME_AS(T); }
|
requires requires(T v) { { v++ } -> SAME_AS(T); }
|
||||||
constexpr quantity operator++(int)
|
[[nodiscard]] constexpr quantity operator++(int)
|
||||||
// requires requires(rep v) { { v++ } -> std::same_as<rep>; } // TODO gated by gcc-9 (fixed in gcc-10)
|
// requires requires(rep v) { { v++ } -> std::same_as<rep>; } // TODO gated by gcc-9 (fixed in gcc-10)
|
||||||
{
|
{
|
||||||
return quantity(value_++);
|
return quantity(value_++);
|
||||||
@@ -158,7 +158,7 @@ public:
|
|||||||
|
|
||||||
template<typename T = Rep>
|
template<typename T = Rep>
|
||||||
requires requires(T v) { { v-- } -> SAME_AS(T); }
|
requires requires(T v) { { v-- } -> SAME_AS(T); }
|
||||||
constexpr quantity operator--(int)
|
[[nodiscard]] constexpr quantity operator--(int)
|
||||||
// requires requires(rep v) { { v-- } -> std::same_as<rep>; } // TODO gated by gcc-9 (fixed in gcc-10)
|
// requires requires(rep v) { { v-- } -> std::same_as<rep>; } // TODO gated by gcc-9 (fixed in gcc-10)
|
||||||
{
|
{
|
||||||
return quantity(value_--);
|
return quantity(value_--);
|
||||||
@@ -300,7 +300,7 @@ public:
|
|||||||
template<class CharT, class Traits>
|
template<class CharT, class Traits>
|
||||||
friend std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& os, const quantity& q)
|
friend std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& os, const quantity& q)
|
||||||
{
|
{
|
||||||
return os << detail::to_string<CharT, Traits>(q);
|
return os << detail::to_string<CharT, Traits>(q);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user