std::midpoint
From cppreference.com
Defined in header <numeric>


template< class T > constexpr T midpoint(T a, T b) noexcept; 
(1)  (since C++20) 
template< class T > constexpr T* midpoint(T* a, T* b); 
(2)  (since C++20) 
Computes the midpoint of the integers, floatingpoints, or pointers a
and b
.
Parameters
a, b    intergers, floatingpoints, or pointer values 
Type requirements  
T must be an arithmetic type other than bool for overload (1)
 
T must be a complete object type for overload (2)

Return value
1) Half the sum of
a
and b
. No overflow occurs. If a
and b
have integer type and the sum is odd, the result is rounded towards a
. If a
and b
have floatingpoint type, at most one inexact operation occurs.2) If
a
and b
point to, respectively, x[i]
and x[j]
of the same array object x
(for the purpose of pointer arithmetic), returns a pointer to x[i+(ji)/2]
where the division rounds towards zero. If a
and b
do not point to elements of the same array object, the behavior is undefined.Exceptions
Throws no exceptions.
Examples
This section is incomplete Reason: no example 