5 Quantities and units library [quantities]

5.4 Reference [qty.ref]

5.4.6 Class template reference [qty.ref.syn]

namespace mp_units { template<QuantitySpec auto Q, Unit auto U> using reference-t = reference<decltype(Q), decltype(U)>; // exposition only template<QuantitySpec Q, Unit U> struct reference { // [qty.ref.ops], operations template<typename Q2, typename U2> friend consteval auto operator*(reference, reference<Q2, U2>) -> reference-t<Q{} * Q2{}, U{} * U2{}>; template<AssociatedUnit U2> friend consteval auto operator*(reference, U2) -> reference-t<Q{} * get_quantity_spec(U2{}), U{} * U2{}>; template<AssociatedUnit U1> friend consteval auto operator*(U1, reference) -> reference-t<get_quantity_spec(U1{}) * Q{}, U1{} * U{}>; template<typename Q2, typename U2> friend consteval auto operator/(reference, reference<Q2, U2>) -> reference-t<Q{} / Q2{}, U{} / U2{}>; template<AssociatedUnit U2> friend consteval auto operator/(reference, U2) -> reference-t<Q{} / get_quantity_spec(U2{}), U{} / U2{}>; template<AssociatedUnit U1> friend consteval auto operator/(U1, reference) -> reference-t<get_quantity_spec(U1{}) / Q{}, U1{} / U{}>; friend consteval auto inverse(reference) -> reference-t<inverse(Q{}), inverse(U{})>; template<std::intmax_t Num, std::intmax_t Den = 1> requires(Den != 0) friend consteval auto pow(reference) -> reference-t<pow<Num, Den>(Q{}), pow<Num, Den>(U{})>; friend consteval auto sqrt(reference) -> reference-t<sqrt(Q{}), sqrt(U{})>; friend consteval auto cbrt(reference) -> reference-t<cbrt(Q{}), cbrt(U{})>; // [qty.ref.cmp], comparison template<typename Q2, typename U2> friend consteval bool operator==(reference, reference<Q2, U2>); template<AssociatedUnit U2> friend consteval bool operator==(reference, U2 u2); template<typename Q2, typename U2> friend consteval bool convertible(reference, reference<Q2, U2>); template<AssociatedUnit U2> friend consteval bool convertible(reference, U2 u2); template<AssociatedUnit U1> friend consteval bool convertible(U1 u1, reference); }; }
reference<Q, U> represents the reference of a quantity (IEC 60050, 112-01-01).
The unit of measurement U (IEC 60050, 112-01-14) is used to measure a value of the quantity Q (IEC 60050, 112-01-28).
[Note 1: 
reference is typically implicitly instantiated when specifying that a unit measures a more specific quantity.
[Example 1: using namespace si::unit_symbols; auto x = 1 * m; // measures a length auto y = 1 * isq::width[m]; // measures a width auto z = 1 * isq::diameter[m]; // measures a diameter — end example]
— end note]