[libcxx-commits] [libcxx] [libc++] Make common_iterator's data member private (PR #72564)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Nov 16 12:16:34 PST 2023
https://github.com/ldionne created https://github.com/llvm/llvm-project/pull/72564
Fixes #71498
>From 9949a4594a1d6aacd44839edc9591d9572c91051 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Thu, 16 Nov 2023 15:10:51 -0500
Subject: [PATCH] [libc++] Make common_iterator's data member private
Fixes #71498
---
libcxx/include/__iterator/common_iterator.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libcxx/include/__iterator/common_iterator.h b/libcxx/include/__iterator/common_iterator.h
index 95e248d83f4b460..7750cf0f7638d6b 100644
--- a/libcxx/include/__iterator/common_iterator.h
+++ b/libcxx/include/__iterator/common_iterator.h
@@ -63,9 +63,12 @@ class common_iterator {
iter_value_t<_Iter> __value_;
};
-public:
variant<_Iter, _Sent> __hold_;
+ template<input_or_output_iterator _OtherIter, sentinel_for<_Iter> _OtherSent>
+ requires (!same_as<_OtherIter, _OtherSent> && copyable<_OtherIter>)
+ friend class common_iterator;
+public:
_LIBCPP_HIDE_FROM_ABI common_iterator() requires default_initializable<_Iter> = default;
_LIBCPP_HIDE_FROM_ABI constexpr common_iterator(_Iter __i) : __hold_(in_place_type<_Iter>, _VSTD::move(__i)) {}
More information about the libcxx-commits
mailing list