refactor: quantity_kind constructors merged into one

Relates to #221
This commit is contained in:
Mateusz Pusz
2021-05-11 19:39:50 +02:00
parent b00cff8ec8
commit c95e20c7ea

View File

@@ -93,16 +93,13 @@ public:
quantity_kind(const quantity_kind&) = default;
quantity_kind(quantity_kind&&) = default;
template<typename Value>
requires std::same_as<dimension, dim_one> &&
safe_convertible_to_<std::remove_cvref_t<Value>, rep> &&
std::constructible_from<quantity_type, Value>
constexpr explicit quantity_kind(Value&& v) : q_(std::forward<Value>(v)) {}
template<typename Q>
requires (Quantity<std::remove_cvref_t<Q>> || QuantityLike<std::remove_cvref_t<Q>>) &&
std::constructible_from<quantity_type, Q>
constexpr explicit quantity_kind(Q&& q) : q_(std::forward<Q>(q)) {}
template<typename T>
requires
(Quantity<std::remove_cvref_t<T>> ||
QuantityLike<std::remove_cvref_t<T>> ||
(Dimensionless<quantity_type> && !Quantity<std::remove_cvref_t<T>>)) &&
std::constructible_from<quantity_type, T>
constexpr explicit quantity_kind(T&& t) : q_(std::forward<T>(t)) {}
template<QuantityKindEquivalentTo<quantity_kind> QK2>
requires std::convertible_to<typename QK2::quantity_type, quantity_type>