From e72760925fde69f034b82b96d3e3202877b24a7d Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Tue, 7 May 2024 11:51:32 -0400 Subject: [PATCH] xo-unit: + scaled_unit.is_natural() --- docs/{abstractions.rst => implementation.rst} | 0 include/xo/unit/scaled_unit.hpp | 5 +++++ 2 files changed, 5 insertions(+) rename docs/{abstractions.rst => implementation.rst} (100%) diff --git a/docs/abstractions.rst b/docs/implementation.rst similarity index 100% rename from docs/abstractions.rst rename to docs/implementation.rst diff --git a/include/xo/unit/scaled_unit.hpp b/include/xo/unit/scaled_unit.hpp index 35ac028e..a0d8a6f8 100644 --- a/include/xo/unit/scaled_unit.hpp +++ b/include/xo/unit/scaled_unit.hpp @@ -29,6 +29,11 @@ namespace xo { 1.0 / outer_scale_sq_); } + /** @brief true iff scaled unit can be faithfully represented by a @ref natural_unit **/ + constexpr bool is_natural() const { + return (outer_scale_factor_ = OuterScale(1) && (outer_scale_sq_ == 1.0)); + } + public: /* need public members so that a scaled_unit instance can be a non-type template parameter (a structural type) */ natural_unit natural_unit_;