[libcxx-commits] [libcxx] [libc++] Fix _CopySegment helper in ranges::copy(join_view, out) replacing `const` with `constexpr` (PR #69593)
Rajveer Singh Bharadwaj via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Oct 19 04:54:02 PDT 2023
https://github.com/Rajveer100 created https://github.com/llvm/llvm-project/pull/69593
Part of Issue #69083
The `_CopySegment` helper for `ranges::copy(join_view, out)` is not `constexpr` causing rejection in `libc++` for static assertion as in the issue snippet.
>From 271fa26dc53cd4420da66d11afc50c6740343e62 Mon Sep 17 00:00:00 2001
From: Rajveer <rajveer.developer at icloud.com>
Date: Thu, 19 Oct 2023 17:08:57 +0530
Subject: [PATCH] [libc++] Fix _CopySegment helper in ranges::copy(join_view,
out) replacing `const` with `constexpr`
Part of Issue #69083
---
libcxx/include/__algorithm/copy.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libcxx/include/__algorithm/copy.h b/libcxx/include/__algorithm/copy.h
index dfe9898c6480cf8..175c6c0fc682026 100644
--- a/libcxx/include/__algorithm/copy.h
+++ b/libcxx/include/__algorithm/copy.h
@@ -35,7 +35,7 @@ template <class _AlgPolicy>
struct __copy_loop {
template <class _InIter, class _Sent, class _OutIter>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
- operator()(_InIter __first, _Sent __last, _OutIter __result) const {
+ operator()(_InIter __first, _Sent __last, _OutIter __result) constexpr {
while (__first != __last) {
*__result = *__first;
++__first;
@@ -61,7 +61,7 @@ struct __copy_loop {
template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator<_InIter>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
- operator()(_InIter __first, _InIter __last, _OutIter __result) const {
+ operator()(_InIter __first, _InIter __last, _OutIter __result) constexpr {
std::__for_each_segment(__first, __last, _CopySegment<_InIter, _OutIter>(__result));
return std::make_pair(__last, std::move(__result));
}
@@ -72,7 +72,7 @@ struct __copy_loop {
!__is_segmented_iterator<_InIter>::value && __is_segmented_iterator<_OutIter>::value,
int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
- operator()(_InIter __first, _InIter __last, _OutIter __result) const {
+ operator()(_InIter __first, _InIter __last, _OutIter __result) constexpr {
using _Traits = __segmented_iterator_traits<_OutIter>;
using _DiffT = typename common_type<__iter_diff_t<_InIter>, __iter_diff_t<_OutIter> >::type;
@@ -99,7 +99,7 @@ struct __copy_trivial {
// At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer.
template <class _In, class _Out, __enable_if_t<__can_lower_copy_assignment_to_memmove<_In, _Out>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*>
- operator()(_In* __first, _In* __last, _Out* __result) const {
+ operator()(_In* __first, _In* __last, _Out* __result) constexpr {
return std::__copy_trivial_impl(__first, __last, __result);
}
};
More information about the libcxx-commits
mailing list