@@ -672,44 +672,41 @@ public:
672
672
_LIBCPP_HIDE_FROM_ABI constexpr optional (optional&&) = default;
673
673
_LIBCPP_HIDE_FROM_ABI constexpr optional (nullopt_t ) noexcept {}
674
674
675
- template <
676
- class _InPlaceT ,
677
- class ... _Args,
678
- class = enable_if_t < _And< _IsSame<_InPlaceT, in_place_t >, is_constructible<value_type, _Args...> >::value > >
675
+ template <class _InPlaceT ,
676
+ class ... _Args,
677
+ enable_if_t <_And<_IsSame<_InPlaceT, in_place_t >, is_constructible<value_type, _Args...>>::value, int > = 0 >
679
678
_LIBCPP_HIDE_FROM_ABI constexpr explicit optional (_InPlaceT, _Args&&... __args)
680
679
: __base(in_place, std::forward<_Args>(__args)...) {}
681
680
682
681
template <class _Up ,
683
682
class ... _Args,
684
- class = enable_if_t < is_constructible_v<value_type, initializer_list<_Up>&, _Args...>> >
683
+ enable_if_t <is_constructible_v<value_type, initializer_list<_Up>&, _Args...>, int > = 0 >
685
684
_LIBCPP_HIDE_FROM_ABI constexpr explicit optional (in_place_t , initializer_list<_Up> __il, _Args&&... __args)
686
685
: __base(in_place, __il, std::forward<_Args>(__args)...) {}
687
686
688
- template <class _Up = value_type,
689
- enable_if_t < _CheckOptionalArgsCtor<_Up>::template __enable_implicit<_Up>(), int > = 0 >
687
+ template <class _Up = value_type,
688
+ enable_if_t <_CheckOptionalArgsCtor<_Up>::template __enable_implicit<_Up>(), int > = 0 >
690
689
_LIBCPP_HIDE_FROM_ABI constexpr optional (_Up&& __v) : __base(in_place, std::forward<_Up>(__v)) {}
691
690
692
- template <class _Up , enable_if_t < _CheckOptionalArgsCtor<_Up>::template __enable_explicit<_Up>(), int > = 0 >
691
+ template <class _Up , enable_if_t <_CheckOptionalArgsCtor<_Up>::template __enable_explicit<_Up>(), int > = 0 >
693
692
_LIBCPP_HIDE_FROM_ABI constexpr explicit optional (_Up&& __v) : __base(in_place, std::forward<_Up>(__v)) {}
694
693
695
694
// LWG2756: conditionally explicit conversion from const optional<_Up>&
696
- template <class _Up ,
697
- enable_if_t < _CheckOptionalLikeCtor<_Up, _Up const &>::template __enable_implicit<_Up>(), int > = 0 >
695
+ template <class _Up , enable_if_t <_CheckOptionalLikeCtor<_Up, _Up const &>::template __enable_implicit<_Up>(), int > = 0 >
698
696
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional (const optional<_Up>& __v) {
699
697
this ->__construct_from (__v);
700
698
}
701
- template <class _Up ,
702
- enable_if_t < _CheckOptionalLikeCtor<_Up, _Up const &>::template __enable_explicit<_Up>(), int > = 0 >
699
+ template <class _Up , enable_if_t <_CheckOptionalLikeCtor<_Up, _Up const &>::template __enable_explicit<_Up>(), int > = 0 >
703
700
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional (const optional<_Up>& __v) {
704
701
this ->__construct_from (__v);
705
702
}
706
703
707
704
// LWG2756: conditionally explicit conversion from optional<_Up>&&
708
- template <class _Up , enable_if_t < _CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_implicit<_Up>(), int > = 0 >
705
+ template <class _Up , enable_if_t <_CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_implicit<_Up>(), int > = 0 >
709
706
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional (optional<_Up>&& __v) {
710
707
this ->__construct_from (std::move (__v));
711
708
}
712
- template <class _Up , enable_if_t < _CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_explicit<_Up>(), int > = 0 >
709
+ template <class _Up , enable_if_t <_CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_explicit<_Up>(), int > = 0 >
713
710
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional (optional<_Up>&& __v) {
714
711
this ->__construct_from (std::move (__v));
715
712
}
@@ -718,7 +715,7 @@ public:
718
715
template <class _Tag ,
719
716
class _Fp ,
720
717
class ... _Args,
721
- __enable_if_t <_IsSame<_Tag, __optional_construct_from_invoke_tag>::value, int > = 0 >
718
+ enable_if_t <_IsSame<_Tag, __optional_construct_from_invoke_tag>::value, int > = 0 >
722
719
_LIBCPP_HIDE_FROM_ABI constexpr explicit optional (_Tag, _Fp&& __f, _Args&&... __args)
723
720
: __base(__optional_construct_from_invoke_tag{}, std::forward<_Fp>(__f), std::forward<_Args>(__args)...) {}
724
721
# endif
@@ -732,12 +729,12 @@ public:
732
729
_LIBCPP_HIDE_FROM_ABI constexpr optional& operator =(optional&&) = default ;
733
730
734
731
// LWG2756
735
- template <
736
- class _Up = value_type ,
737
- class = enable_if_t < _And< _IsNotSame<__remove_cvref_t <_Up>, optional >,
738
- _Or< _IsNotSame< __remove_cvref_t <_Up>, value_type>, _Not<is_scalar<value_type>> >,
739
- is_constructible <value_type, _Up>,
740
- is_assignable<value_type&, _Up> >::value> >
732
+ template <class _Up = value_type,
733
+ enable_if_t <_And<_IsNotSame< __remove_cvref_t <_Up>, optional> ,
734
+ _Or< _IsNotSame<__remove_cvref_t <_Up>, value_type>, _Not<is_scalar<value_type>> >,
735
+ is_constructible< value_type, _Up >,
736
+ is_assignable <value_type& , _Up>>::value ,
737
+ int > = 0 >
741
738
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& operator =(_Up&& __v) {
742
739
if (this ->has_value ())
743
740
this ->__get () = std::forward<_Up>(__v);
@@ -747,21 +744,20 @@ public:
747
744
}
748
745
749
746
// LWG2756
750
- template <class _Up ,
751
- enable_if_t < _CheckOptionalLikeAssign<_Up, _Up const &>::template __enable_assign<_Up>(), int > = 0 >
747
+ template <class _Up , enable_if_t <_CheckOptionalLikeAssign<_Up, _Up const &>::template __enable_assign<_Up>(), int > = 0 >
752
748
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& operator =(const optional<_Up>& __v) {
753
749
this ->__assign_from (__v);
754
750
return *this ;
755
751
}
756
752
757
753
// LWG2756
758
- template <class _Up , enable_if_t < _CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_assign<_Up>(), int > = 0 >
754
+ template <class _Up , enable_if_t <_CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_assign<_Up>(), int > = 0 >
759
755
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& operator =(optional<_Up>&& __v) {
760
756
this ->__assign_from (std::move (__v));
761
757
return *this ;
762
758
}
763
759
764
- template <class ... _Args, class = enable_if_t < is_constructible_v<value_type, _Args...> > >
760
+ template <class ... _Args, enable_if_t <is_constructible_v<value_type, _Args...>, int > = 0 >
765
761
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& emplace (_Args&&... __args) {
766
762
reset ();
767
763
this ->__construct (std::forward<_Args>(__args)...);
@@ -770,7 +766,7 @@ public:
770
766
771
767
template <class _Up ,
772
768
class ... _Args,
773
- class = enable_if_t < is_constructible_v<value_type, initializer_list<_Up>&, _Args...> > >
769
+ enable_if_t <is_constructible_v<value_type, initializer_list<_Up>&, _Args...>, int > = 0 >
774
770
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& emplace (initializer_list<_Up> __il, _Args&&... __args) {
775
771
reset ();
776
772
this ->__construct (__il, std::forward<_Args>(__args)...);
@@ -982,77 +978,75 @@ public:
982
978
using __base::reset;
983
979
};
984
980
985
- # if _LIBCPP_STD_VER >= 17
986
981
template <class _Tp >
987
982
optional (_Tp) -> optional<_Tp>;
988
- # endif
989
983
990
984
// Comparisons between optionals
991
- template <class _Tp , class _Up >
992
- _LIBCPP_HIDE_FROM_ABI constexpr enable_if_t <
993
- is_convertible_v< decltype (std::declval< const _Tp&>() == std::declval< const _Up&>()), bool > ,
994
- bool >
995
- operator ==(const optional<_Tp>& __x, const optional<_Up>& __y) {
985
+ template <
986
+ class _Tp ,
987
+ class _Up ,
988
+ enable_if_t <is_convertible_v< decltype (std::declval< const _Tp&>() == std::declval< const _Up&>()), bool >, int > = 0 >
989
+ _LIBCPP_HIDE_FROM_ABI constexpr bool operator ==(const optional<_Tp>& __x, const optional<_Up>& __y) {
996
990
if (static_cast <bool >(__x) != static_cast <bool >(__y))
997
991
return false ;
998
992
if (!static_cast <bool >(__x))
999
993
return true ;
1000
994
return *__x == *__y;
1001
995
}
1002
996
1003
- template <class _Tp , class _Up >
1004
- _LIBCPP_HIDE_FROM_ABI constexpr enable_if_t <
1005
- is_convertible_v< decltype (std::declval< const _Tp&>() != std::declval< const _Up&>()), bool > ,
1006
- bool >
1007
- operator !=(const optional<_Tp>& __x, const optional<_Up>& __y) {
997
+ template <
998
+ class _Tp ,
999
+ class _Up ,
1000
+ enable_if_t <is_convertible_v< decltype (std::declval< const _Tp&>() != std::declval< const _Up&>()), bool >, int > = 0 >
1001
+ _LIBCPP_HIDE_FROM_ABI constexpr bool operator !=(const optional<_Tp>& __x, const optional<_Up>& __y) {
1008
1002
if (static_cast <bool >(__x) != static_cast <bool >(__y))
1009
1003
return true ;
1010
1004
if (!static_cast <bool >(__x))
1011
1005
return false ;
1012
1006
return *__x != *__y;
1013
1007
}
1014
1008
1015
- template <class _Tp , class _Up >
1016
- _LIBCPP_HIDE_FROM_ABI constexpr enable_if_t <
1017
- is_convertible_v< decltype (std::declval< const _Tp&>() < std::declval< const _Up&>()), bool > ,
1018
- bool >
1019
- operator <(const optional<_Tp>& __x, const optional<_Up>& __y) {
1009
+ template <
1010
+ class _Tp ,
1011
+ class _Up ,
1012
+ enable_if_t <is_convertible_v< decltype (std::declval< const _Tp&>() < std::declval< const _Up&>()), bool >, int > = 0 >
1013
+ _LIBCPP_HIDE_FROM_ABI constexpr bool operator <(const optional<_Tp>& __x, const optional<_Up>& __y) {
1020
1014
if (!static_cast <bool >(__y))
1021
1015
return false ;
1022
1016
if (!static_cast <bool >(__x))
1023
1017
return true ;
1024
1018
return *__x < *__y;
1025
1019
}
1026
1020
1027
- template <class _Tp , class _Up >
1028
- _LIBCPP_HIDE_FROM_ABI constexpr enable_if_t <
1029
- is_convertible_v< decltype (std::declval< const _Tp&>() > std::declval< const _Up&>()), bool > ,
1030
- bool >
1031
- operator >(const optional<_Tp>& __x, const optional<_Up>& __y) {
1021
+ template <
1022
+ class _Tp ,
1023
+ class _Up ,
1024
+ enable_if_t <is_convertible_v< decltype (std::declval< const _Tp&>() > std::declval< const _Up&>()), bool >, int > = 0 >
1025
+ _LIBCPP_HIDE_FROM_ABI constexpr bool operator >(const optional<_Tp>& __x, const optional<_Up>& __y) {
1032
1026
if (!static_cast <bool >(__x))
1033
1027
return false ;
1034
1028
if (!static_cast <bool >(__y))
1035
1029
return true ;
1036
1030
return *__x > *__y;
1037
1031
}
1038
1032
1039
- template <class _Tp , class _Up >
1040
- _LIBCPP_HIDE_FROM_ABI constexpr enable_if_t <
1041
- is_convertible_v< decltype (std::declval< const _Tp&>() <= std::declval< const _Up&>()), bool > ,
1042
- bool >
1043
- operator <=(const optional<_Tp>& __x, const optional<_Up>& __y) {
1033
+ template <
1034
+ class _Tp ,
1035
+ class _Up ,
1036
+ enable_if_t <is_convertible_v< decltype (std::declval< const _Tp&>() <= std::declval< const _Up&>()), bool >, int > = 0 >
1037
+ _LIBCPP_HIDE_FROM_ABI constexpr bool operator <=(const optional<_Tp>& __x, const optional<_Up>& __y) {
1044
1038
if (!static_cast <bool >(__x))
1045
1039
return true ;
1046
1040
if (!static_cast <bool >(__y))
1047
1041
return false ;
1048
1042
return *__x <= *__y;
1049
1043
}
1050
1044
1051
- template <class _Tp , class _Up >
1052
- _LIBCPP_HIDE_FROM_ABI constexpr enable_if_t <
1053
- is_convertible_v< decltype (std::declval< const _Tp&>() >= std::declval< const _Up&>()), bool > ,
1054
- bool >
1055
- operator >=(const optional<_Tp>& __x, const optional<_Up>& __y) {
1045
+ template <
1046
+ class _Tp ,
1047
+ class _Up ,
1048
+ enable_if_t <is_convertible_v< decltype (std::declval< const _Tp&>() >= std::declval< const _Up&>()), bool >, int > = 0 >
1049
+ _LIBCPP_HIDE_FROM_ABI constexpr bool operator >=(const optional<_Tp>& __x, const optional<_Up>& __y) {
1056
1050
if (!static_cast <bool >(__y))
1057
1051
return true ;
1058
1052
if (!static_cast <bool >(__x))
@@ -1145,99 +1139,99 @@ _LIBCPP_HIDE_FROM_ABI constexpr strong_ordering operator<=>(const optional<_Tp>&
1145
1139
# endif // _LIBCPP_STD_VER <= 17
1146
1140
1147
1141
// Comparisons with T
1148
- template <class _Tp , class _Up >
1149
- _LIBCPP_HIDE_FROM_ABI constexpr enable_if_t <
1150
- is_convertible_v< decltype (std::declval< const _Tp&>() == std::declval< const _Up&>()), bool > ,
1151
- bool >
1152
- operator ==(const optional<_Tp>& __x, const _Up& __v) {
1142
+ template <
1143
+ class _Tp ,
1144
+ class _Up ,
1145
+ enable_if_t <is_convertible_v< decltype (std::declval< const _Tp&>() == std::declval< const _Up&>()), bool >, int > = 0 >
1146
+ _LIBCPP_HIDE_FROM_ABI constexpr bool operator ==(const optional<_Tp>& __x, const _Up& __v) {
1153
1147
return static_cast <bool >(__x) ? *__x == __v : false ;
1154
1148
}
1155
1149
1156
- template <class _Tp , class _Up >
1157
- _LIBCPP_HIDE_FROM_ABI constexpr enable_if_t <
1158
- is_convertible_v< decltype (std::declval< const _Tp&>() == std::declval< const _Up&>()), bool > ,
1159
- bool >
1160
- operator ==(const _Tp& __v, const optional<_Up>& __x) {
1150
+ template <
1151
+ class _Tp ,
1152
+ class _Up ,
1153
+ enable_if_t <is_convertible_v< decltype (std::declval< const _Tp&>() == std::declval< const _Up&>()), bool >, int > = 0 >
1154
+ _LIBCPP_HIDE_FROM_ABI constexpr bool operator ==(const _Tp& __v, const optional<_Up>& __x) {
1161
1155
return static_cast <bool >(__x) ? __v == *__x : false ;
1162
1156
}
1163
1157
1164
- template <class _Tp , class _Up >
1165
- _LIBCPP_HIDE_FROM_ABI constexpr enable_if_t <
1166
- is_convertible_v< decltype (std::declval< const _Tp&>() != std::declval< const _Up&>()), bool > ,
1167
- bool >
1168
- operator !=(const optional<_Tp>& __x, const _Up& __v) {
1158
+ template <
1159
+ class _Tp ,
1160
+ class _Up ,
1161
+ enable_if_t <is_convertible_v< decltype (std::declval< const _Tp&>() != std::declval< const _Up&>()), bool >, int > = 0 >
1162
+ _LIBCPP_HIDE_FROM_ABI constexpr bool operator !=(const optional<_Tp>& __x, const _Up& __v) {
1169
1163
return static_cast <bool >(__x) ? *__x != __v : true ;
1170
1164
}
1171
1165
1172
- template <class _Tp , class _Up >
1173
- _LIBCPP_HIDE_FROM_ABI constexpr enable_if_t <
1174
- is_convertible_v< decltype (std::declval< const _Tp&>() != std::declval< const _Up&>()), bool > ,
1175
- bool >
1176
- operator !=(const _Tp& __v, const optional<_Up>& __x) {
1166
+ template <
1167
+ class _Tp ,
1168
+ class _Up ,
1169
+ enable_if_t <is_convertible_v< decltype (std::declval< const _Tp&>() != std::declval< const _Up&>()), bool >, int > = 0 >
1170
+ _LIBCPP_HIDE_FROM_ABI constexpr bool operator !=(const _Tp& __v, const optional<_Up>& __x) {
1177
1171
return static_cast <bool >(__x) ? __v != *__x : true ;
1178
1172
}
1179
1173
1180
- template <class _Tp , class _Up >
1181
- _LIBCPP_HIDE_FROM_ABI constexpr enable_if_t <
1182
- is_convertible_v< decltype (std::declval< const _Tp&>() < std::declval< const _Up&>()), bool > ,
1183
- bool >
1184
- operator <(const optional<_Tp>& __x, const _Up& __v) {
1174
+ template <
1175
+ class _Tp ,
1176
+ class _Up ,
1177
+ enable_if_t <is_convertible_v< decltype (std::declval< const _Tp&>() < std::declval< const _Up&>()), bool >, int > = 0 >
1178
+ _LIBCPP_HIDE_FROM_ABI constexpr bool operator <(const optional<_Tp>& __x, const _Up& __v) {
1185
1179
return static_cast <bool >(__x) ? *__x < __v : true ;
1186
1180
}
1187
1181
1188
- template <class _Tp , class _Up >
1189
- _LIBCPP_HIDE_FROM_ABI constexpr enable_if_t <
1190
- is_convertible_v< decltype (std::declval< const _Tp&>() < std::declval< const _Up&>()), bool > ,
1191
- bool >
1192
- operator <(const _Tp& __v, const optional<_Up>& __x) {
1182
+ template <
1183
+ class _Tp ,
1184
+ class _Up ,
1185
+ enable_if_t <is_convertible_v< decltype (std::declval< const _Tp&>() < std::declval< const _Up&>()), bool >, int > = 0 >
1186
+ _LIBCPP_HIDE_FROM_ABI constexpr bool operator <(const _Tp& __v, const optional<_Up>& __x) {
1193
1187
return static_cast <bool >(__x) ? __v < *__x : false ;
1194
1188
}
1195
1189
1196
- template <class _Tp , class _Up >
1197
- _LIBCPP_HIDE_FROM_ABI constexpr enable_if_t <
1198
- is_convertible_v< decltype (std::declval< const _Tp&>() <= std::declval< const _Up&>()), bool > ,
1199
- bool >
1200
- operator <=(const optional<_Tp>& __x, const _Up& __v) {
1190
+ template <
1191
+ class _Tp ,
1192
+ class _Up ,
1193
+ enable_if_t <is_convertible_v< decltype (std::declval< const _Tp&>() <= std::declval< const _Up&>()), bool >, int > = 0 >
1194
+ _LIBCPP_HIDE_FROM_ABI constexpr bool operator <=(const optional<_Tp>& __x, const _Up& __v) {
1201
1195
return static_cast <bool >(__x) ? *__x <= __v : true ;
1202
1196
}
1203
1197
1204
- template <class _Tp , class _Up >
1205
- _LIBCPP_HIDE_FROM_ABI constexpr enable_if_t <
1206
- is_convertible_v< decltype (std::declval< const _Tp&>() <= std::declval< const _Up&>()), bool > ,
1207
- bool >
1208
- operator <=(const _Tp& __v, const optional<_Up>& __x) {
1198
+ template <
1199
+ class _Tp ,
1200
+ class _Up ,
1201
+ enable_if_t <is_convertible_v< decltype (std::declval< const _Tp&>() <= std::declval< const _Up&>()), bool >, int > = 0 >
1202
+ _LIBCPP_HIDE_FROM_ABI constexpr bool operator <=(const _Tp& __v, const optional<_Up>& __x) {
1209
1203
return static_cast <bool >(__x) ? __v <= *__x : false ;
1210
1204
}
1211
1205
1212
- template <class _Tp , class _Up >
1213
- _LIBCPP_HIDE_FROM_ABI constexpr enable_if_t <
1214
- is_convertible_v< decltype (std::declval< const _Tp&>() > std::declval< const _Up&>()), bool > ,
1215
- bool >
1216
- operator >(const optional<_Tp>& __x, const _Up& __v) {
1206
+ template <
1207
+ class _Tp ,
1208
+ class _Up ,
1209
+ enable_if_t <is_convertible_v< decltype (std::declval< const _Tp&>() > std::declval< const _Up&>()), bool >, int > = 0 >
1210
+ _LIBCPP_HIDE_FROM_ABI constexpr bool operator >(const optional<_Tp>& __x, const _Up& __v) {
1217
1211
return static_cast <bool >(__x) ? *__x > __v : false ;
1218
1212
}
1219
1213
1220
- template <class _Tp , class _Up >
1221
- _LIBCPP_HIDE_FROM_ABI constexpr enable_if_t <
1222
- is_convertible_v< decltype (std::declval< const _Tp&>() > std::declval< const _Up&>()), bool > ,
1223
- bool >
1224
- operator >(const _Tp& __v, const optional<_Up>& __x) {
1214
+ template <
1215
+ class _Tp ,
1216
+ class _Up ,
1217
+ enable_if_t <is_convertible_v< decltype (std::declval< const _Tp&>() > std::declval< const _Up&>()), bool >, int > = 0 >
1218
+ _LIBCPP_HIDE_FROM_ABI constexpr bool operator >(const _Tp& __v, const optional<_Up>& __x) {
1225
1219
return static_cast <bool >(__x) ? __v > *__x : true ;
1226
1220
}
1227
1221
1228
- template <class _Tp , class _Up >
1229
- _LIBCPP_HIDE_FROM_ABI constexpr enable_if_t <
1230
- is_convertible_v< decltype (std::declval< const _Tp&>() >= std::declval< const _Up&>()), bool > ,
1231
- bool >
1232
- operator >=(const optional<_Tp>& __x, const _Up& __v) {
1222
+ template <
1223
+ class _Tp ,
1224
+ class _Up ,
1225
+ enable_if_t <is_convertible_v< decltype (std::declval< const _Tp&>() >= std::declval< const _Up&>()), bool >, int > = 0 >
1226
+ _LIBCPP_HIDE_FROM_ABI constexpr bool operator >=(const optional<_Tp>& __x, const _Up& __v) {
1233
1227
return static_cast <bool >(__x) ? *__x >= __v : false ;
1234
1228
}
1235
1229
1236
- template <class _Tp , class _Up >
1237
- _LIBCPP_HIDE_FROM_ABI constexpr enable_if_t <
1238
- is_convertible_v< decltype (std::declval< const _Tp&>() >= std::declval< const _Up&>()), bool > ,
1239
- bool >
1240
- operator >=(const _Tp& __v, const optional<_Up>& __x) {
1230
+ template <
1231
+ class _Tp ,
1232
+ class _Up ,
1233
+ enable_if_t <is_convertible_v< decltype (std::declval< const _Tp&>() >= std::declval< const _Up&>()), bool >, int > = 0 >
1234
+ _LIBCPP_HIDE_FROM_ABI constexpr bool operator >=(const _Tp& __v, const optional<_Up>& __x) {
1241
1235
return static_cast <bool >(__x) ? __v >= *__x : true ;
1242
1236
}
1243
1237
@@ -1252,9 +1246,8 @@ operator<=>(const optional<_Tp>& __x, const _Up& __v) {
1252
1246
1253
1247
# endif // _LIBCPP_STD_VER >= 20
1254
1248
1255
- template <class _Tp >
1256
- inline _LIBCPP_HIDE_FROM_ABI
1257
- _LIBCPP_CONSTEXPR_SINCE_CXX20 enable_if_t < is_move_constructible_v<_Tp> && is_swappable_v<_Tp>, void >
1249
+ template <class _Tp , enable_if_t < is_move_constructible_v<_Tp> && is_swappable_v<_Tp>, int > = 0 >
1250
+ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
1258
1251
swap (optional<_Tp>& __x, optional<_Tp>& __y) noexcept (noexcept (__x.swap(__y))) {
1259
1252
__x.swap (__y);
1260
1253
}
0 commit comments