From 458ac0918bee54ec81475c725d39ac5c34d421b2 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Tue, 8 Oct 2019 21:20:37 +0200 Subject: [PATCH] Scalar constraint added to quantity constructor --- src/include/units/quantity.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/include/units/quantity.h b/src/include/units/quantity.h index 7cd558ad..b1c1c17a 100644 --- a/src/include/units/quantity.h +++ b/src/include/units/quantity.h @@ -191,8 +191,9 @@ namespace units { quantity() = default; quantity(const quantity&) = default; - template Rep2> - requires treat_as_floating_point || (!treat_as_floating_point) + template + requires std::convertible_to && + (treat_as_floating_point || (!treat_as_floating_point)) constexpr explicit quantity(const Rep2& r) : value_{static_cast(r)} { }