Compute the midpoint between two pointers into the same array.

Synopsis

Declared in <folly/Math.h>

template<class _TPtr>
constexpr
_TPtr
midpoint(
    _TPtr __a,
    _TPtr __b) noexcept
requires std::is_pointer<_TPtr>::value &&
        std::is_object<std::remove_pointer_t<_TPtr>>::value &&
        !std::is_void<std::remove_pointer_t<_TPtr>>::value &&
        (sizeof(std::remove_pointer_t<_TPtr>) > 0);

Description

Mimics std::midpoint (C++20) for pointer arguments.

Return Value

A pointer halfway between __a and __b, rounded toward __a.

Parameters

Name

Description

__a

Pointer to the first element.

__b

Pointer to the second element.

Created with MrDocs