[libcxx-commits] [libcxx] Make C++ 20 std::midpoint compatible with libc++ (PR #74217)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Dec 18 13:35:35 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*>
----------------
philnik777 wrote:
While we're modifying this code anyways, let's also refactor the `enable_if_t` to the `enable_if_t<..., int> = 0` variant.
https://github.com/llvm/llvm-project/pull/74217
More information about the libcxx-commits
mailing list