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

William Tran-Viet via libcxx-commits libcxx-commits at lists.llvm.org
Wed Feb 25 18:01:13 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> {
----------------
smallp-o-p wrote:

Since we're here we might as well just fix the double-wrapping.

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


More information about the libcxx-commits mailing list