757#if __cpp_concepts && __cpp_consteval && __cpp_conditional_explicit
758 template<
typename... _UTypes>
759 static consteval bool
762 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
768 template<
typename... _UTypes>
769 static consteval bool
770 __nothrow_constructible()
772 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
778 template<
typename... _UTypes>
779 static consteval bool
782 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
790 template<
typename... _UTypes>
791 static consteval bool
792 __disambiguating_constraint()
794 if constexpr (
sizeof...(_Elements) !=
sizeof...(_UTypes))
796 else if constexpr (
sizeof...(_Elements) == 1)
798 using _U0 =
typename _Nth_type<0, _UTypes...>::type;
799 return !is_same_v<remove_cvref_t<_U0>,
tuple>;
801 else if constexpr (
sizeof...(_Elements) < 4)
803 using _U0 =
typename _Nth_type<0, _UTypes...>::type;
804 if constexpr (!is_same_v<remove_cvref_t<_U0>, allocator_arg_t>)
808 using _T0 =
typename _Nth_type<0, _Elements...>::type;
809 return is_same_v<remove_cvref_t<_T0>, allocator_arg_t>;
818 template<
typename _Tuple>
819 static consteval bool
822 if constexpr (
sizeof...(_Elements) != 1)
824 else if constexpr (is_same_v<remove_cvref_t<_Tuple>,
tuple>)
828 using _Tp =
typename _Nth_type<0, _Elements...>::type;
829 if constexpr (is_convertible_v<_Tuple, _Tp>)
831 else if constexpr (is_constructible_v<_Tp, _Tuple>)
837 template<
typename... _Up>
838 static consteval bool
841#if __has_builtin(__reference_constructs_from_temporary)
842 return (__reference_constructs_from_temporary(_Elements, _Up&&)
851 explicit(!(__is_implicitly_default_constructible_v<_Elements> && ...))
853 noexcept((is_nothrow_default_constructible_v<_Elements> && ...))
854 requires (is_default_constructible_v<_Elements> && ...)
858 constexpr explicit(!__convertible<
const _Elements&...>())
859 tuple(
const _Elements&... __elements)
860 noexcept(__nothrow_constructible<
const _Elements&...>())
861 requires (__constructible<
const _Elements&...>())
865 template<
typename... _UTypes>
866 requires (__disambiguating_constraint<_UTypes...>())
867 && (__constructible<_UTypes...>())
868 && (!__dangles<_UTypes...>())
869 constexpr explicit(!__convertible<_UTypes...>())
870 tuple(_UTypes&&... __u)
871 noexcept(__nothrow_constructible<_UTypes...>())
875 template<
typename... _UTypes>
876 requires (__disambiguating_constraint<_UTypes...>())
877 && (__constructible<_UTypes...>())
878 && (__dangles<_UTypes...>())
879 tuple(_UTypes&&...) =
delete;
885 template<
typename... _UTypes>
886 requires (__constructible<
const _UTypes&...>())
887 && (!__use_other_ctor<
const tuple<_UTypes...>&>())
888 && (!__dangles<
const _UTypes&...>())
889 constexpr explicit(!__convertible<
const _UTypes&...>())
891 noexcept(__nothrow_constructible<
const _UTypes&...>())
895 template<
typename... _UTypes>
896 requires (__constructible<
const _UTypes&...>())
897 && (!__use_other_ctor<
const tuple<_UTypes...>&>())
898 && (__dangles<
const _UTypes&...>())
901 template<
typename... _UTypes>
902 requires (__constructible<_UTypes...>())
903 && (!__use_other_ctor<
tuple<_UTypes...>>())
904 && (!__dangles<_UTypes...>())
905 constexpr explicit(!__convertible<_UTypes...>())
907 noexcept(__nothrow_constructible<_UTypes...>())
911 template<
typename... _UTypes>
912 requires (__constructible<_UTypes...>())
913 && (!__use_other_ctor<
tuple<_UTypes...>>())
914 && (__dangles<_UTypes...>())
917#if __cpp_lib_ranges_zip
918 template<
typename... _UTypes>
919 requires (__constructible<_UTypes&...>())
920 && (!__use_other_ctor<
tuple<_UTypes...>&>())
921 && (!__dangles<_UTypes&...>())
922 constexpr explicit(!__convertible<_UTypes&...>())
924 noexcept(__nothrow_constructible<_UTypes&...>())
928 template<
typename... _UTypes>
929 requires (__constructible<_UTypes&...>())
930 && (!__use_other_ctor<
tuple<_UTypes...>&>())
931 && (__dangles<_UTypes&...>())
934 template<
typename... _UTypes>
935 requires (__constructible<
const _UTypes...>())
936 && (!__use_other_ctor<
const tuple<_UTypes...>>())
937 && (!__dangles<
const _UTypes...>())
938 constexpr explicit(!__convertible<
const _UTypes...>())
940 noexcept(__nothrow_constructible<
const _UTypes...>())
944 template<
typename... _UTypes>
945 requires (__constructible<
const _UTypes...>())
946 && (!__use_other_ctor<
const tuple<_UTypes...>>())
947 && (__dangles<
const _UTypes...>())
951 template<
typename _U1,
typename _U2>
952 requires (
sizeof...(_Elements) == 2)
953 && (__constructible<const _U1&, const _U2&>())
954 && (!__dangles<const _U1&, const _U2&>())
955 constexpr explicit(!__convertible<const _U1&, const _U2&>())
957 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
961 template<
typename _U1,
typename _U2>
962 requires (
sizeof...(_Elements) == 2)
963 && (__constructible<const _U1&, const _U2&>())
964 && (__dangles<const _U1&, const _U2&>())
967 template<
typename _U1,
typename _U2>
968 requires (
sizeof...(_Elements) == 2)
969 && (__constructible<_U1, _U2>())
970 && (!__dangles<_U1, _U2>())
971 constexpr explicit(!__convertible<_U1, _U2>())
973 noexcept(__nothrow_constructible<_U1, _U2>())
975 std::forward<_U2>(__u.second))
978 template<
typename _U1,
typename _U2>
979 requires (
sizeof...(_Elements) == 2)
980 && (__constructible<_U1, _U2>())
981 && (__dangles<_U1, _U2>())
984#if __cpp_lib_ranges_zip
985 template<
typename _U1,
typename _U2>
986 requires (
sizeof...(_Elements) == 2)
987 && (__constructible<_U1&, _U2&>())
988 && (!__dangles<_U1&, _U2&>())
989 constexpr explicit(!__convertible<_U1&, _U2&>())
991 noexcept(__nothrow_constructible<_U1&, _U2&>())
995 template<
typename _U1,
typename _U2>
996 requires (
sizeof...(_Elements) == 2)
997 && (__constructible<_U1&, _U2&>())
998 && (__dangles<_U1&, _U2&>())
1001 template<
typename _U1,
typename _U2>
1002 requires (
sizeof...(_Elements) == 2)
1003 && (__constructible<const _U1, const _U2>())
1004 && (!__dangles<const _U1, const _U2>())
1005 constexpr explicit(!__convertible<const _U1, const _U2>())
1007 noexcept(__nothrow_constructible<const _U1, const _U2>())
1008 :
_Inherited(std::forward<const _U1>(__u.first),
1009 std::forward<const _U2>(__u.second))
1012 template<
typename _U1,
typename _U2>
1013 requires (
sizeof...(_Elements) == 2)
1014 && (__constructible<const _U1, const _U2>())
1015 && (__dangles<const _U1, const _U2>())
1019#if 0 && __cpp_lib_tuple_like
1020 template<__tuple_like _UTuple>
1021 constexpr explicit(...)
1022 tuple(_UTuple&& __u);
1027 template<
typename _Alloc>
1029 explicit(!(__is_implicitly_default_constructible_v<_Elements> && ...))
1030 tuple(allocator_arg_t __tag,
const _Alloc& __a)
1031 requires (is_default_constructible_v<_Elements> && ...)
1035 template<
typename _Alloc>
1036 constexpr explicit(!__convertible<
const _Elements&...>())
1037 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1038 const _Elements&... __elements)
1039 requires (__constructible<
const _Elements&...>())
1043 template<
typename _Alloc,
typename... _UTypes>
1044 requires (__disambiguating_constraint<_UTypes...>())
1045 && (__constructible<_UTypes...>())
1046 && (!__dangles<_UTypes...>())
1047 constexpr explicit(!__convertible<_UTypes...>())
1048 tuple(allocator_arg_t __tag,
const _Alloc& __a, _UTypes&&... __u)
1049 :
_Inherited(__tag, __a, std::forward<_UTypes>(__u)...)
1052 template<
typename _Alloc,
typename... _UTypes>
1053 requires (__disambiguating_constraint<_UTypes...>())
1054 && (__constructible<_UTypes...>())
1055 && (__dangles<_UTypes...>())
1056 tuple(allocator_arg_t,
const _Alloc&, _UTypes&&...) =
delete;
1058 template<
typename _Alloc>
1060 tuple(allocator_arg_t __tag,
const _Alloc& __a,
const tuple& __u)
1064 template<
typename _Alloc>
1065 requires (__constructible<_Elements...>())
1067 tuple(allocator_arg_t __tag,
const _Alloc& __a,
tuple&& __u)
1071 template<
typename _Alloc,
typename... _UTypes>
1072 requires (__constructible<
const _UTypes&...>())
1073 && (!__use_other_ctor<
const tuple<_UTypes...>&>())
1074 && (!__dangles<
const _UTypes&...>())
1075 constexpr explicit(!__convertible<
const _UTypes&...>())
1076 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1079 static_cast<const _Tuple_impl<0, _UTypes...
>&>(__u))
1082 template<
typename _Alloc,
typename... _UTypes>
1083 requires (__constructible<
const _UTypes&...>())
1084 && (!__use_other_ctor<
const tuple<_UTypes...>&>())
1085 && (__dangles<
const _UTypes&...>())
1088 template<
typename _Alloc,
typename... _UTypes>
1089 requires (__constructible<_UTypes...>())
1090 && (!__use_other_ctor<
tuple<_UTypes...>>())
1091 && (!__dangles<_UTypes...>())
1092 constexpr explicit(!__use_other_ctor<
tuple<_UTypes...>>())
1097 template<
typename _Alloc,
typename... _UTypes>
1098 requires (__constructible<_UTypes...>())
1099 && (!__use_other_ctor<
tuple<_UTypes...>>())
1100 && (__dangles<_UTypes...>())
1103#if __cpp_lib_ranges_zip
1104 template<
typename _Alloc,
typename... _UTypes>
1105 requires (__constructible<_UTypes&...>())
1106 && (!__use_other_ctor<
tuple<_UTypes...>&>())
1107 && (!__dangles<_UTypes&...>())
1108 constexpr explicit(!__convertible<_UTypes&...>())
1113 template<
typename _Alloc,
typename... _UTypes>
1114 requires (__constructible<_UTypes&...>())
1115 && (!__use_other_ctor<
tuple<_UTypes...>&>())
1116 && (__dangles<_UTypes&...>())
1119 template<
typename _Alloc,
typename... _UTypes>
1120 requires (__constructible<
const _UTypes...>())
1121 && (!__use_other_ctor<
const tuple<_UTypes...>>())
1122 && (!__dangles<
const _UTypes...>())
1123 constexpr explicit(!__convertible<
const _UTypes...>())
1124 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1127 static_cast<const _Tuple_impl<0, _UTypes...
>&&>(__u))
1130 template<
typename _Alloc,
typename... _UTypes>
1131 requires (__constructible<
const _UTypes...>())
1132 && (!__use_other_ctor<
const tuple<_UTypes...>>())
1133 && (__dangles<
const _UTypes...>())
1137 template<
typename _Alloc,
typename _U1,
typename _U2>
1138 requires (
sizeof...(_Elements) == 2)
1139 && (__constructible<const _U1&, const _U2&>())
1140 && (!__dangles<const _U1&, const _U2&>())
1141 constexpr explicit(!__convertible<const _U1&, const _U2&>())
1142 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1144 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
1145 :
_Inherited(__tag, __a, __u.first, __u.second)
1148 template<
typename _Alloc,
typename _U1,
typename _U2>
1149 requires (
sizeof...(_Elements) == 2)
1150 && (__constructible<const _U1&, const _U2&>())
1151 && (__dangles<const _U1&, const _U2&>())
1154 template<
typename _Alloc,
typename _U1,
typename _U2>
1155 requires (
sizeof...(_Elements) == 2)
1156 && (__constructible<_U1, _U2>())
1157 && (!__dangles<_U1, _U2>())
1158 constexpr explicit(!__convertible<_U1, _U2>())
1160 noexcept(__nothrow_constructible<_U1, _U2>())
1164 template<
typename _Alloc,
typename _U1,
typename _U2>
1165 requires (
sizeof...(_Elements) == 2)
1166 && (__constructible<_U1, _U2>())
1167 && (__dangles<_U1, _U2>())
1170#if __cpp_lib_ranges_zip
1171 template<
typename _Alloc,
typename _U1,
typename _U2>
1172 requires (
sizeof...(_Elements) == 2)
1173 && (__constructible<_U1&, _U2&>())
1174 && (!__dangles<_U1&, _U2&>())
1175 constexpr explicit(!__convertible<_U1&, _U2&>())
1177 noexcept(__nothrow_constructible<_U1&, _U2&>())
1178 :
_Inherited(__tag, __a, __u.first, __u.second)
1181 template<
typename _Alloc,
typename _U1,
typename _U2>
1182 requires (
sizeof...(_Elements) == 2)
1183 && (__constructible<_U1&, _U2&>())
1184 && (__dangles<_U1&, _U2&>())
1187 template<
typename _Alloc,
typename _U1,
typename _U2>
1188 requires (
sizeof...(_Elements) == 2)
1189 && (__constructible<const _U1, const _U2>())
1190 && (!__dangles<const _U1, const _U2>())
1191 constexpr explicit(!__convertible<const _U1, const _U2>())
1192 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1194 noexcept(__nothrow_constructible<const _U1, const _U2>())
1198 template<
typename _Alloc,
typename _U1,
typename _U2>
1199 requires (
sizeof...(_Elements) == 2)
1200 && (__constructible<const _U1, const _U2>())
1201 && (__dangles<const _U1, const _U2>())
1205#if 0 && __cpp_lib_tuple_like
1206 template<
typename _Alloc, __tuple_like _UTuple>
1207 constexpr explicit(...)
1208 tuple(allocator_arg_t __tag,
const _Alloc& __a, _UTuple&& __u);
1213 template<
bool _Cond>
1214 using _TCC = _TupleConstraints<_Cond, _Elements...>;
1217 template<
bool _Dummy>
1218 using _ImplicitDefaultCtor = __enable_if_t<
1219 _TCC<_Dummy>::__is_implicitly_default_constructible(),
1223 template<
bool _Dummy>
1224 using _ExplicitDefaultCtor = __enable_if_t<
1225 _TCC<_Dummy>::__is_explicitly_default_constructible(),
1229 template<
bool _Cond,
typename... _Args>
1230 using _ImplicitCtor = __enable_if_t<
1231 _TCC<_Cond>::template __is_implicitly_constructible<_Args...>(),
1235 template<
bool _Cond,
typename... _Args>
1236 using _ExplicitCtor = __enable_if_t<
1237 _TCC<_Cond>::template __is_explicitly_constructible<_Args...>(),
1241 template<
typename... _UElements>
1242 static constexpr bool __nothrow_constructible()
1245 __and_<is_nothrow_constructible<_Elements, _UElements>...>::value;
1249 template<
typename _Up>
1250 static constexpr bool __valid_args()
1252 return sizeof...(_Elements) == 1
1257 template<
typename,
typename,
typename... _Tail>
1258 static constexpr bool __valid_args()
1259 {
return (
sizeof...(_Tail) + 2) ==
sizeof...(_Elements); }
1270 template<
typename _Tuple,
typename =
tuple,
1271 typename = __remove_cvref_t<_Tuple>>
1272 struct _UseOtherCtor
1277 template<
typename _Tuple,
typename _Tp,
typename _Up>
1278 struct _UseOtherCtor<_Tuple,
tuple<_Tp>,
tuple<_Up>>
1279 : __or_<is_convertible<_Tuple, _Tp>, is_constructible<_Tp, _Tuple>>::type
1283 template<
typename _Tuple,
typename _Tp>
1284 struct _UseOtherCtor<_Tuple,
tuple<_Tp>,
tuple<_Tp>>
1291 template<
typename _Tuple>
1292 static constexpr bool __use_other_ctor()
1293 {
return _UseOtherCtor<_Tuple>::value; }
1296#undef __glibcxx_no_dangling_refs
1297#if __has_builtin(__reference_constructs_from_temporary) \
1298 && defined _GLIBCXX_DEBUG
1300# if __cpp_fold_expressions
1301# define __glibcxx_dangling_refs(U) \
1302 (__reference_constructs_from_temporary(_Elements, U) || ...)
1304# define __glibcxx_dangling_refs(U) \
1305 __or_<__bool_constant<__reference_constructs_from_temporary(_Elements, U) \
1308# define __glibcxx_no_dangling_refs(U) \
1309 static_assert(!__glibcxx_dangling_refs(U), \
1310 "std::tuple constructor creates a dangling reference")
1312# define __glibcxx_no_dangling_refs(U)
1317 template<
typename _Dummy = void,
1318 _ImplicitDefaultCtor<is_void<_Dummy>::value> =
true>
1321 noexcept(__and_<is_nothrow_default_constructible<_Elements>...>::value)
1324 template<
typename _Dummy = void,
1325 _ExplicitDefaultCtor<is_void<_Dummy>::value> =
false>
1328 noexcept(__and_<is_nothrow_default_constructible<_Elements>...>::value)
1331 template<
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
1332 _ImplicitCtor<_NotEmpty,
const _Elements&...> =
true>
1334 tuple(
const _Elements&... __elements)
1335 noexcept(__nothrow_constructible<
const _Elements&...>())
1338 template<
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
1339 _ExplicitCtor<_NotEmpty,
const _Elements&...> =
false>
1341 tuple(
const _Elements&... __elements)
1342 noexcept(__nothrow_constructible<
const _Elements&...>())
1345 template<
typename... _UElements,
1346 bool _Valid = __valid_args<_UElements...>(),
1347 _ImplicitCtor<_Valid, _UElements...> =
true>
1349 tuple(_UElements&&... __elements)
1350 noexcept(__nothrow_constructible<_UElements...>())
1351 :
_Inherited(std::forward<_UElements>(__elements)...)
1352 { __glibcxx_no_dangling_refs(_UElements&&); }
1354 template<
typename... _UElements,
1355 bool _Valid = __valid_args<_UElements...>(),
1356 _ExplicitCtor<_Valid, _UElements...> =
false>
1358 tuple(_UElements&&... __elements)
1359 noexcept(__nothrow_constructible<_UElements...>())
1360 :
_Inherited(std::forward<_UElements>(__elements)...)
1361 { __glibcxx_no_dangling_refs(_UElements&&); }
1367 template<
typename... _UElements,
1368 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1370 _ImplicitCtor<_Valid,
const _UElements&...> =
true>
1373 noexcept(__nothrow_constructible<
const _UElements&...>())
1375 { __glibcxx_no_dangling_refs(
const _UElements&); }
1377 template<
typename... _UElements,
1378 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1380 _ExplicitCtor<_Valid,
const _UElements&...> =
false>
1383 noexcept(__nothrow_constructible<
const _UElements&...>())
1385 { __glibcxx_no_dangling_refs(
const _UElements&); }
1387 template<
typename... _UElements,
1388 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1390 _ImplicitCtor<_Valid, _UElements...> =
true>
1393 noexcept(__nothrow_constructible<_UElements...>())
1395 { __glibcxx_no_dangling_refs(_UElements&&); }
1397 template<
typename... _UElements,
1398 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1400 _ExplicitCtor<_Valid, _UElements...> =
false>
1403 noexcept(__nothrow_constructible<_UElements...>())
1405 { __glibcxx_no_dangling_refs(_UElements&&); }
1409 template<
typename _Alloc,
1410 _ImplicitDefaultCtor<is_object<_Alloc>::value> =
true>
1411 _GLIBCXX20_CONSTEXPR
1412 tuple(allocator_arg_t __tag,
const _Alloc& __a)
1415 template<
typename _Alloc,
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
1416 _ImplicitCtor<_NotEmpty,
const _Elements&...> =
true>
1417 _GLIBCXX20_CONSTEXPR
1418 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1419 const _Elements&... __elements)
1422 template<
typename _Alloc,
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
1423 _ExplicitCtor<_NotEmpty,
const _Elements&...> =
false>
1424 _GLIBCXX20_CONSTEXPR
1426 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1427 const _Elements&... __elements)
1430 template<
typename _Alloc,
typename... _UElements,
1431 bool _Valid = __valid_args<_UElements...>(),
1432 _ImplicitCtor<_Valid, _UElements...> =
true>
1433 _GLIBCXX20_CONSTEXPR
1434 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1435 _UElements&&... __elements)
1436 :
_Inherited(__tag, __a, std::forward<_UElements>(__elements)...)
1437 { __glibcxx_no_dangling_refs(_UElements&&); }
1439 template<
typename _Alloc,
typename... _UElements,
1440 bool _Valid = __valid_args<_UElements...>(),
1441 _ExplicitCtor<_Valid, _UElements...> =
false>
1442 _GLIBCXX20_CONSTEXPR
1444 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1445 _UElements&&... __elements)
1446 :
_Inherited(__tag, __a, std::forward<_UElements>(__elements)...)
1447 { __glibcxx_no_dangling_refs(_UElements&&); }
1449 template<
typename _Alloc>
1450 _GLIBCXX20_CONSTEXPR
1451 tuple(allocator_arg_t __tag,
const _Alloc& __a,
const tuple& __in)
1454 template<
typename _Alloc>
1455 _GLIBCXX20_CONSTEXPR
1456 tuple(allocator_arg_t __tag,
const _Alloc& __a,
tuple&& __in)
1459 template<
typename _Alloc,
typename... _UElements,
1460 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1462 _ImplicitCtor<_Valid,
const _UElements&...> =
true>
1463 _GLIBCXX20_CONSTEXPR
1464 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1467 static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
1468 { __glibcxx_no_dangling_refs(
const _UElements&); }
1470 template<
typename _Alloc,
typename... _UElements,
1471 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1473 _ExplicitCtor<_Valid,
const _UElements&...> =
false>
1474 _GLIBCXX20_CONSTEXPR
1476 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1479 static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
1480 { __glibcxx_no_dangling_refs(
const _UElements&); }
1482 template<
typename _Alloc,
typename... _UElements,
1483 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1485 _ImplicitCtor<_Valid, _UElements...> =
true>
1486 _GLIBCXX20_CONSTEXPR
1487 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1490 static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
1491 { __glibcxx_no_dangling_refs(_UElements&&); }
1493 template<
typename _Alloc,
typename... _UElements,
1494 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1496 _ExplicitCtor<_Valid, _UElements...> =
false>
1497 _GLIBCXX20_CONSTEXPR
1499 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1502 static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
1503 { __glibcxx_no_dangling_refs(_UElements&&); }
1508#if __cpp_concepts && __cpp_consteval
1510 template<
typename... _UTypes>
1511 static consteval bool
1514 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
1520 template<
typename... _UTypes>
1521 static consteval bool
1522 __nothrow_assignable()
1524 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
1530#if __cpp_lib_ranges_zip
1531 template<
typename... _UTypes>
1532 static consteval bool
1533 __const_assignable()
1535 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
1547 operator=(
const tuple& __u)
1548 noexcept(__nothrow_assignable<
const _Elements&...>())
1549 requires (__assignable<
const _Elements&...>())
1551 this->_M_assign(__u);
1556 operator=(
tuple&& __u)
1557 noexcept(__nothrow_assignable<_Elements...>())
1558 requires (__assignable<_Elements...>())
1564 template<
typename... _UTypes>
1565 requires (__assignable<
const _UTypes&...>())
1568 noexcept(__nothrow_assignable<
const _UTypes&...>())
1570 this->_M_assign(__u);
1574 template<
typename... _UTypes>
1575 requires (__assignable<_UTypes...>())
1578 noexcept(__nothrow_assignable<_UTypes...>())
1584#if __cpp_lib_ranges_zip
1585 constexpr const tuple&
1586 operator=(
const tuple& __u)
const
1587 requires (__const_assignable<
const _Elements&...>())
1589 this->_M_assign(__u);
1593 constexpr const tuple&
1594 operator=(
tuple&& __u)
const
1595 requires (__const_assignable<_Elements...>())
1601 template<
typename... _UTypes>
1602 constexpr const tuple&
1604 requires (__const_assignable<
const _UTypes&...>())
1606 this->_M_assign(__u);
1610 template<
typename... _UTypes>
1611 constexpr const tuple&
1613 requires (__const_assignable<_UTypes...>())
1620 template<
typename _U1,
typename _U2>
1621 requires (__assignable<const _U1&, const _U2&>())
1624 noexcept(__nothrow_assignable<const _U1&, const _U2&>())
1626 this->_M_head(*
this) = __u.first;
1627 this->_M_tail(*this)._M_head(*
this) = __u.second;
1631 template<
typename _U1,
typename _U2>
1632 requires (__assignable<_U1, _U2>())
1635 noexcept(__nothrow_assignable<_U1, _U2>())
1637 this->_M_head(*
this) = std::forward<_U1>(__u.first);
1638 this->_M_tail(*this)._M_head(*
this) = std::forward<_U2>(__u.second);
1642#if __cpp_lib_ranges_zip
1643 template<
typename _U1,
typename _U2>
1644 requires (__const_assignable<const _U1&, const _U2>())
1645 constexpr const tuple&
1648 this->_M_head(*
this) = __u.first;
1649 this->_M_tail(*this)._M_head(*
this) = __u.second;
1653 template<
typename _U1,
typename _U2>
1654 requires (__const_assignable<_U1, _U2>())
1655 constexpr const tuple&
1658 this->_M_head(*
this) = std::forward<_U1>(__u.first);
1659 this->_M_tail(*this)._M_head(*
this) = std::forward<_U2>(__u.second);
1664#if 0 && __cpp_lib_tuple_like
1665 template<__tuple_like _UTuple>
1667 operator=(_UTuple&& __u);
1669 template<__tuple_like _UTuple>
1671 operator=(_UTuple&& __u)
const;
1677 template<
typename... _UElements>
1679 __enable_if_t<
sizeof...(_UElements) ==
sizeof...(_Elements),
bool>
1681 {
return __and_<is_assignable<_Elements&, _UElements>...>::value; }
1684 template<
typename... _UElements>
1685 static constexpr bool __nothrow_assignable()
1688 __and_<is_nothrow_assignable<_Elements&, _UElements>...>::value;
1693 _GLIBCXX20_CONSTEXPR
1695 operator=(__conditional_t<__assignable<const _Elements&...>(),
1697 const __nonesuch&> __in)
1698 noexcept(__nothrow_assignable<
const _Elements&...>())
1700 this->_M_assign(__in);
1704 _GLIBCXX20_CONSTEXPR
1706 operator=(__conditional_t<__assignable<_Elements...>(),
1709 noexcept(__nothrow_assignable<_Elements...>())
1715 template<
typename... _UElements>
1716 _GLIBCXX20_CONSTEXPR
1717 __enable_if_t<__assignable<
const _UElements&...>(),
tuple&>
1719 noexcept(__nothrow_assignable<
const _UElements&...>())
1721 this->_M_assign(__in);
1725 template<
typename... _UElements>
1726 _GLIBCXX20_CONSTEXPR
1727 __enable_if_t<__assignable<_UElements...>(),
tuple&>
1729 noexcept(__nothrow_assignable<_UElements...>())
1737 _GLIBCXX20_CONSTEXPR
1740 noexcept(__and_<__is_nothrow_swappable<_Elements>...>::value)
1741 { _Inherited::_M_swap(__in); }
1743#if __cpp_lib_ranges_zip
1751 swap(
const tuple& __in)
const
1752 noexcept(__and_v<__is_nothrow_swappable<const _Elements>...>)
1753 requires (is_swappable_v<const _Elements> && ...)
1754 { _Inherited::_M_swap(__in); }
1802 template<
bool _Dummy,
typename _U1,
typename _U2>
1803 using _ImplicitDefaultCtor = __enable_if_t<
1804 _TupleConstraints<_Dummy, _U1, _U2>::
1805 __is_implicitly_default_constructible(),
1809 template<
bool _Dummy,
typename _U1,
typename _U2>
1810 using _ExplicitDefaultCtor = __enable_if_t<
1811 _TupleConstraints<_Dummy, _U1, _U2>::
1812 __is_explicitly_default_constructible(),
1815 template<
bool _Dummy>
1816 using _TCC = _TupleConstraints<_Dummy, _T1, _T2>;
1819 template<
bool _Cond,
typename _U1,
typename _U2>
1820 using _ImplicitCtor = __enable_if_t<
1821 _TCC<_Cond>::template __is_implicitly_constructible<_U1, _U2>(),
1825 template<
bool _Cond,
typename _U1,
typename _U2>
1826 using _ExplicitCtor = __enable_if_t<
1827 _TCC<_Cond>::template __is_explicitly_constructible<_U1, _U2>(),
1830 template<
typename _U1,
typename _U2>
1831 static constexpr bool __assignable()
1833 return __and_<is_assignable<_T1&, _U1>,
1837 template<
typename _U1,
typename _U2>
1838 static constexpr bool __nothrow_assignable()
1840 return __and_<is_nothrow_assignable<_T1&, _U1>,
1844 template<
typename _U1,
typename _U2>
1845 static constexpr bool __nothrow_constructible()
1847 return __and_<is_nothrow_constructible<_T1, _U1>,
1851 static constexpr bool __nothrow_default_constructible()
1853 return __and_<is_nothrow_default_constructible<_T1>,
1857 template<
typename _U1>
1858 static constexpr bool __is_alloc_arg()
1862#undef __glibcxx_no_dangling_refs
1864#if __has_builtin(__reference_constructs_from_temporary) \
1865 && defined _GLIBCXX_DEBUG
1866# define __glibcxx_no_dangling_refs(_U1, _U2) \
1867 static_assert(!__reference_constructs_from_temporary(_T1, _U1) \
1868 && !__reference_constructs_from_temporary(_T2, _U2), \
1869 "std::tuple constructor creates a dangling reference")
1871# define __glibcxx_no_dangling_refs(_U1, _U2)
1876 template<
bool _Dummy =
true,
1877 _ImplicitDefaultCtor<_Dummy, _T1, _T2> =
true>
1880 noexcept(__nothrow_default_constructible())
1883 template<
bool _Dummy =
true,
1884 _ExplicitDefaultCtor<_Dummy, _T1, _T2> =
false>
1887 noexcept(__nothrow_default_constructible())
1890 template<
bool _Dummy =
true,
1891 _ImplicitCtor<_Dummy, const _T1&, const _T2&> =
true>
1893 tuple(
const _T1& __a1,
const _T2& __a2)
1894 noexcept(__nothrow_constructible<const _T1&, const _T2&>())
1897 template<
bool _Dummy =
true,
1898 _ExplicitCtor<_Dummy, const _T1&, const _T2&> =
false>
1900 tuple(
const _T1& __a1,
const _T2& __a2)
1901 noexcept(__nothrow_constructible<const _T1&, const _T2&>())
1904 template<
typename _U1,
typename _U2,
1905 _ImplicitCtor<!__is_alloc_arg<_U1>(), _U1, _U2> =
true>
1907 tuple(_U1&& __a1, _U2&& __a2)
1908 noexcept(__nothrow_constructible<_U1, _U2>())
1909 :
_Inherited(std::forward<_U1>(__a1), std::forward<_U2>(__a2))
1910 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
1912 template<
typename _U1,
typename _U2,
1913 _ExplicitCtor<!__is_alloc_arg<_U1>(), _U1, _U2> =
false>
1915 tuple(_U1&& __a1, _U2&& __a2)
1916 noexcept(__nothrow_constructible<_U1, _U2>())
1917 :
_Inherited(std::forward<_U1>(__a1), std::forward<_U2>(__a2))
1918 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
1924 template<
typename _U1,
typename _U2,
1925 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
1928 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
1930 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
1932 template<
typename _U1,
typename _U2,
1933 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
1936 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
1938 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
1940 template<
typename _U1,
typename _U2,
1941 _ImplicitCtor<true, _U1, _U2> =
true>
1944 noexcept(__nothrow_constructible<_U1, _U2>())
1946 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
1948 template<
typename _U1,
typename _U2,
1949 _ExplicitCtor<true, _U1, _U2> =
false>
1952 noexcept(__nothrow_constructible<_U1, _U2>())
1954 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
1956 template<
typename _U1,
typename _U2,
1957 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
1960 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
1962 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
1964 template<
typename _U1,
typename _U2,
1965 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
1968 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
1970 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
1972 template<
typename _U1,
typename _U2,
1973 _ImplicitCtor<true, _U1, _U2> =
true>
1976 noexcept(__nothrow_constructible<_U1, _U2>())
1978 std::forward<_U2>(__in.second))
1979 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
1981 template<
typename _U1,
typename _U2,
1982 _ExplicitCtor<true, _U1, _U2> =
false>
1985 noexcept(__nothrow_constructible<_U1, _U2>())
1987 std::forward<_U2>(__in.second))
1988 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
1992 template<
typename _Alloc,
1993 _ImplicitDefaultCtor<is_object<_Alloc>::value, _T1, _T2> =
true>
1994 _GLIBCXX20_CONSTEXPR
1995 tuple(allocator_arg_t __tag,
const _Alloc& __a)
1998 template<
typename _Alloc,
bool _Dummy =
true,
1999 _ImplicitCtor<_Dummy, const _T1&, const _T2&> =
true>
2000 _GLIBCXX20_CONSTEXPR
2001 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2002 const _T1& __a1,
const _T2& __a2)
2005 template<
typename _Alloc,
bool _Dummy =
true,
2006 _ExplicitCtor<_Dummy, const _T1&, const _T2&> =
false>
2008 _GLIBCXX20_CONSTEXPR
2009 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2010 const _T1& __a1,
const _T2& __a2)
2013 template<
typename _Alloc,
typename _U1,
typename _U2,
2014 _ImplicitCtor<true, _U1, _U2> =
true>
2015 _GLIBCXX20_CONSTEXPR
2016 tuple(allocator_arg_t __tag,
const _Alloc& __a, _U1&& __a1, _U2&& __a2)
2017 :
_Inherited(__tag, __a, std::forward<_U1>(__a1),
2018 std::forward<_U2>(__a2))
2019 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2021 template<
typename _Alloc,
typename _U1,
typename _U2,
2022 _ExplicitCtor<true, _U1, _U2> =
false>
2024 _GLIBCXX20_CONSTEXPR
2025 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2026 _U1&& __a1, _U2&& __a2)
2027 :
_Inherited(__tag, __a, std::forward<_U1>(__a1),
2028 std::forward<_U2>(__a2))
2029 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2031 template<
typename _Alloc>
2032 _GLIBCXX20_CONSTEXPR
2033 tuple(allocator_arg_t __tag,
const _Alloc& __a,
const tuple& __in)
2036 template<
typename _Alloc>
2037 _GLIBCXX20_CONSTEXPR
2038 tuple(allocator_arg_t __tag,
const _Alloc& __a,
tuple&& __in)
2041 template<
typename _Alloc,
typename _U1,
typename _U2,
2042 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
2043 _GLIBCXX20_CONSTEXPR
2044 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2048 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2050 template<
typename _Alloc,
typename _U1,
typename _U2,
2051 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
2053 _GLIBCXX20_CONSTEXPR
2054 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2058 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2060 template<
typename _Alloc,
typename _U1,
typename _U2,
2061 _ImplicitCtor<true, _U1, _U2> =
true>
2062 _GLIBCXX20_CONSTEXPR
2065 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2067 template<
typename _Alloc,
typename _U1,
typename _U2,
2068 _ExplicitCtor<true, _U1, _U2> =
false>
2070 _GLIBCXX20_CONSTEXPR
2073 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2075 template<
typename _Alloc,
typename _U1,
typename _U2,
2076 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
2077 _GLIBCXX20_CONSTEXPR
2078 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2080 :
_Inherited(__tag, __a, __in.first, __in.second)
2081 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2083 template<
typename _Alloc,
typename _U1,
typename _U2,
2084 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
2086 _GLIBCXX20_CONSTEXPR
2087 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2089 :
_Inherited(__tag, __a, __in.first, __in.second)
2090 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2092 template<
typename _Alloc,
typename _U1,
typename _U2,
2093 _ImplicitCtor<true, _U1, _U2> =
true>
2094 _GLIBCXX20_CONSTEXPR
2096 :
_Inherited(__tag, __a, std::forward<_U1>(__in.first),
2097 std::forward<_U2>(__in.second))
2098 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2100 template<
typename _Alloc,
typename _U1,
typename _U2,
2101 _ExplicitCtor<true, _U1, _U2> =
false>
2103 _GLIBCXX20_CONSTEXPR
2105 :
_Inherited(__tag, __a, std::forward<_U1>(__in.first),
2106 std::forward<_U2>(__in.second))
2107 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2111 _GLIBCXX20_CONSTEXPR
2113 operator=(__conditional_t<__assignable<const _T1&, const _T2&>(),
2115 const __nonesuch&> __in)
2116 noexcept(__nothrow_assignable<const _T1&, const _T2&>())
2118 this->_M_assign(__in);
2122 _GLIBCXX20_CONSTEXPR
2124 operator=(__conditional_t<__assignable<_T1, _T2>(),
2127 noexcept(__nothrow_assignable<_T1, _T2>())
2133 template<
typename _U1,
typename _U2>
2134 _GLIBCXX20_CONSTEXPR
2135 __enable_if_t<__assignable<const _U1&, const _U2&>(),
tuple&>
2137 noexcept(__nothrow_assignable<const _U1&, const _U2&>())
2139 this->_M_assign(__in);
2143 template<
typename _U1,
typename _U2>
2144 _GLIBCXX20_CONSTEXPR
2145 __enable_if_t<__assignable<_U1, _U2>(),
tuple&>
2147 noexcept(__nothrow_assignable<_U1, _U2>())
2153 template<
typename _U1,
typename _U2>
2154 _GLIBCXX20_CONSTEXPR
2155 __enable_if_t<__assignable<const _U1&, const _U2&>(),
tuple&>
2157 noexcept(__nothrow_assignable<const _U1&, const _U2&>())
2159 this->_M_head(*
this) = __in.first;
2160 this->_M_tail(*this)._M_head(*
this) = __in.second;
2164 template<
typename _U1,
typename _U2>
2165 _GLIBCXX20_CONSTEXPR
2166 __enable_if_t<__assignable<_U1, _U2>(),
tuple&>
2168 noexcept(__nothrow_assignable<_U1, _U2>())
2170 this->_M_head(*
this) = std::forward<_U1>(__in.first);
2171 this->_M_tail(*this)._M_head(*
this) = std::forward<_U2>(__in.second);
2175 _GLIBCXX20_CONSTEXPR
2178 noexcept(__and_<__is_nothrow_swappable<_T1>,
2179 __is_nothrow_swappable<_T2>>::value)
2180 { _Inherited::_M_swap(__in); }