mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-07 14:14:27 +02:00
refactor: type_traits usage cleanup
This commit is contained in:
@@ -109,7 +109,8 @@ struct quantity_spec_interface {
|
|||||||
|
|
||||||
template<typename Self, typename Q>
|
template<typename Self, typename Q>
|
||||||
[[nodiscard]] constexpr Quantity auto operator()(this Self self, Q&& q) const
|
[[nodiscard]] constexpr Quantity auto operator()(this Self self, Q&& q) const
|
||||||
requires Quantity<std::remove_cvref_t<Q>> && (explicitly_convertible(std::remove_cvref_t<Q>::quantity_spec, self))
|
requires Quantity<std::remove_cvref_t<Q>> &&
|
||||||
|
(explicitly_convertible(std::remove_reference_t<Q>::quantity_spec, self))
|
||||||
{
|
{
|
||||||
return make_quantity<reference<self, std::remove_cvref_t<Q>::unit>{}>(std::forward<Q>(q).number());
|
return make_quantity<reference<self, std::remove_cvref_t<Q>::unit>{}>(std::forward<Q>(q).number());
|
||||||
}
|
}
|
||||||
@@ -121,7 +122,8 @@ struct quantity_spec_interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename Q>
|
template<typename Q>
|
||||||
requires Quantity<std::remove_cvref_t<Q>> && (explicitly_convertible(std::remove_cvref_t<Q>::quantity_spec, Self{}))
|
requires Quantity<std::remove_cvref_t<Q>> &&
|
||||||
|
(explicitly_convertible(std::remove_reference_t<Q>::quantity_spec, Self{}))
|
||||||
[[nodiscard]] constexpr Quantity auto operator()(Q&& q) const
|
[[nodiscard]] constexpr Quantity auto operator()(Q&& q) const
|
||||||
{
|
{
|
||||||
return make_quantity<reference<Self{}, std::remove_cvref_t<Q>::unit>{}>(std::forward<Q>(q).number());
|
return make_quantity<reference<Self{}, std::remove_cvref_t<Q>::unit>{}>(std::forward<Q>(q).number());
|
||||||
@@ -296,7 +298,8 @@ struct quantity_spec<Self, QS, Args...> : std::remove_const_t<decltype(QS)> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename Q>
|
template<typename Q>
|
||||||
requires Quantity<std::remove_cvref_t<Q>> && (explicitly_convertible(std::remove_cvref_t<Q>::quantity_spec, Self{}))
|
requires Quantity<std::remove_cvref_t<Q>> &&
|
||||||
|
(explicitly_convertible(std::remove_reference_t<Q>::quantity_spec, Self{}))
|
||||||
[[nodiscard]] constexpr Quantity auto operator()(Q&& q) const
|
[[nodiscard]] constexpr Quantity auto operator()(Q&& q) const
|
||||||
{
|
{
|
||||||
return make_quantity<reference<Self{}, std::remove_cvref_t<Q>::unit>{}>(std::forward<Q>(q).number());
|
return make_quantity<reference<Self{}, std::remove_cvref_t<Q>::unit>{}>(std::forward<Q>(q).number());
|
||||||
|
Reference in New Issue
Block a user