[libcxx-commits] [libcxx] Make C++ 20 std::midpoint compatible with libc++ (PR #74217)

Sanjay Marreddi via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 19 04:39:57 PST 2023


================
@@ -51,19 +51,12 @@ _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
     return __a + __half_diff;
 }
 
-
 template <class _TPtr>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<is_pointer_v<_TPtr>
-             && is_object_v<remove_pointer_t<_TPtr>>
-             && ! is_void_v<remove_pointer_t<_TPtr>>
-             && (sizeof(remove_pointer_t<_TPtr>) > 0), _TPtr>
-midpoint(_TPtr __a, _TPtr __b) noexcept
-{
-    return __a + std::midpoint(ptrdiff_t(0), __b - __a);
+_LIBCPP_INLINE_VISIBILITY constexpr enable_if_t<is_object_v<_TPtr> && !is_void_v<_TPtr> && (sizeof(_TPtr) > 0), _TPtr*>
----------------
SanjayMarreddi wrote:

Sure, refactored it.

https://github.com/llvm/llvm-project/pull/74217


More information about the libcxx-commits mailing list