mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-03 20:34:26 +02:00
Small code cleanup
This commit is contained in:
@@ -43,8 +43,8 @@
|
||||
namespace std {
|
||||
|
||||
// concepts
|
||||
using concepts::common_with;
|
||||
using concepts::common_reference_with;
|
||||
using concepts::common_with;
|
||||
using concepts::constructible_from;
|
||||
using concepts::convertible_to;
|
||||
using concepts::default_constructible;
|
||||
|
@@ -265,7 +265,7 @@ namespace std {
|
||||
}
|
||||
|
||||
struct times {
|
||||
template<class T, detail::multiplicable_with <T> U>
|
||||
template<class T, detail::multiplicable_with<T> U>
|
||||
constexpr decltype(auto) operator()(T&& t, U&& u) const
|
||||
{ return std::forward<T>(t) * std::forward<U>(u); }
|
||||
|
||||
@@ -290,7 +290,7 @@ namespace std {
|
||||
}
|
||||
|
||||
struct divided_by {
|
||||
template<class T, detail::divisible_with <T> U>
|
||||
template<class T, detail::divisible_with<T> U>
|
||||
constexpr decltype(auto) operator()(T&& t, U&& u) const
|
||||
{ return std::forward<T>(t) / std::forward<U>(u); }
|
||||
};
|
||||
@@ -312,7 +312,7 @@ namespace std {
|
||||
}
|
||||
|
||||
struct modulus {
|
||||
template<class T, detail::modulo_with <T> U>
|
||||
template<class T, detail::modulo_with<T> U>
|
||||
constexpr decltype(auto) operator()(T&& t, U&& u) const
|
||||
{ return std::forward<T>(t) % std::forward<U>(u); }
|
||||
};
|
||||
|
@@ -205,7 +205,7 @@ namespace units {
|
||||
|
||||
template<Scalar Value>
|
||||
requires detail::safe_convertible<Value, rep>
|
||||
constexpr explicit quantity(const Value& r): value_{static_cast<rep>(r)}
|
||||
constexpr explicit quantity(const Value& v): value_{static_cast<rep>(v)}
|
||||
{
|
||||
}
|
||||
|
||||
@@ -369,7 +369,8 @@ namespace units {
|
||||
|
||||
template<typename U1, typename Rep1, typename U2, typename Rep2>
|
||||
[[nodiscard]] constexpr Quantity AUTO operator-(const quantity<U1, Rep1>& lhs, const quantity<U2, Rep2>& rhs)
|
||||
requires same_dim<typename U1::dimension, typename U2::dimension> && detail::basic_arithmetic<Rep1, Rep2>
|
||||
requires same_dim<typename U1::dimension, typename U2::dimension> &&
|
||||
detail::basic_arithmetic<Rep1, Rep2>
|
||||
{
|
||||
using common_rep = decltype(lhs.count() - rhs.count());
|
||||
using ret = common_quantity<quantity<U1, Rep1>, quantity<U2, Rep2>, common_rep>;
|
||||
@@ -394,7 +395,8 @@ namespace units {
|
||||
|
||||
template<typename U1, typename Rep1, typename U2, typename Rep2>
|
||||
[[nodiscard]] constexpr Scalar AUTO operator*(const quantity<U1, Rep1>& lhs, const quantity<U2, Rep2>& rhs)
|
||||
requires same_dim<typename U1::dimension, dim_invert<typename U2::dimension>> && detail::basic_arithmetic<Rep1, Rep2>
|
||||
requires same_dim<typename U1::dimension, dim_invert<typename U2::dimension>> &&
|
||||
detail::basic_arithmetic<Rep1, Rep2>
|
||||
{
|
||||
using common_rep = decltype(lhs.count() * rhs.count());
|
||||
using ratio = ratio_multiply<typename U1::ratio, typename U2::ratio>;
|
||||
@@ -439,7 +441,8 @@ namespace units {
|
||||
|
||||
template<typename U1, typename Rep1, typename U2, typename Rep2>
|
||||
[[nodiscard]] constexpr Scalar AUTO operator/(const quantity<U1, Rep1>& lhs, const quantity<U2, Rep2>& rhs)
|
||||
requires same_dim<typename U1::dimension, typename U2::dimension> && detail::basic_arithmetic<Rep1, Rep2>
|
||||
requires same_dim<typename U1::dimension, typename U2::dimension> &&
|
||||
detail::basic_arithmetic<Rep1, Rep2>
|
||||
{
|
||||
Expects(rhs != std::remove_cvref_t<decltype(rhs)>(0));
|
||||
|
||||
|
Reference in New Issue
Block a user