Skip to content

mp_units::quantity_point::try_make

Constructs quantity_point{q, po}, or returns bounds_violation for a value that is_within_bounds rejects.

Synopses

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

template<typename FwdQ>
  requires requires(const FwdQ& q) { is_within_bounds(q); } && std::constructible_from<quantity_point, FwdQ>
[[nodiscard]] constexpr static std::expected<quantity_point, bounds_violation> try_make(FwdQ&& q);

» more...

Constructs quantity_point{q, po}, or returns bounds_violation for a value that is_within_bounds rejects.

template<typename FwdQ>
  requires requires(const FwdQ& q) { is_within_bounds(q, PO); } &&
           std::constructible_from<quantity_point, FwdQ, decltype(PO)>
[[nodiscard]] constexpr static std::expected<quantity_point, bounds_violation> try_make(FwdQ&& q, decltype(PO) po);

» more...

Return Value

Note

The return value should not be discarded.

See Also

is_within_bounds for the test alone