in overloads

Synopses

Declared in <mp‐units/framework/quantity.h>

Returns this quantity re‐expressed with another representation type, in the same unit.

template<RepresentationOf<quantity_spec> ToRep>
requires detail::RepConstructibleFrom<ToRep, rep>
[[nodiscard]]
constexpr
QuantityOf<quantity_spec> auto
in() const;

Returns this quantity re‐expressed in another unit, implicitly convertible to rep.

template<UnitOf<quantity_spec> ToU>
requires detail::ImplicitScaling<unit, ToU{}, rep>
[[nodiscard]]
constexpr
QuantityOf<quantity_spec> auto
in(ToU to_u) const;

Returns this quantity re‐expressed with another representation type, applying an explicit rounding policy.

template<
    RepresentationOf<quantity_spec> ToRep,
    RoundingPolicy Policy>
requires std::constructible_from<ToRep, rep> && detail::ValidRoundingPolicyFor<Policy, rep, ToRep>
[[nodiscard]]
constexpr
QuantityOf<quantity_spec> auto
in(Policy policy) const;

Returns this quantity re‐expressed in another unit and representation type, both implicitly convertible.

template<
    RepresentationOf<quantity_spec> ToRep,
    UnitOf<quantity_spec> ToU>
requires detail::RepConstructibleFrom<ToRep, rep> && detail::ImplicitConversion<unit, rep, ToU{}, ToRep>
[[nodiscard]]
constexpr
QuantityOf<quantity_spec> auto
in(ToU to_u) const;

Returns this quantity re‐expressed in another unit, applying an explicit rounding policy.

template<
    UnitOf<quantity_spec> ToU,
    RoundingPolicy Policy>
requires detail::ExplicitlyCastable<unit, ToU{}, rep> && detail::ValidRoundingPolicyFor<Policy, rep, rep>
[[nodiscard]]
constexpr
QuantityOf<quantity_spec> auto
in(
    ToU to_u,
    Policy policy) const;

Returns this quantity re‐expressed in another unit and representation type, applying an explicit rounding policy.

template<
    RepresentationOf<quantity_spec> ToRep,
    UnitOf<quantity_spec> ToU,
    RoundingPolicy Policy>
requires std::constructible_from<ToRep, rep> && detail::ExplicitlyCastable<unit, ToU{}, ToRep> &&
             detail::ValidRoundingPolicyFor<Policy, rep, ToRep>
[[nodiscard]]
constexpr
QuantityOf<quantity_spec> auto
in(
    ToU to_u,
    Policy policy) const;

Return Value

  • The equivalent quantity with representation type ToRep.

  • The equivalent quantity expressed in to_u.

  • The equivalent quantity expressed in to_u with representation type ToRep.

Note

The return value should not be discarded.

Parameters

Name

Description

to_u

the target unit

policy

the rounding policy to apply when the conversion is not exact

Created with MrDocs