[libcxx-commits] [libcxx] [libc++][NFC] Simplify `optional::iterator` (PR #183230)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Thu Feb 26 02:43:39 PST 2026


================
@@ -707,17 +707,21 @@ inline constexpr bool __is_constructible_for_optional_initializer_list_v<_Tp&, _
 #    endif
 
 template <class _Tp, class = void>
-struct __optional_iterator {};
+struct __optional_iterator_base : __optional_move_assign_base<_Tp> {
+  using __optional_move_assign_base<_Tp>::__optional_move_assign_base;
+};
 
 #    if _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPERIMENTAL_OPTIONAL_ITERATOR
 
 template <class _Tp>
-struct __optional_iterator<_Tp, enable_if_t<is_object_v<_Tp>>> {
+struct __optional_iterator_base<_Tp, enable_if_t<is_object_v<_Tp>>> : __optional_move_assign_base<_Tp> {
----------------
philnik777 wrote:

Yeah, let's keep these two changes separate.

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


More information about the libcxx-commits mailing list