forked from mpusz/mp-units
Scalar constraint added to quantity constructor
This commit is contained in:
@@ -191,8 +191,9 @@ namespace units {
|
|||||||
quantity() = default;
|
quantity() = default;
|
||||||
quantity(const quantity&) = default;
|
quantity(const quantity&) = default;
|
||||||
|
|
||||||
template<std::convertible_to<rep> Rep2>
|
template<Scalar Rep2>
|
||||||
requires treat_as_floating_point<rep> || (!treat_as_floating_point<Rep2>)
|
requires std::convertible_to<Rep2, rep> &&
|
||||||
|
(treat_as_floating_point<rep> || (!treat_as_floating_point<Rep2>))
|
||||||
constexpr explicit quantity(const Rep2& r) : value_{static_cast<rep>(r)}
|
constexpr explicit quantity(const Rep2& r) : value_{static_cast<rep>(r)}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user