From 69dddaf1f6c2136d3ad5306713b2014fdd5318af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johel=20Ernesto=20Guerrero=20Pe=C3=B1a?= Date: Sun, 9 Aug 2020 22:10:03 -0400 Subject: [PATCH] feat: nodiscard for postfix increment and decrement --- cmake/common | 2 +- src/include/units/quantity.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/common b/cmake/common index eb5fbd40..a12d6995 160000 --- a/cmake/common +++ b/cmake/common @@ -1 +1 @@ -Subproject commit eb5fbd40d1cb765c5a8bf50866db86082c72ef73 +Subproject commit a12d699507ecb6b0304bb0208b7f9b78e4059e51 diff --git a/src/include/units/quantity.h b/src/include/units/quantity.h index ec00955c..c055e8ef 100644 --- a/src/include/units/quantity.h +++ b/src/include/units/quantity.h @@ -141,7 +141,7 @@ public: template 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; } // TODO gated by gcc-9 (fixed in gcc-10) { return quantity(value_++); @@ -158,7 +158,7 @@ public: template 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; } // TODO gated by gcc-9 (fixed in gcc-10) { return quantity(value_--); @@ -300,7 +300,7 @@ public: template friend std::basic_ostream& operator<<(std::basic_ostream& os, const quantity& q) { - return os << detail::to_string(q); + return os << detail::to_string(q); } };