From 8c4010b4be113c74e177a0cbfae4f1122a56c1ae Mon Sep 17 00:00:00 2001 From: rulrich <ralf.m.ulrich@kit.edu> Date: Fri, 13 Nov 2020 12:27:38 +0100 Subject: [PATCH] cast dimensionless_d to integral type --- ThirdParty/phys/units/quantity.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ThirdParty/phys/units/quantity.hpp b/ThirdParty/phys/units/quantity.hpp index 970773d59..0751923b0 100644 --- a/ThirdParty/phys/units/quantity.hpp +++ b/ThirdParty/phys/units/quantity.hpp @@ -31,6 +31,7 @@ #include <cmath> #include <cstdlib> #include <utility> // std::declval +#include <type_traits> // std::enable_if /// namespace phys. @@ -358,6 +359,10 @@ namespace phys { static constexpr quantity zero() { return quantity{value_type(0.0)}; } // static constexpr quantity zero = quantity{ value_type( 0.0 ) }; + // RU, added conversion to T (often: double) for dimensionless_d + template <typename DIM=Dims, std::enable_if_t<std::is_same_v<DIM, dimensionless_d>, int> = 0> + operator T() { return m_value; } + private: /** * private initializing constructor. -- GitLab