From 9871cf0ed79f2e2835f7925c0dc82c34c79b32c6 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Wed, 6 Nov 2019 21:51:40 +0000 Subject: [PATCH] UnitRep extended --- src/include/units/quantity.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/include/units/quantity.h b/src/include/units/quantity.h index b7c901ce..b38c1ed9 100644 --- a/src/include/units/quantity.h +++ b/src/include/units/quantity.h @@ -53,13 +53,21 @@ namespace units { // UnitRep template concept UnitRep = Scalar && - (treat_as_floating_point == false || + // integral + ((treat_as_floating_point == false && + requires(T a, T b) { + { a % b } -> T; + { a++ } -> T; + { ++a } -> T&; + { a-- } -> T; + { --a } -> T&; + }) || + // floating-point requires(T&& a) { - { ::units::isfinite(std::forward(a)) } -> bool; - { ::units::isnan(std::forward(a)) } -> bool; + ::units::isfinite(std::forward(a)); + ::units::isnan(std::forward(a)); }); - template class quantity;