Constructors

Synopses

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

Default constructor

quantity() = default;

Construct from quantity

template<
    auto R2,
    typename Rep2>
requires detail::QuantityConstructibleFrom<quantity, quantity<R2, Rep2>> && (equivalent(unit, get_unit(R2)))
constexpr
explicit(!mp_units::implicitly_convertible(get_quantity_spec(R2), quantity_spec) || !mp_units::implicitly_scalable<get_unit(R2), Rep2, unit, rep>)
quantity(quantity<R2, Rep2> const& q);

Construct from quantity

template<
    auto R2,
    typename Rep2>
requires detail::QuantityConstructibleFrom<quantity, quantity<R2, Rep2>> && (!equivalent(unit, get_unit(R2)))
constexpr
explicit(!mp_units::implicitly_convertible(get_quantity_spec(R2), quantity_spec) || !mp_units::implicitly_scalable<get_unit(R2), Rep2, unit, rep>)
quantity(quantity<R2, Rep2> const& q);

Construct from rep

constexpr
explicit(!mp_units::implicitly_convertible(quantity_spec, dimensionless))
quantity(rep val)
requires detail::ExplicitFromNumber<reference>;

Construct from Value

template<typename Value>
requires detail::ExplicitFromNumber<reference> && detail::RepConvertibleFrom<rep, Value> &&
             (!std::convertible_to<Value, rep>)
constexpr
explicit
quantity(Value val);

Construct from Value

template<typename Value>
requires detail::ExplicitFromNumber<reference> && (!detail::RepConvertibleFrom<rep, Value>)
constexpr
explicit(!std::convertible_to<Value, rep> || !mp_units::implicitly_convertible(quantity_spec, dimensionless))
quantity(Value val) = delete;

Construct from Q

template<QuantityLike Q>
requires detail::QuantityConstructibleFrom<quantity, detail::quantity_like_type<Q>>
constexpr
explicit(quantity_like_traits<Q>::explicit_import || !std::convertible_to<detail::quantity_like_type<Q>, quantity<R, Rep>>)
quantity(Q const& q);

Constructor

template<Reference R2>
requires (equivalent(unit, get_unit(R2{})))
constexpr
quantity(
    rep val,
    R2);

Constructor

template<
    typename Value,
    Reference R2>
requires (equivalent(unit, get_unit(R2{}))) && (!detail::RepConvertibleFrom<rep, Value>)
constexpr
quantity(
    Value val,
    R2) = delete;

Constructor

template<
    typename FwdValue,
    Reference R2>
requires (!equivalent(unit, get_unit(R2{}))) &&
            detail::QuantityConstructibleFrom<quantity, quantity<R2{}, std::remove_cvref_t<FwdValue>>>
constexpr
quantity(
    FwdValue&& val,
    R2);

Created with MrDocs