@@ -48,7 +48,8 @@ namespace std {
48
48
constexpr variant& operator=(const variant&);
49
49
constexpr variant& operator=(variant&&) noexcept(see below);
50
50
51
- template <class T> variant& operator=(T&&) noexcept(see below);
51
+ template <class T>
52
+ constexpr variant& operator=(T&&) noexcept(see below); // constexpr since c++20
52
53
53
54
// 20.7.2.4, modifiers
54
55
template <class T, class... Args>
@@ -688,7 +689,7 @@ union _LIBCPP_TEMPLATE_VIS __union<_DestructibleTrait, _Index> {};
688
689
__union (const __union&) = default ; \
689
690
__union (__union&&) = default ; \
690
691
\
691
- destructor \
692
+ _LIBCPP_HIDE_FROM_ABI destructor \
692
693
\
693
694
__union& \
694
695
operator =(const __union&) = default ; \
@@ -758,10 +759,10 @@ class _LIBCPP_TEMPLATE_VIS __dtor;
758
759
using __base_type::__base_type; \
759
760
using __base_type::operator =; \
760
761
\
761
- __dtor (const __dtor&) = default ; \
762
- __dtor (__dtor&&) = default ; \
763
- destructor __dtor& operator =(const __dtor&) = default ; \
764
- __dtor& operator =(__dtor&&) = default ; \
762
+ __dtor (const __dtor&) = default ; \
763
+ __dtor (__dtor&&) = default ; \
764
+ _LIBCPP_HIDE_FROM_ABI destructor __dtor& operator =(const __dtor&) = default ; \
765
+ __dtor& operator =(__dtor&&) = default ; \
765
766
\
766
767
protected: \
767
768
inline _LIBCPP_HIDE_FROM_ABI destroy \
@@ -801,7 +802,7 @@ public:
801
802
802
803
protected:
803
804
template <class _Rhs >
804
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI static void __generic_construct (__ctor& __lhs, _Rhs&& __rhs) {
805
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX20 void __generic_construct (__ctor& __lhs, _Rhs&& __rhs) {
805
806
__lhs.__destroy ();
806
807
if (!__rhs.valueless_by_exception ()) {
807
808
// We cannot directly construct at the target __alt because its direct enclosing union is not activated yet.
@@ -835,10 +836,10 @@ class _LIBCPP_TEMPLATE_VIS __move_constructor;
835
836
using __base_type::__base_type; \
836
837
using __base_type::operator =; \
837
838
\
838
- __move_constructor (const __move_constructor&) = default ; \
839
- move_constructor ~__move_constructor () = default ; \
840
- __move_constructor& operator =(const __move_constructor&) = default ; \
841
- __move_constructor& operator =(__move_constructor&&) = default ; \
839
+ __move_constructor (const __move_constructor&) = default ; \
840
+ _LIBCPP_HIDE_FROM_ABI move_constructor ~__move_constructor () = default ; \
841
+ __move_constructor& operator =(const __move_constructor&) = default ; \
842
+ __move_constructor& operator =(__move_constructor&&) = default ; \
842
843
}
843
844
844
845
_LIBCPP_VARIANT_MOVE_CONSTRUCTOR (
@@ -869,10 +870,10 @@ class _LIBCPP_TEMPLATE_VIS __copy_constructor;
869
870
using __base_type::__base_type; \
870
871
using __base_type::operator =; \
871
872
\
872
- copy_constructor __copy_constructor (__copy_constructor&&) = default; \
873
- ~__copy_constructor () = default ; \
874
- __copy_constructor& operator =(const __copy_constructor&) = default ; \
875
- __copy_constructor& operator =(__copy_constructor&&) = default ; \
873
+ _LIBCPP_HIDE_FROM_ABI copy_constructor __copy_constructor (__copy_constructor&&) = default; \
874
+ ~__copy_constructor () = default ; \
875
+ __copy_constructor& operator =(const __copy_constructor&) = default ; \
876
+ __copy_constructor& operator =(__copy_constructor&&) = default ; \
876
877
}
877
878
878
879
_LIBCPP_VARIANT_COPY_CONSTRUCTOR (
@@ -897,7 +898,7 @@ public:
897
898
using __base_type::operator =;
898
899
899
900
template <size_t _Ip, class ... _Args>
900
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI auto & __emplace (_Args&&... __args) {
901
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 auto & __emplace (_Args&&... __args) {
901
902
this ->__destroy ();
902
903
std::__construct_at (std::addressof (this ->__data ), in_place_index<_Ip>, std::forward<_Args>(__args)...);
903
904
this ->__index = _Ip;
@@ -906,15 +907,15 @@ public:
906
907
907
908
protected:
908
909
template <size_t _Ip, class _Tp , class _Arg >
909
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __assign_alt (__alt<_Ip, _Tp>& __a, _Arg&& __arg) {
910
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __assign_alt (__alt<_Ip, _Tp>& __a, _Arg&& __arg) {
910
911
if (this ->index () == _Ip) {
911
912
__a.__value = std::forward<_Arg>(__arg);
912
913
} else {
913
914
struct {
914
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void operator ()(true_type) const {
915
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void operator ()(true_type) const {
915
916
__this->__emplace <_Ip>(std::forward<_Arg>(__arg));
916
917
}
917
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void operator ()(false_type) const {
918
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void operator ()(false_type) const {
918
919
__this->__emplace <_Ip>(_Tp (std::forward<_Arg>(__arg)));
919
920
}
920
921
__assignment* __this;
@@ -925,7 +926,7 @@ protected:
925
926
}
926
927
927
928
template <class _That >
928
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __generic_assign (_That&& __that) {
929
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __generic_assign (_That&& __that) {
929
930
if (this ->valueless_by_exception () && __that.valueless_by_exception ()) {
930
931
// do nothing.
931
932
} else if (__that.valueless_by_exception ()) {
@@ -959,7 +960,7 @@ class _LIBCPP_TEMPLATE_VIS __move_assignment;
959
960
__move_assignment (__move_assignment&&) = default ; \
960
961
~__move_assignment () = default ; \
961
962
__move_assignment& operator =(const __move_assignment&) = default ; \
962
- move_assignment \
963
+ _LIBCPP_HIDE_FROM_ABI move_assignment \
963
964
}
964
965
965
966
_LIBCPP_VARIANT_MOVE_ASSIGNMENT (
@@ -993,10 +994,10 @@ class _LIBCPP_TEMPLATE_VIS __copy_assignment;
993
994
using __base_type::__base_type; \
994
995
using __base_type::operator =; \
995
996
\
996
- __copy_assignment (const __copy_assignment&) = default ; \
997
- __copy_assignment (__copy_assignment&&) = default ; \
998
- ~__copy_assignment () = default ; \
999
- copy_assignment __copy_assignment& operator =(__copy_assignment&&) = default ; \
997
+ __copy_assignment (const __copy_assignment&) = default ; \
998
+ __copy_assignment (__copy_assignment&&) = default ; \
999
+ ~__copy_assignment () = default ; \
1000
+ _LIBCPP_HIDE_FROM_ABI copy_assignment __copy_assignment& operator =(__copy_assignment&&) = default ; \
1000
1001
}
1001
1002
1002
1003
_LIBCPP_VARIANT_COPY_ASSIGNMENT (
@@ -1027,11 +1028,11 @@ public:
1027
1028
_LIBCPP_HIDE_FROM_ABI __impl& operator =(__impl&&) = default ;
1028
1029
1029
1030
template <size_t _Ip, class _Arg >
1030
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __assign (_Arg&& __arg) {
1031
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __assign (_Arg&& __arg) {
1031
1032
this ->__assign_alt (__access::__base::__get_alt<_Ip>(*this ), std::forward<_Arg>(__arg));
1032
1033
}
1033
1034
1034
- _LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI void __swap (__impl& __that) {
1035
+ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __swap (__impl& __that) {
1035
1036
if (this ->valueless_by_exception () && __that.valueless_by_exception ()) {
1036
1037
// do nothing.
1037
1038
} else if (this ->index () == __that.index ()) {
@@ -1240,7 +1241,7 @@ public:
1240
1241
_Args&&... __args) noexcept (is_nothrow_constructible_v<_Tp, initializer_list< _Up>&, _Args...>)
1241
1242
: __impl_(in_place_index<_Ip>, __il, std::forward<_Args>(__args)...) {}
1242
1243
1243
- _LIBCPP_HIDE_FROM_ABI constexpr ~variant () = default ;
1244
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 ~variant () = default ;
1244
1245
1245
1246
_LIBCPP_HIDE_FROM_ABI constexpr variant& operator =(const variant&) = default ;
1246
1247
_LIBCPP_HIDE_FROM_ABI constexpr variant& operator =(variant&&) = default ;
@@ -1250,7 +1251,7 @@ public:
1250
1251
class _Tp = __variant_detail::__best_match_t <_Arg, _Types...>,
1251
1252
size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
1252
1253
enable_if_t <is_assignable_v<_Tp&, _Arg> && is_constructible_v<_Tp, _Arg>, int > = 0 >
1253
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI variant&
1254
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 variant&
1254
1255
operator =(_Arg&& __arg) noexcept (is_nothrow_assignable_v<_Tp&, _Arg> && is_nothrow_constructible_v<_Tp, _Arg>) {
1255
1256
__impl_.template __assign <_Ip>(std::forward<_Arg>(__arg));
1256
1257
return *this ;
@@ -1261,7 +1262,7 @@ public:
1261
1262
enable_if_t <(_Ip < sizeof ...(_Types)), int > = 0 ,
1262
1263
class _Tp = variant_alternative_t <_Ip, variant<_Types...>>,
1263
1264
enable_if_t <is_constructible_v<_Tp, _Args...>, int > = 0 >
1264
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI _Tp& emplace (_Args&&... __args) {
1265
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& emplace (_Args&&... __args) {
1265
1266
return __impl_.template __emplace <_Ip>(std::forward<_Args>(__args)...);
1266
1267
}
1267
1268
@@ -1271,15 +1272,15 @@ public:
1271
1272
enable_if_t <(_Ip < sizeof ...(_Types)), int > = 0 ,
1272
1273
class _Tp = variant_alternative_t <_Ip, variant<_Types...>>,
1273
1274
enable_if_t <is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>, int > = 0 >
1274
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI _Tp& emplace (initializer_list<_Up> __il, _Args&&... __args) {
1275
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& emplace (initializer_list<_Up> __il, _Args&&... __args) {
1275
1276
return __impl_.template __emplace <_Ip>(__il, std::forward<_Args>(__args)...);
1276
1277
}
1277
1278
1278
1279
template < class _Tp ,
1279
1280
class ... _Args,
1280
1281
size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
1281
1282
enable_if_t <is_constructible_v<_Tp, _Args...>, int > = 0 >
1282
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI _Tp& emplace (_Args&&... __args) {
1283
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& emplace (_Args&&... __args) {
1283
1284
return __impl_.template __emplace <_Ip>(std::forward<_Args>(__args)...);
1284
1285
}
1285
1286
@@ -1288,7 +1289,7 @@ public:
1288
1289
class ... _Args,
1289
1290
size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
1290
1291
enable_if_t <is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>, int > = 0 >
1291
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI _Tp& emplace (initializer_list<_Up> __il, _Args&&... __args) {
1292
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& emplace (initializer_list<_Up> __il, _Args&&... __args) {
1292
1293
return __impl_.template __emplace <_Ip>(__il, std::forward<_Args>(__args)...);
1293
1294
}
1294
1295
@@ -1302,7 +1303,7 @@ public:
1302
1303
enable_if_t < __all<(__dependent_type<is_move_constructible<_Types>, _Dummy>::value &&
1303
1304
__dependent_type<is_swappable<_Types>, _Dummy>::value)...>::value,
1304
1305
int > = 0 >
1305
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void swap (variant& __that) noexcept (
1306
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap (variant& __that) noexcept (
1306
1307
__all<(is_nothrow_move_constructible_v<_Types> && is_nothrow_swappable_v<_Types>)...>::value) {
1307
1308
__impl_.__swap (__that.__impl_ );
1308
1309
}
0 commit comments