@@ -607,48 +607,27 @@ struct __is_std_optional : false_type {};
607
607
template <class _Tp >
608
608
struct __is_std_optional <optional<_Tp>> : true_type {};
609
609
610
- template <class _Tp , class = void >
611
- struct __optional_iterator_aliases {};
612
-
613
- # if _LIBCPP_STD_VER >= 26
614
- // disallow T (&)() and T (&)[]
615
610
template <class _Tp >
616
- struct __optional_iterator_aliases <
617
- _Tp,
618
- __enable_if_t <!(is_reference<_Tp>::value && (is_function<__libcpp_remove_reference_t <_Tp>>::value ||
619
- is_unbounded_array<__libcpp_remove_reference_t <_Tp>>::value))> > {
611
+ class _LIBCPP_DECLSPEC_EMPTY_BASES optional
612
+ : private __optional_move_assign_base<_Tp>,
613
+ private __optional_sfinae_ctor_base_t <_Tp>,
614
+ private __optional_sfinae_assign_base_t <_Tp> {
615
+ using __base _LIBCPP_NODEBUG = __optional_move_assign_base<_Tp>;
616
+
620
617
using __pointer _LIBCPP_NODEBUG = std::add_pointer_t <_Tp>;
621
618
using __const_pointer _LIBCPP_NODEBUG = std::add_pointer_t <const _Tp>;
619
+
620
+ public:
621
+ using value_type = _Tp;
622
+
623
+ # if _LIBCPP_STD_VER >= 26
622
624
# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_OPTIONAL
623
625
using iterator = __bounded_iter<__wrap_iter<__pointer>>;
624
626
using const_iterator = __bounded_iter<__wrap_iter<__const_pointer>>;
625
627
# else
626
628
using iterator = __wrap_iter<__pointer>;
627
629
using const_iterator = __wrap_iter<__const_pointer>;
628
630
# endif
629
- };
630
-
631
- # endif
632
-
633
- template <class _Tp >
634
- class _LIBCPP_DECLSPEC_EMPTY_BASES optional
635
- : private __optional_move_assign_base<_Tp>,
636
- private __optional_sfinae_ctor_base_t <_Tp>,
637
- private __optional_sfinae_assign_base_t <_Tp>,
638
- public __optional_iterator_aliases<_Tp> {
639
- using __base _LIBCPP_NODEBUG = __optional_move_assign_base<_Tp>;
640
- using __iter_aliases _LIBCPP_NODEBUG = __optional_iterator_aliases<_Tp>;
641
- # if _LIBCPP_STD_VER >= 26
642
- using typename __iter_aliases::__const_pointer;
643
- using typename __iter_aliases::__pointer;
644
- # endif
645
-
646
- public:
647
- using value_type = _Tp;
648
-
649
- # if _LIBCPP_STD_VER >= 26
650
- using typename __iter_aliases::const_iterator;
651
- using typename __iter_aliases::iterator;
652
631
# endif
653
632
using __trivially_relocatable _LIBCPP_NODEBUG =
654
633
conditional_t <__libcpp_is_trivially_relocatable<_Tp>::value, optional, void >;
0 commit comments