[#mp_units-midpoint]
= xref:mp_units.adoc[mp&lowbar;units]::midpoint
:relfileprefix: ../
:mrdocs:

Computes the midpoint of two points

== Synopsis

Declared in `&lt;mp&hyphen;units&sol;math&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    auto R1,
    auto Origin,
    typename Rep1,
    auto R2,
    typename Rep2&gt;
requires requires(Rep1 a, Rep2 b) &lcub;
    get&lowbar;common&lowbar;reference(R1, R2)&semi;
    requires requires &lcub; midpoint(a, b)&semi; &rcub;
&num;if MP&lowbar;UNITS&lowbar;HOSTED &verbar;&verbar; &lowbar;&lowbar;cpp&lowbar;lib&lowbar;freestanding&lowbar;numeric &gt;&equals; 202502L
               &verbar;&verbar; requires &lcub; std&colon;&colon;midpoint(a, b)&semi; &rcub;
&num;endif
               &semi;
  &rcub;
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
constexpr
xref:mp_units/QuantityPointOf.adoc[QuantityPointOf&lt;get&lowbar;quantity&lowbar;spec(get&lowbar;common&lowbar;reference(R1, R2))&gt;] auto
midpoint(
    xref:mp_units/quantity_point-08.adoc[quantity&lowbar;point&lt;R1, Origin, Rep1&gt;] const& a,
    xref:mp_units/quantity_point-08.adoc[quantity&lowbar;point&lt;R2, Origin, Rep2&gt;] const& b) noexcept;
----

== Return Value

the point halfway between `a` and `b`

[NOTE]
====
The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^].
====
== Parameters

[cols="1,4"]
|===
| Name| Description
| *a*
| first point
| *b*
| second point
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
