Skip to content

mp_units::midpoint

Computes the midpoint of two points

Synopsis

Declared in <mp-units/math.h>

template<auto R1, auto Origin, typename Rep1, auto R2, typename Rep2>
  requires requires(Rep1 a, Rep2 b) {
    get_common_reference(R1, R2);
    requires requires { midpoint(a, b); }
#if MP_UNITS_HOSTED || __cpp_lib_freestanding_numeric >= 202502L
               || requires { std::midpoint(a, b); }
#endif
               ;
  }
[[nodiscard]] constexpr QuantityPointOf<get_quantity_spec(get_common_reference(R1, R2))> auto midpoint(
  quantity_point<R1, Origin, Rep1> const& a, quantity_point<R2, Origin, Rep2> const& b) noexcept;

Return Value

Note

The return value should not be discarded.

Parameters

NameDescription
aA quantity point
bA quantity point