mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-03 12:24:26 +02:00
refactor: make_quantity()
forward declaration moved to the beginning of reference.h
This commit is contained in:
@@ -29,6 +29,10 @@
|
|||||||
|
|
||||||
namespace mp_units {
|
namespace mp_units {
|
||||||
|
|
||||||
|
template<Reference auto R, typename Rep>
|
||||||
|
requires RepresentationOf<std::remove_cvref_t<Rep>, get_quantity_spec(R).character>
|
||||||
|
[[nodiscard]] constexpr quantity<R, std::remove_cvref_t<Rep>> make_quantity(Rep&& v);
|
||||||
|
|
||||||
[[nodiscard]] consteval QuantitySpec auto get_quantity_spec(AssociatedUnit auto u)
|
[[nodiscard]] consteval QuantitySpec auto get_quantity_spec(AssociatedUnit auto u)
|
||||||
{
|
{
|
||||||
return detail::get_associated_quantity(u);
|
return detail::get_associated_quantity(u);
|
||||||
@@ -73,7 +77,7 @@ struct reference {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<AssociatedUnit U2>
|
template<AssociatedUnit U2>
|
||||||
[[nodiscard]] friend consteval reference<Q * get_quantity_spec(U2{}), U* U2{}> operator*(reference, U2)
|
[[nodiscard]] friend consteval reference<Q * get_quantity_spec(U2{}), U * U2{}> operator*(reference, U2)
|
||||||
{
|
{
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@@ -124,10 +128,6 @@ struct reference {
|
|||||||
template<Reference auto R, RepresentationOf<get_quantity_spec(R).character> Rep>
|
template<Reference auto R, RepresentationOf<get_quantity_spec(R).character> Rep>
|
||||||
class quantity;
|
class quantity;
|
||||||
|
|
||||||
template<Reference auto R, typename Rep>
|
|
||||||
requires RepresentationOf<std::remove_cvref_t<Rep>, get_quantity_spec(R).character>
|
|
||||||
[[nodiscard]] constexpr quantity<R, std::remove_cvref_t<Rep>> make_quantity(Rep&& v);
|
|
||||||
|
|
||||||
template<typename Rep, Reference R>
|
template<typename Rep, Reference R>
|
||||||
requires RepresentationOf<std::remove_cvref_t<Rep>, get_quantity_spec(R{}).character>
|
requires RepresentationOf<std::remove_cvref_t<Rep>, get_quantity_spec(R{}).character>
|
||||||
[[nodiscard]] constexpr quantity<R{}, std::remove_cvref_t<Rep>> operator*(Rep&& lhs, R)
|
[[nodiscard]] constexpr quantity<R{}, std::remove_cvref_t<Rep>> operator*(Rep&& lhs, R)
|
||||||
|
Reference in New Issue
Block a user