mp_units::operator/

Division operators

Synopses

Declared in <mp-units/framework/dimension.h>

Divides a unit by a reference

template<Unit U1>
[[nodiscard]]
consteval
/* implementation-defined */
operator/(
    U1 u1,
    reference r);
» more...

Divides a reference by a unit

template<Unit U2>
[[nodiscard]]
consteval
/* implementation-defined */
operator/(
    reference r,
    U2 u2);
» more...

scaled_unit specializations have priority in this operation. This means that the library framework prevents passing it as an element to the derived_unit. In such case only the reference unit is passed to the derived unit and the magnitude remains outside forming another scaled unit as a result of the operation.

template<
    Dimension Lhs,
    Dimension Rhs>
[[nodiscard]]
consteval
Dimension auto
operator/(
    Lhs lhs,
    Rhs rhs);
» more...

scaled_unit specializations have priority in this operation. This means that the library framework prevents passing it as an element to the derived_unit. In such case only the reference unit is passed to the derived unit and the magnitude remains outside forming another scaled unit as a result of the operation.

template<
    Dimension Lhs,
    Dimension Rhs>
[[nodiscard]]
consteval
Dimension auto
operator/(
    Lhs lhs,
    Rhs rhs);
» more...

scaled_unit specializations have priority in this operation. This means that the library framework prevents passing it as an element to the derived_unit. In such case only the reference unit is passed to the derived unit and the magnitude remains outside forming another scaled unit as a result of the operation.

template<
    Dimension Lhs,
    Dimension Rhs>
[[nodiscard]]
consteval
Dimension auto
operator/(
    Lhs lhs,
    Rhs rhs);
» more...

Deleted overload rejecting reference / quantity, which has no defined meaning

template<
    Reference R,
    typename Q>
requires Quantity<std::remove_cvref_t<Q>>
constexpr
auto
operator/(
    R r,
    Q&& q) = delete;
» more...

Deleted overload rejecting reference / representation, which has no defined meaning

template<
    Reference R,
    typename Rep>
requires RepresentationOf<std::remove_cvref_t<Rep>, get_quantity_spec(R{})>
constexpr
auto
operator/(
    R r,
    Rep&& rep) = delete;
» more...

Divides a reference by another reference

template<
    typename Q2,
    typename U2>
[[nodiscard]]
consteval
/* implementation-defined */
operator/(
    reference r1,
    reference<Q2, U2> r2);
» more...

Division operator

template<
    typename Value,
    auto R1,
    typename Rep1>
requires (!Quantity<Value>) && (!Reference<Value>) &&
            ScalableResultOf<get_quantity_spec(one / R1), std::divides<>, const Value&, Rep1>
[[nodiscard]]
constexpr
Quantity auto
operator/(
    Value const& val,
    quantity<R1, Rep1> const& q);
» more...

Division operator

template<
    auto R1,
    typename Rep1,
    typename Value>
requires (!Quantity<Value>) && (!Reference<Value>) &&
            InvokeResultOf<get_quantity_spec(R1), std::divides<>, Rep1, const Value&>
[[nodiscard]]
constexpr
QuantityOf<get_quantity_spec(R1)> auto
operator/(
    quantity<R1, Rep1> const& q,
    Value const& val);
» more...

Rebinds a quantity to a reference obtained by dividing its own reference by R

template<
    typename FwdQ,
    Reference R,
    Quantity Q = std::remove_cvref_t<FwdQ>>
[[nodiscard]]
constexpr
Quantity auto
operator/(
    FwdQ&& q,
    R r);
» more...

Constructs a quantity from a representation value and the inverse of a reference

template<
    typename FwdRep,
    Reference R,
    RepresentationOf<get_quantity_spec(R{})> Rep = std::remove_cvref_t<FwdRep>>
requires (!detail::OffsetUnit<decltype(get_unit(R{}))>)
[[nodiscard]]
constexpr
Quantity auto
operator/(
    FwdRep&& lhs,
    R r);
» more...

Deprecated constructor of a quantity from a representation value and the inverse of an offset-unit reference

template<
    typename FwdRep,
    Reference R,
    RepresentationOf<get_quantity_spec(R{})> Rep = std::remove_cvref_t<FwdRep>>
requires detail::OffsetUnit<decltype(get_unit(R{}))>
[[deprecated("2.3.0: References using offset units (e.g., temperatures) should be constructed with the `delta` or `point` helpers")]]
constexpr
auto
operator/(
    FwdRep&& lhs,
    R r);
» more...

Division operator

template<
    auto R1,
    typename Rep1,
    auto R2,
    typename Rep2>
requires InvocableQuantities<std::divides<>, quantity<R1, Rep1>, quantity<R2, Rep2>>
[[nodiscard]]
constexpr
Quantity auto
operator/(
    quantity<R1, Rep1> const& lhs,
    quantity<R2, Rep2> const& rhs);
» more...

Return Value

  • a reference resulting from dividing the quantity specification and the unit
  • a reference resulting from dividing the quantity specifications and the units
  • quantity holding the same numerical value as q, with reference Q::reference / R{}
  • quantity of the inverse of reference r holding the value of lhs

Parameters

NameDescription
u1the unit to divide
rthe reference to divide by
u2the unit to divide by
qquantity operand (unused)
reprepresentation operand (unused)
r1the reference to divide
r2the reference to divide by
lhsrepresentation value to become the quantity's numerical value