833 class tuple :
public _Tuple_impl<0, _Elements...>
835 using _Inherited = _Tuple_impl<0, _Elements...>;
837#if __cpp_concepts && __cpp_consteval && __cpp_conditional_explicit
838 template<
typename... _UTypes>
839 static consteval bool
842 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
848 template<
typename... _UTypes>
849 static consteval bool
850 __nothrow_constructible()
852 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
858 template<
typename... _UTypes>
859 static consteval bool
862 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
863 return __and_v<is_convertible<_UTypes, _Elements>...>;
870 template<
typename... _UTypes>
871 static consteval bool
872 __disambiguating_constraint()
874 if constexpr (
sizeof...(_Elements) !=
sizeof...(_UTypes))
876 else if constexpr (
sizeof...(_Elements) == 1)
878 using _U0 =
typename _Nth_type<0, _UTypes...>::type;
879 return !is_same_v<remove_cvref_t<_U0>, tuple>;
881 else if constexpr (
sizeof...(_Elements) < 4)
883 using _U0 =
typename _Nth_type<0, _UTypes...>::type;
884 if constexpr (!is_same_v<remove_cvref_t<_U0>, allocator_arg_t>)
888 using _T0 =
typename _Nth_type<0, _Elements...>::type;
889 return is_same_v<remove_cvref_t<_T0>, allocator_arg_t>;
898 template<
typename _Tuple>
899 static consteval bool
902 if constexpr (
sizeof...(_Elements) != 1)
904 else if constexpr (is_same_v<remove_cvref_t<_Tuple>, tuple>)
908 using _Tp =
typename _Nth_type<0, _Elements...>::type;
909 if constexpr (is_convertible_v<_Tuple, _Tp>)
911 else if constexpr (is_constructible_v<_Tp, _Tuple>)
917 template<
typename... _Up>
918 static consteval bool
921#if __has_builtin(__reference_constructs_from_temporary)
922 return (__reference_constructs_from_temporary(_Elements, _Up&&)
929#if __cpp_lib_tuple_like
932 template<
typename _UTuple>
933 static consteval bool
934 __dangles_from_tuple_like()
941 template<
typename _UTuple>
942 static consteval bool
943 __constructible_from_tuple_like()
950 template<
typename _UTuple>
951 static consteval bool
952 __convertible_from_tuple_like()
962 explicit(!(__is_implicitly_default_constructible_v<_Elements> && ...))
964 noexcept((is_nothrow_default_constructible_v<_Elements> && ...))
965 requires (is_default_constructible_v<_Elements> && ...)
970 template<
typename =
void>
971 constexpr explicit(!__convertible<
const _Elements&...>())
972 tuple(
const type_identity_t<_Elements>&... __elements)
973 noexcept(__nothrow_constructible<
const _Elements&...>())
974 requires (__constructible<const _Elements&...>())
975 : _Inherited(__elements...)
978 template<
typename... _UTypes>
979 requires (__disambiguating_constraint<_UTypes...>())
980 && (__constructible<_UTypes...>())
981 && (!__dangles<_UTypes...>())
982 constexpr explicit(!__convertible<_UTypes...>())
983 tuple(_UTypes&&... __u)
984 noexcept(__nothrow_constructible<_UTypes...>())
988 template<
typename... _UTypes>
989 requires (__disambiguating_constraint<_UTypes...>())
990 && (__constructible<_UTypes...>())
991 && (__dangles<_UTypes...>())
992 tuple(_UTypes&&...) =
delete;
994 constexpr tuple(
const tuple&) =
default;
997 tuple(tuple&&)
requires (is_move_constructible_v<_Elements> && ...)
1000 template<
typename... _UTypes>
1001 requires (__constructible<
const _UTypes&...>())
1002 && (!__use_other_ctor<
const tuple<_UTypes...>&>())
1003 && (!__dangles<
const _UTypes&...>())
1004 constexpr explicit(!__convertible<const _UTypes&...>())
1005 tuple(
const tuple<_UTypes...>& __u)
1006 noexcept(__nothrow_constructible<
const _UTypes&...>())
1007 : _Inherited(
static_cast<const _Tuple_impl<0, _UTypes...
>&>(__u))
1010 template<
typename... _UTypes>
1011 requires (__constructible<
const _UTypes&...>())
1012 && (!__use_other_ctor<
const tuple<_UTypes...>&>())
1013 && (__dangles<
const _UTypes&...>())
1014 tuple(
const tuple<_UTypes...>&) =
delete;
1016 template<
typename... _UTypes>
1017 requires (__constructible<_UTypes...>())
1018 && (!__use_other_ctor<tuple<_UTypes...>>())
1019 && (!__dangles<_UTypes...>())
1020 constexpr explicit(!__convertible<_UTypes...>())
1021 tuple(tuple<_UTypes...>&& __u)
1022 noexcept(__nothrow_constructible<_UTypes...>())
1023 : _Inherited(
static_cast<_Tuple_impl<0, _UTypes...
>&&>(__u))
1026 template<
typename... _UTypes>
1027 requires (__constructible<_UTypes...>())
1028 && (!__use_other_ctor<tuple<_UTypes...>>())
1029 && (__dangles<_UTypes...>())
1030 tuple(tuple<_UTypes...>&&) =
delete;
1032#if __cpp_lib_ranges_zip
1033 template<
typename... _UTypes>
1034 requires (__constructible<_UTypes&...>())
1035 && (!__use_other_ctor<tuple<_UTypes...>&>())
1036 && (!__dangles<_UTypes&...>())
1037 constexpr explicit(!__convertible<_UTypes&...>())
1038 tuple(tuple<_UTypes...>& __u)
1039 noexcept(__nothrow_constructible<_UTypes&...>())
1040 : _Inherited(
static_cast<_Tuple_impl<0, _UTypes...
>&>(__u))
1043 template<
typename... _UTypes>
1044 requires (__constructible<_UTypes&...>())
1045 && (!__use_other_ctor<tuple<_UTypes...>&>())
1046 && (__dangles<_UTypes&...>())
1047 tuple(tuple<_UTypes...>&) =
delete;
1049 template<
typename... _UTypes>
1050 requires (__constructible<
const _UTypes...>())
1051 && (!__use_other_ctor<
const tuple<_UTypes...>>())
1052 && (!__dangles<
const _UTypes...>())
1053 constexpr explicit(!__convertible<const _UTypes...>())
1054 tuple(
const tuple<_UTypes...>&& __u)
1055 noexcept(__nothrow_constructible<
const _UTypes...>())
1056 : _Inherited(
static_cast<const _Tuple_impl<0, _UTypes...
>&&>(__u))
1059 template<
typename... _UTypes>
1060 requires (__constructible<
const _UTypes...>())
1061 && (!__use_other_ctor<
const tuple<_UTypes...>>())
1062 && (__dangles<
const _UTypes...>())
1063 tuple(
const tuple<_UTypes...>&&) =
delete;
1066 template<
typename _U1,
typename _U2>
1067 requires (
sizeof...(_Elements) == 2)
1068 && (__constructible<const _U1&, const _U2&>())
1069 && (!__dangles<const _U1&, const _U2&>())
1070 constexpr explicit(!__convertible<const _U1&, const _U2&>())
1072 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
1073 : _Inherited(__u.first, __u.second)
1076 template<
typename _U1,
typename _U2>
1077 requires (
sizeof...(_Elements) == 2)
1078 && (__constructible<const _U1&, const _U2&>())
1079 && (__dangles<const _U1&, const _U2&>())
1082 template<
typename _U1,
typename _U2>
1083 requires (
sizeof...(_Elements) == 2)
1084 && (__constructible<_U1, _U2>())
1085 && (!__dangles<_U1, _U2>())
1086 constexpr explicit(!__convertible<_U1, _U2>())
1088 noexcept(__nothrow_constructible<_U1, _U2>())
1093 template<
typename _U1,
typename _U2>
1094 requires (
sizeof...(_Elements) == 2)
1095 && (__constructible<_U1, _U2>())
1096 && (__dangles<_U1, _U2>())
1099#if __cpp_lib_ranges_zip
1100 template<
typename _U1,
typename _U2>
1101 requires (
sizeof...(_Elements) == 2)
1102 && (__constructible<_U1&, _U2&>())
1103 && (!__dangles<_U1&, _U2&>())
1104 constexpr explicit(!__convertible<_U1&, _U2&>())
1106 noexcept(__nothrow_constructible<_U1&, _U2&>())
1107 : _Inherited(__u.first, __u.second)
1110 template<
typename _U1,
typename _U2>
1111 requires (
sizeof...(_Elements) == 2)
1112 && (__constructible<_U1&, _U2&>())
1113 && (__dangles<_U1&, _U2&>())
1116 template<
typename _U1,
typename _U2>
1117 requires (
sizeof...(_Elements) == 2)
1118 && (__constructible<const _U1, const _U2>())
1119 && (!__dangles<const _U1, const _U2>())
1120 constexpr explicit(!__convertible<const _U1, const _U2>())
1122 noexcept(__nothrow_constructible<const _U1, const _U2>())
1127 template<
typename _U1,
typename _U2>
1128 requires (
sizeof...(_Elements) == 2)
1129 && (__constructible<const _U1, const _U2>())
1130 && (__dangles<const _U1, const _U2>())
1134#if __cpp_lib_tuple_like
1135 template<__eligible_tuple_like<tuple> _UTuple>
1136 requires (__constructible_from_tuple_like<_UTuple>())
1137 && (!__use_other_ctor<_UTuple>())
1138 && (!__dangles_from_tuple_like<_UTuple>())
1139 constexpr explicit(!__convertible_from_tuple_like<_UTuple>())
1140 tuple(_UTuple&& __u)
1141 : _Inherited(__tuple_like_tag_t{},
1146 template<__eligible_tuple_like<tuple> _UTuple>
1147 requires (__constructible_from_tuple_like<_UTuple>())
1148 && (!__use_other_ctor<_UTuple>())
1149 && (__dangles_from_tuple_like<_UTuple>())
1150 tuple(_UTuple&&) =
delete;
1155 template<
typename _Alloc>
1157 explicit(!(__is_implicitly_default_constructible_v<_Elements> && ...))
1158 tuple(allocator_arg_t __tag,
const _Alloc& __a)
1159 requires (is_default_constructible_v<_Elements> && ...)
1160 : _Inherited(__tag, __a)
1163 template<
typename _Alloc>
1164 constexpr explicit(!__convertible<
const _Elements&...>())
1165 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1166 const type_identity_t<_Elements>&... __elements)
1167 requires (__constructible<
const _Elements&...>())
1168 : _Inherited(__tag, __a, __elements...)
1171 template<
typename _Alloc,
typename... _UTypes>
1172 requires (__disambiguating_constraint<_UTypes...>())
1173 && (__constructible<_UTypes...>())
1174 && (!__dangles<_UTypes...>())
1175 constexpr explicit(!__convertible<_UTypes...>())
1176 tuple(allocator_arg_t __tag,
const _Alloc& __a, _UTypes&&... __u)
1180 template<
typename _Alloc,
typename... _UTypes>
1181 requires (__disambiguating_constraint<_UTypes...>())
1182 && (__constructible<_UTypes...>())
1183 && (__dangles<_UTypes...>())
1184 tuple(allocator_arg_t,
const _Alloc&, _UTypes&&...) =
delete;
1186 template<
typename _Alloc>
1188 tuple(allocator_arg_t __tag,
const _Alloc& __a,
const tuple& __u)
1189 : _Inherited(__tag, __a,
static_cast<const _Inherited&
>(__u))
1192 template<
typename _Alloc>
1193 requires (__constructible<_Elements...>())
1195 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple&& __u)
1196 : _Inherited(__tag, __a,
static_cast<_Inherited&&
>(__u))
1199 template<
typename _Alloc,
typename... _UTypes>
1200 requires (__constructible<
const _UTypes&...>())
1201 && (!__use_other_ctor<
const tuple<_UTypes...>&>())
1202 && (!__dangles<
const _UTypes&...>())
1203 constexpr explicit(!__convertible<const _UTypes&...>())
1204 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1205 const tuple<_UTypes...>& __u)
1206 : _Inherited(__tag, __a,
1207 static_cast<const _Tuple_impl<0, _UTypes...
>&>(__u))
1210 template<
typename _Alloc,
typename... _UTypes>
1211 requires (__constructible<
const _UTypes&...>())
1212 && (!__use_other_ctor<
const tuple<_UTypes...>&>())
1213 && (__dangles<
const _UTypes&...>())
1214 tuple(allocator_arg_t,
const _Alloc&,
const tuple<_UTypes...>&) =
delete;
1216 template<
typename _Alloc,
typename... _UTypes>
1217 requires (__constructible<_UTypes...>())
1218 && (!__use_other_ctor<tuple<_UTypes...>>())
1219 && (!__dangles<_UTypes...>())
1220 constexpr explicit(!__use_other_ctor<tuple<_UTypes...>>())
1221 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple<_UTypes...>&& __u)
1222 : _Inherited(__tag, __a,
static_cast<_Tuple_impl<0, _UTypes...
>&&>(__u))
1225 template<
typename _Alloc,
typename... _UTypes>
1226 requires (__constructible<_UTypes...>())
1227 && (!__use_other_ctor<tuple<_UTypes...>>())
1228 && (__dangles<_UTypes...>())
1229 tuple(allocator_arg_t,
const _Alloc&, tuple<_UTypes...>&&) =
delete;
1231#if __cpp_lib_ranges_zip
1232 template<
typename _Alloc,
typename... _UTypes>
1233 requires (__constructible<_UTypes&...>())
1234 && (!__use_other_ctor<tuple<_UTypes...>&>())
1235 && (!__dangles<_UTypes&...>())
1236 constexpr explicit(!__convertible<_UTypes&...>())
1237 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple<_UTypes...>& __u)
1238 : _Inherited(__tag, __a,
static_cast<_Tuple_impl<0, _UTypes...
>&>(__u))
1241 template<
typename _Alloc,
typename... _UTypes>
1242 requires (__constructible<_UTypes&...>())
1243 && (!__use_other_ctor<tuple<_UTypes...>&>())
1244 && (__dangles<_UTypes&...>())
1245 tuple(allocator_arg_t,
const _Alloc&, tuple<_UTypes...>&) =
delete;
1247 template<
typename _Alloc,
typename... _UTypes>
1248 requires (__constructible<
const _UTypes...>())
1249 && (!__use_other_ctor<
const tuple<_UTypes...>>())
1250 && (!__dangles<
const _UTypes...>())
1251 constexpr explicit(!__convertible<const _UTypes...>())
1252 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1253 const tuple<_UTypes...>&& __u)
1254 : _Inherited(__tag, __a,
1255 static_cast<const _Tuple_impl<0, _UTypes...
>&&>(__u))
1258 template<
typename _Alloc,
typename... _UTypes>
1259 requires (__constructible<
const _UTypes...>())
1260 && (!__use_other_ctor<
const tuple<_UTypes...>>())
1261 && (__dangles<
const _UTypes...>())
1262 tuple(allocator_arg_t,
const _Alloc&,
const tuple<_UTypes...>&&) =
delete;
1265 template<
typename _Alloc,
typename _U1,
typename _U2>
1266 requires (
sizeof...(_Elements) == 2)
1267 && (__constructible<const _U1&, const _U2&>())
1268 && (!__dangles<const _U1&, const _U2&>())
1269 constexpr explicit(!__convertible<const _U1&, const _U2&>())
1270 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1272 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
1273 : _Inherited(__tag, __a, __u.first, __u.second)
1276 template<
typename _Alloc,
typename _U1,
typename _U2>
1277 requires (
sizeof...(_Elements) == 2)
1278 && (__constructible<const _U1&, const _U2&>())
1279 && (__dangles<const _U1&, const _U2&>())
1280 tuple(allocator_arg_t,
const _Alloc&,
const pair<_U1, _U2>&) =
delete;
1282 template<
typename _Alloc,
typename _U1,
typename _U2>
1283 requires (
sizeof...(_Elements) == 2)
1284 && (__constructible<_U1, _U2>())
1285 && (!__dangles<_U1, _U2>())
1286 constexpr explicit(!__convertible<_U1, _U2>())
1287 tuple(allocator_arg_t __tag,
const _Alloc& __a,
pair<_U1, _U2>&& __u)
1288 noexcept(__nothrow_constructible<_U1, _U2>())
1292 template<
typename _Alloc,
typename _U1,
typename _U2>
1293 requires (
sizeof...(_Elements) == 2)
1294 && (__constructible<_U1, _U2>())
1295 && (__dangles<_U1, _U2>())
1296 tuple(allocator_arg_t,
const _Alloc&,
pair<_U1, _U2>&&) =
delete;
1298#if __cpp_lib_ranges_zip
1299 template<
typename _Alloc,
typename _U1,
typename _U2>
1300 requires (
sizeof...(_Elements) == 2)
1301 && (__constructible<_U1&, _U2&>())
1302 && (!__dangles<_U1&, _U2&>())
1303 constexpr explicit(!__convertible<_U1&, _U2&>())
1304 tuple(allocator_arg_t __tag,
const _Alloc& __a,
pair<_U1, _U2>& __u)
1305 noexcept(__nothrow_constructible<_U1&, _U2&>())
1306 : _Inherited(__tag, __a, __u.first, __u.second)
1309 template<
typename _Alloc,
typename _U1,
typename _U2>
1310 requires (
sizeof...(_Elements) == 2)
1311 && (__constructible<_U1&, _U2&>())
1312 && (__dangles<_U1&, _U2&>())
1315 template<
typename _Alloc,
typename _U1,
typename _U2>
1316 requires (
sizeof...(_Elements) == 2)
1317 && (__constructible<const _U1, const _U2>())
1318 && (!__dangles<const _U1, const _U2>())
1319 constexpr explicit(!__convertible<const _U1, const _U2>())
1320 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1322 noexcept(__nothrow_constructible<const _U1, const _U2>())
1326 template<
typename _Alloc,
typename _U1,
typename _U2>
1327 requires (
sizeof...(_Elements) == 2)
1328 && (__constructible<const _U1, const _U2>())
1329 && (__dangles<const _U1, const _U2>())
1330 tuple(allocator_arg_t,
const _Alloc&,
const pair<_U1, _U2>&&) =
delete;
1333#if __cpp_lib_tuple_like
1334 template<
typename _Alloc, __eligible_tuple_like<tuple> _UTuple>
1335 requires (__constructible_from_tuple_like<_UTuple>())
1336 && (!__use_other_ctor<_UTuple>())
1337 && (!__dangles_from_tuple_like<_UTuple>())
1338 constexpr explicit(!__convertible_from_tuple_like<_UTuple>())
1339 tuple(allocator_arg_t __tag,
const _Alloc& __a, _UTuple&& __u)
1340 : _Inherited(__tuple_like_tag_t{},
1345 template<
typename _Alloc, __eligible_tuple_like<tuple> _UTuple>
1346 requires (__constructible_from_tuple_like<_UTuple>())
1347 && (!__use_other_ctor<_UTuple>())
1348 && (__dangles_from_tuple_like<_UTuple>())
1349 tuple(allocator_arg_t,
const _Alloc&, _UTuple&&) =
delete;
1354 template<
bool _Cond>
1355 using _TCC = _TupleConstraints<_Cond, _Elements...>;
1358 template<
bool _Dummy>
1359 using _ImplicitDefaultCtor = __enable_if_t<
1360 _TCC<_Dummy>::__is_implicitly_default_constructible(),
1364 template<
bool _Dummy>
1365 using _ExplicitDefaultCtor = __enable_if_t<
1366 _TCC<_Dummy>::__is_explicitly_default_constructible(),
1370 template<
bool _Cond,
typename... _Args>
1371 using _ImplicitCtor = __enable_if_t<
1372 _TCC<_Cond>::template __is_implicitly_constructible<_Args...>(),
1376 template<
bool _Cond,
typename... _Args>
1377 using _ExplicitCtor = __enable_if_t<
1378 _TCC<_Cond>::template __is_explicitly_constructible<_Args...>(),
1382 template<
typename... _UElements>
1383 static constexpr bool __nothrow_constructible()
1386 __and_<is_nothrow_constructible<_Elements, _UElements>...>::value;
1390 template<
typename _Up>
1391 static constexpr bool __valid_args()
1393 return sizeof...(_Elements) == 1
1394 && !
is_same<tuple, __remove_cvref_t<_Up>>::value;
1398 template<
typename,
typename,
typename... _Tail>
1399 static constexpr bool __valid_args()
1400 {
return (
sizeof...(_Tail) + 2) ==
sizeof...(_Elements); }
1411 template<
typename _Tuple,
typename = tuple,
1412 typename = __remove_cvref_t<_Tuple>>
1413 struct _UseOtherCtor
1418 template<
typename _Tuple,
typename _Tp,
typename _Up>
1419 struct _UseOtherCtor<_Tuple, tuple<_Tp>, tuple<_Up>>
1420 : __or_<is_convertible<_Tuple, _Tp>, is_constructible<_Tp, _Tuple>>::type
1424 template<
typename _Tuple,
typename _Tp>
1425 struct _UseOtherCtor<_Tuple, tuple<_Tp>, tuple<_Tp>>
1432 template<
typename _Tuple>
1433 static constexpr bool __use_other_ctor()
1434 {
return _UseOtherCtor<_Tuple>::value; }
1437#undef __glibcxx_no_dangling_refs
1438#if __has_builtin(__reference_constructs_from_temporary) \
1439 && defined _GLIBCXX_DEBUG
1441# if __cpp_fold_expressions
1442# define __glibcxx_dangling_refs(U) \
1443 (__reference_constructs_from_temporary(_Elements, U) || ...)
1445# define __glibcxx_dangling_refs(U) \
1446 __or_<__bool_constant<__reference_constructs_from_temporary(_Elements, U) \
1449# define __glibcxx_no_dangling_refs(U) \
1450 static_assert(!__glibcxx_dangling_refs(U), \
1451 "std::tuple constructor creates a dangling reference")
1453# define __glibcxx_no_dangling_refs(U)
1458 template<
typename _Dummy = void,
1459 _ImplicitDefaultCtor<is_void<_Dummy>::value> =
true>
1462 noexcept(__and_<is_nothrow_default_constructible<_Elements>...>::value)
1465 template<
typename _Dummy = void,
1466 _ExplicitDefaultCtor<is_void<_Dummy>::value> =
false>
1469 noexcept(__and_<is_nothrow_default_constructible<_Elements>...>::value)
1472 template<
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
1473 _ImplicitCtor<_NotEmpty, const _Elements&...> =
true>
1475 tuple(
const __type_identity_t<_Elements>&... __elements)
1476 noexcept(__nothrow_constructible<
const _Elements&...>())
1477 : _Inherited(__elements...) { }
1479 template<
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
1480 _ExplicitCtor<_NotEmpty, const _Elements&...> =
false>
1482 tuple(
const __type_identity_t<_Elements>&... __elements)
1483 noexcept(__nothrow_constructible<
const _Elements&...>())
1484 : _Inherited(__elements...) { }
1486 template<
typename... _UElements,
1487 bool _Valid = __valid_args<_UElements...>(),
1488 _ImplicitCtor<_Valid, _UElements...> =
true>
1490 tuple(_UElements&&... __elements)
1491 noexcept(__nothrow_constructible<_UElements...>())
1493 { __glibcxx_no_dangling_refs(_UElements&&); }
1495 template<
typename... _UElements,
1496 bool _Valid = __valid_args<_UElements...>(),
1497 _ExplicitCtor<_Valid, _UElements...> =
false>
1499 tuple(_UElements&&... __elements)
1500 noexcept(__nothrow_constructible<_UElements...>())
1502 { __glibcxx_no_dangling_refs(_UElements&&); }
1504 constexpr tuple(
const tuple&) =
default;
1506 constexpr tuple(tuple&&) =
default;
1508 template<
typename... _UElements,
1509 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1510 && !__use_other_ctor<
const tuple<_UElements...>&>(),
1511 _ImplicitCtor<_Valid,
const _UElements&...> =
true>
1513 tuple(
const tuple<_UElements...>& __in)
1514 noexcept(__nothrow_constructible<
const _UElements&...>())
1515 : _Inherited(
static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
1516 { __glibcxx_no_dangling_refs(
const _UElements&); }
1518 template<
typename... _UElements,
1519 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1520 && !__use_other_ctor<
const tuple<_UElements...>&>(),
1521 _ExplicitCtor<_Valid,
const _UElements&...> =
false>
1523 tuple(
const tuple<_UElements...>& __in)
1524 noexcept(__nothrow_constructible<
const _UElements&...>())
1525 : _Inherited(
static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
1526 { __glibcxx_no_dangling_refs(
const _UElements&); }
1528 template<
typename... _UElements,
1529 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1530 && !__use_other_ctor<tuple<_UElements...>&&>(),
1531 _ImplicitCtor<_Valid, _UElements...> =
true>
1533 tuple(tuple<_UElements...>&& __in)
1534 noexcept(__nothrow_constructible<_UElements...>())
1535 : _Inherited(
static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
1536 { __glibcxx_no_dangling_refs(_UElements&&); }
1538 template<
typename... _UElements,
1539 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1540 && !__use_other_ctor<tuple<_UElements...>&&>(),
1541 _ExplicitCtor<_Valid, _UElements...> =
false>
1543 tuple(tuple<_UElements...>&& __in)
1544 noexcept(__nothrow_constructible<_UElements...>())
1545 : _Inherited(
static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
1546 { __glibcxx_no_dangling_refs(_UElements&&); }
1550 template<
typename _Alloc,
1551 _ImplicitDefaultCtor<is_object<_Alloc>::value> =
true>
1552 _GLIBCXX20_CONSTEXPR
1553 tuple(allocator_arg_t __tag,
const _Alloc& __a)
1554 : _Inherited(__tag, __a) { }
1556 template<
typename _Alloc,
1557 _ExplicitDefaultCtor<is_object<_Alloc>::value> =
false>
1558 _GLIBCXX20_CONSTEXPR
1560 tuple(allocator_arg_t __tag,
const _Alloc& __a)
1561 : _Inherited(__tag, __a) { }
1563 template<
typename _Alloc,
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
1564 _ImplicitCtor<_NotEmpty, const _Elements&...> =
true>
1565 _GLIBCXX20_CONSTEXPR
1566 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1567 const __type_identity_t<_Elements>&... __elements)
1568 : _Inherited(__tag, __a, __elements...) { }
1570 template<
typename _Alloc,
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
1571 _ExplicitCtor<_NotEmpty, const _Elements&...> =
false>
1572 _GLIBCXX20_CONSTEXPR
1574 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1575 const __type_identity_t<_Elements>&... __elements)
1576 : _Inherited(__tag, __a, __elements...) { }
1578 template<
typename _Alloc,
typename... _UElements,
1579 bool _Valid = __valid_args<_UElements...>(),
1580 _ImplicitCtor<_Valid, _UElements...> =
true>
1581 _GLIBCXX20_CONSTEXPR
1582 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1583 _UElements&&... __elements)
1585 { __glibcxx_no_dangling_refs(_UElements&&); }
1587 template<
typename _Alloc,
typename... _UElements,
1588 bool _Valid = __valid_args<_UElements...>(),
1589 _ExplicitCtor<_Valid, _UElements...> =
false>
1590 _GLIBCXX20_CONSTEXPR
1592 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1593 _UElements&&... __elements)
1595 { __glibcxx_no_dangling_refs(_UElements&&); }
1597 template<
typename _Alloc>
1598 _GLIBCXX20_CONSTEXPR
1599 tuple(allocator_arg_t __tag,
const _Alloc& __a,
const tuple& __in)
1600 : _Inherited(__tag, __a,
static_cast<const _Inherited&
>(__in)) { }
1602 template<
typename _Alloc>
1603 _GLIBCXX20_CONSTEXPR
1604 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple&& __in)
1605 : _Inherited(__tag, __a,
static_cast<_Inherited&&
>(__in)) { }
1607 template<
typename _Alloc,
typename... _UElements,
1608 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1609 && !__use_other_ctor<
const tuple<_UElements...>&>(),
1610 _ImplicitCtor<_Valid,
const _UElements&...> =
true>
1611 _GLIBCXX20_CONSTEXPR
1612 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1613 const tuple<_UElements...>& __in)
1614 : _Inherited(__tag, __a,
1615 static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
1616 { __glibcxx_no_dangling_refs(
const _UElements&); }
1618 template<
typename _Alloc,
typename... _UElements,
1619 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1620 && !__use_other_ctor<
const tuple<_UElements...>&>(),
1621 _ExplicitCtor<_Valid,
const _UElements&...> =
false>
1622 _GLIBCXX20_CONSTEXPR
1624 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1625 const tuple<_UElements...>& __in)
1626 : _Inherited(__tag, __a,
1627 static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
1628 { __glibcxx_no_dangling_refs(
const _UElements&); }
1630 template<
typename _Alloc,
typename... _UElements,
1631 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1632 && !__use_other_ctor<tuple<_UElements...>&&>(),
1633 _ImplicitCtor<_Valid, _UElements...> =
true>
1634 _GLIBCXX20_CONSTEXPR
1635 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1636 tuple<_UElements...>&& __in)
1637 : _Inherited(__tag, __a,
1638 static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
1639 { __glibcxx_no_dangling_refs(_UElements&&); }
1641 template<
typename _Alloc,
typename... _UElements,
1642 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1643 && !__use_other_ctor<tuple<_UElements...>&&>(),
1644 _ExplicitCtor<_Valid, _UElements...> =
false>
1645 _GLIBCXX20_CONSTEXPR
1647 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1648 tuple<_UElements...>&& __in)
1649 : _Inherited(__tag, __a,
1650 static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
1651 { __glibcxx_no_dangling_refs(_UElements&&); }
1656#if __cpp_concepts && __cpp_consteval
1658 template<
typename... _UTypes>
1659 static consteval bool
1662 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
1668 template<
typename... _UTypes>
1669 static consteval bool
1670 __nothrow_assignable()
1672 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
1678#if __cpp_lib_ranges_zip
1679 template<
typename... _UTypes>
1680 static consteval bool
1681 __const_assignable()
1683 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
1690#if __cpp_lib_tuple_like
1691 template<
typename _UTuple>
1692 static consteval bool
1693 __assignable_from_tuple_like()
1700 template<
typename _UTuple>
1701 static consteval bool
1702 __const_assignable_from_tuple_like()
1712 tuple& operator=(
const tuple& __u) =
delete;
1715 operator=(
const tuple& __u)
1716 noexcept(__nothrow_assignable<
const _Elements&...>())
1717 requires (__assignable<const _Elements&...>())
1719 this->_M_assign(__u);
1724 operator=(tuple&& __u)
1725 noexcept(__nothrow_assignable<_Elements...>())
1726 requires (__assignable<_Elements...>())
1732 template<
typename... _UTypes>
1733 requires (__assignable<
const _UTypes&...>())
1735 operator=(
const tuple<_UTypes...>& __u)
1736 noexcept(__nothrow_assignable<
const _UTypes&...>())
1738 this->_M_assign(__u);
1742 template<
typename... _UTypes>
1743 requires (__assignable<_UTypes...>())
1745 operator=(tuple<_UTypes...>&& __u)
1746 noexcept(__nothrow_assignable<_UTypes...>())
1752#if __cpp_lib_ranges_zip
1753 constexpr const tuple&
1754 operator=(
const tuple& __u)
const
1755 requires (__const_assignable<
const _Elements&...>())
1757 this->_M_assign(__u);
1761 constexpr const tuple&
1762 operator=(tuple&& __u)
const
1763 requires (__const_assignable<_Elements...>())
1769 template<
typename... _UTypes>
1770 constexpr const tuple&
1771 operator=(
const tuple<_UTypes...>& __u)
const
1772 requires (__const_assignable<
const _UTypes&...>())
1774 this->_M_assign(__u);
1778 template<
typename... _UTypes>
1779 constexpr const tuple&
1780 operator=(tuple<_UTypes...>&& __u)
const
1781 requires (__const_assignable<_UTypes...>())
1788 template<
typename _U1,
typename _U2>
1789 requires (__assignable<const _U1&, const _U2&>())
1792 noexcept(__nothrow_assignable<const _U1&, const _U2&>())
1794 this->_M_head(*
this) = __u.first;
1795 this->_M_tail(*this)._M_head(*
this) = __u.second;
1799 template<
typename _U1,
typename _U2>
1800 requires (__assignable<_U1, _U2>())
1803 noexcept(__nothrow_assignable<_U1, _U2>())
1810#if __cpp_lib_ranges_zip
1811 template<
typename _U1,
typename _U2>
1812 requires (__const_assignable<const _U1&, const _U2>())
1813 constexpr const tuple&
1816 this->_M_head(*
this) = __u.first;
1817 this->_M_tail(*this)._M_head(*
this) = __u.second;
1821 template<
typename _U1,
typename _U2>
1822 requires (__const_assignable<_U1, _U2>())
1823 constexpr const tuple&
1832#if __cpp_lib_tuple_like
1833 template<__eligible_tuple_like<tuple> _UTuple>
1834 requires (__assignable_from_tuple_like<_UTuple>())
1836 operator=(_UTuple&& __u)
1842 template<__eligible_tuple_like<tuple> _UTuple>
1843 requires (__const_assignable_from_tuple_like<_UTuple>())
1844 constexpr const tuple&
1845 operator=(_UTuple&& __u)
const
1851 template<__tuple_like _UTuple>
1852 requires (!__is_tuple_v<_UTuple>)
1853 friend constexpr bool
1854 operator== [[nodiscard]] (
const tuple& __t,
const _UTuple& __u)
1856 static_assert(
sizeof...(_Elements) == tuple_size_v<_UTuple>,
1857 "tuple objects can only be compared if they have equal sizes.");
1859 return (
bool(std::get<_Is>(__t) == std::get<_Is>(__u))
1864 template<__tuple_like _UTuple,
1866 struct __tuple_like_common_comparison_category;
1868 template<__tuple_like _UTuple,
size_t... _Is>
1870 {
typename void_t<__detail::__synth3way_t<_Elements, tuple_element_t<_Is, _UTuple>>...>; }
1871 struct __tuple_like_common_comparison_category<_UTuple,
index_sequence<_Is...>>
1873 using type = common_comparison_category_t
1874 <__detail::__synth3way_t<_Elements, tuple_element_t<_Is, _UTuple>>...>;
1877 template<__tuple_like _UTuple>
1878 requires (!__is_tuple_v<_UTuple>)
1879 friend constexpr typename __tuple_like_common_comparison_category<_UTuple>::type
1880 operator<=>(
const tuple& __t,
const _UTuple& __u)
1882 using _Cat =
typename __tuple_like_common_comparison_category<_UTuple>::type;
1890 template<
typename... _UElements>
1892 __enable_if_t<
sizeof...(_UElements) ==
sizeof...(_Elements),
bool>
1894 {
return __and_<is_assignable<_Elements&, _UElements>...>::value; }
1897 template<
typename... _UElements>
1898 static constexpr bool __nothrow_assignable()
1901 __and_<is_nothrow_assignable<_Elements&, _UElements>...>::value;
1906 _GLIBCXX20_CONSTEXPR
1908 operator=(__conditional_t<__assignable<const _Elements&...>(),
1910 const __nonesuch&> __in)
1911 noexcept(__nothrow_assignable<
const _Elements&...>())
1913 this->_M_assign(__in);
1917 _GLIBCXX20_CONSTEXPR
1919 operator=(__conditional_t<__assignable<_Elements...>(),
1922 noexcept(__nothrow_assignable<_Elements...>())
1928 template<
typename... _UElements>
1929 _GLIBCXX20_CONSTEXPR
1930 __enable_if_t<__assignable<
const _UElements&...>(), tuple&>
1931 operator=(
const tuple<_UElements...>& __in)
1932 noexcept(__nothrow_assignable<
const _UElements&...>())
1934 this->_M_assign(__in);
1938 template<
typename... _UElements>
1939 _GLIBCXX20_CONSTEXPR
1940 __enable_if_t<__assignable<_UElements...>(), tuple&>
1941 operator=(tuple<_UElements...>&& __in)
1942 noexcept(__nothrow_assignable<_UElements...>())
1950 _GLIBCXX20_CONSTEXPR
1953 noexcept(__and_<__is_nothrow_swappable<_Elements>...>::value)
1954 { _Inherited::_M_swap(__in); }
1956#if __cpp_lib_ranges_zip
1964 swap(
const tuple& __in)
const
1965 noexcept(__and_v<__is_nothrow_swappable<const _Elements>...>)
1966 requires (is_swappable_v<const _Elements> && ...)
1967 { _Inherited::_M_swap(__in); }
2065 class tuple<_T1, _T2> :
public _Tuple_impl<0, _T1, _T2>
2067 typedef _Tuple_impl<0, _T1, _T2> _Inherited;
2070 template<
bool _Dummy,
typename _U1,
typename _U2>
2071 using _ImplicitDefaultCtor = __enable_if_t<
2072 _TupleConstraints<_Dummy, _U1, _U2>::
2073 __is_implicitly_default_constructible(),
2077 template<
bool _Dummy,
typename _U1,
typename _U2>
2078 using _ExplicitDefaultCtor = __enable_if_t<
2079 _TupleConstraints<_Dummy, _U1, _U2>::
2080 __is_explicitly_default_constructible(),
2083 template<
bool _Dummy>
2084 using _TCC = _TupleConstraints<_Dummy, _T1, _T2>;
2087 template<
bool _Cond,
typename _U1,
typename _U2>
2088 using _ImplicitCtor = __enable_if_t<
2089 _TCC<_Cond>::template __is_implicitly_constructible<_U1, _U2>(),
2093 template<
bool _Cond,
typename _U1,
typename _U2>
2094 using _ExplicitCtor = __enable_if_t<
2095 _TCC<_Cond>::template __is_explicitly_constructible<_U1, _U2>(),
2098 template<
typename _U1,
typename _U2>
2099 static constexpr bool __assignable()
2101 return __and_<is_assignable<_T1&, _U1>,
2105 template<
typename _U1,
typename _U2>
2106 static constexpr bool __nothrow_assignable()
2108 return __and_<is_nothrow_assignable<_T1&, _U1>,
2112 template<
typename _U1,
typename _U2>
2113 static constexpr bool __nothrow_constructible()
2115 return __and_<is_nothrow_constructible<_T1, _U1>,
2119 static constexpr bool __nothrow_default_constructible()
2121 return __and_<is_nothrow_default_constructible<_T1>,
2125 template<
typename _U1>
2126 static constexpr bool __is_alloc_arg()
2130#undef __glibcxx_no_dangling_refs
2132#if __has_builtin(__reference_constructs_from_temporary) \
2133 && defined _GLIBCXX_DEBUG
2134# define __glibcxx_no_dangling_refs(_U1, _U2) \
2135 static_assert(!__reference_constructs_from_temporary(_T1, _U1) \
2136 && !__reference_constructs_from_temporary(_T2, _U2), \
2137 "std::tuple constructor creates a dangling reference")
2139# define __glibcxx_no_dangling_refs(_U1, _U2)
2144 template<
bool _Dummy =
true,
2145 _ImplicitDefaultCtor<_Dummy, _T1, _T2> =
true>
2148 noexcept(__nothrow_default_constructible())
2151 template<
bool _Dummy =
true,
2152 _ExplicitDefaultCtor<_Dummy, _T1, _T2> =
false>
2155 noexcept(__nothrow_default_constructible())
2158 template<
bool _Dummy =
true,
2159 _ImplicitCtor<_Dummy, const _T1&, const _T2&> =
true>
2161 tuple(
const _T1& __a1,
const _T2& __a2)
2162 noexcept(__nothrow_constructible<const _T1&, const _T2&>())
2163 : _Inherited(__a1, __a2) { }
2165 template<
bool _Dummy =
true,
2166 _ExplicitCtor<_Dummy, const _T1&, const _T2&> =
false>
2168 tuple(
const _T1& __a1,
const _T2& __a2)
2169 noexcept(__nothrow_constructible<const _T1&, const _T2&>())
2170 : _Inherited(__a1, __a2) { }
2172 template<
typename _U1,
typename _U2,
2173 _ImplicitCtor<!__is_alloc_arg<_U1>(), _U1, _U2> =
true>
2175 tuple(_U1&& __a1, _U2&& __a2)
2176 noexcept(__nothrow_constructible<_U1, _U2>())
2178 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2180 template<
typename _U1,
typename _U2,
2181 _ExplicitCtor<!__is_alloc_arg<_U1>(), _U1, _U2> =
false>
2183 tuple(_U1&& __a1, _U2&& __a2)
2184 noexcept(__nothrow_constructible<_U1, _U2>())
2186 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2188 constexpr tuple(
const tuple&) =
default;
2190 constexpr tuple(tuple&&) =
default;
2192 template<
typename _U1,
typename _U2,
2193 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
2195 tuple(
const tuple<_U1, _U2>& __in)
2196 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
2197 : _Inherited(
static_cast<const _Tuple_impl<0, _U1, _U2>&
>(__in))
2198 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2200 template<
typename _U1,
typename _U2,
2201 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
2203 tuple(
const tuple<_U1, _U2>& __in)
2204 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
2205 : _Inherited(
static_cast<const _Tuple_impl<0, _U1, _U2>&
>(__in))
2206 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2208 template<
typename _U1,
typename _U2,
2209 _ImplicitCtor<true, _U1, _U2> =
true>
2211 tuple(tuple<_U1, _U2>&& __in)
2212 noexcept(__nothrow_constructible<_U1, _U2>())
2213 : _Inherited(
static_cast<_Tuple_impl<0, _U1, _U2>&&
>(__in))
2214 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2216 template<
typename _U1,
typename _U2,
2217 _ExplicitCtor<true, _U1, _U2> =
false>
2219 tuple(tuple<_U1, _U2>&& __in)
2220 noexcept(__nothrow_constructible<_U1, _U2>())
2221 : _Inherited(
static_cast<_Tuple_impl<0, _U1, _U2>&&
>(__in))
2222 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2224 template<
typename _U1,
typename _U2,
2225 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
2228 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
2229 : _Inherited(__in.first, __in.second)
2230 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2232 template<
typename _U1,
typename _U2,
2233 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
2236 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
2237 : _Inherited(__in.first, __in.second)
2238 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2240 template<
typename _U1,
typename _U2,
2241 _ImplicitCtor<true, _U1, _U2> =
true>
2244 noexcept(__nothrow_constructible<_U1, _U2>())
2247 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2249 template<
typename _U1,
typename _U2,
2250 _ExplicitCtor<true, _U1, _U2> =
false>
2253 noexcept(__nothrow_constructible<_U1, _U2>())
2256 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2260 template<
typename _Alloc,
2261 _ImplicitDefaultCtor<is_object<_Alloc>::value, _T1, _T2> =
true>
2262 _GLIBCXX20_CONSTEXPR
2263 tuple(allocator_arg_t __tag,
const _Alloc& __a)
2264 : _Inherited(__tag, __a) { }
2266 template<
typename _Alloc,
2267 _ExplicitDefaultCtor<is_object<_Alloc>::value, _T1, _T2> =
false>
2268 _GLIBCXX20_CONSTEXPR
2270 tuple(allocator_arg_t __tag,
const _Alloc& __a)
2271 : _Inherited(__tag, __a) { }
2273 template<
typename _Alloc,
bool _Dummy =
true,
2274 _ImplicitCtor<_Dummy, const _T1&, const _T2&> =
true>
2275 _GLIBCXX20_CONSTEXPR
2276 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2277 const _T1& __a1,
const _T2& __a2)
2278 : _Inherited(__tag, __a, __a1, __a2) { }
2280 template<
typename _Alloc,
bool _Dummy =
true,
2281 _ExplicitCtor<_Dummy, const _T1&, const _T2&> =
false>
2283 _GLIBCXX20_CONSTEXPR
2284 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2285 const _T1& __a1,
const _T2& __a2)
2286 : _Inherited(__tag, __a, __a1, __a2) { }
2288 template<
typename _Alloc,
typename _U1,
typename _U2,
2289 _ImplicitCtor<true, _U1, _U2> =
true>
2290 _GLIBCXX20_CONSTEXPR
2291 tuple(allocator_arg_t __tag,
const _Alloc& __a, _U1&& __a1, _U2&& __a2)
2294 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2296 template<
typename _Alloc,
typename _U1,
typename _U2,
2297 _ExplicitCtor<true, _U1, _U2> =
false>
2299 _GLIBCXX20_CONSTEXPR
2300 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2301 _U1&& __a1, _U2&& __a2)
2304 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2306 template<
typename _Alloc>
2307 _GLIBCXX20_CONSTEXPR
2308 tuple(allocator_arg_t __tag,
const _Alloc& __a,
const tuple& __in)
2309 : _Inherited(__tag, __a,
static_cast<const _Inherited&
>(__in)) { }
2311 template<
typename _Alloc>
2312 _GLIBCXX20_CONSTEXPR
2313 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple&& __in)
2314 : _Inherited(__tag, __a,
static_cast<_Inherited&&
>(__in)) { }
2316 template<
typename _Alloc,
typename _U1,
typename _U2,
2317 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
2318 _GLIBCXX20_CONSTEXPR
2319 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2320 const tuple<_U1, _U2>& __in)
2321 : _Inherited(__tag, __a,
2322 static_cast<const _Tuple_impl<0, _U1, _U2>&
>(__in))
2323 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2325 template<
typename _Alloc,
typename _U1,
typename _U2,
2326 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
2328 _GLIBCXX20_CONSTEXPR
2329 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2330 const tuple<_U1, _U2>& __in)
2331 : _Inherited(__tag, __a,
2332 static_cast<const _Tuple_impl<0, _U1, _U2>&
>(__in))
2333 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2335 template<
typename _Alloc,
typename _U1,
typename _U2,
2336 _ImplicitCtor<true, _U1, _U2> =
true>
2337 _GLIBCXX20_CONSTEXPR
2338 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple<_U1, _U2>&& __in)
2339 : _Inherited(__tag, __a,
static_cast<_Tuple_impl<0, _U1, _U2>&&
>(__in))
2340 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2342 template<
typename _Alloc,
typename _U1,
typename _U2,
2343 _ExplicitCtor<true, _U1, _U2> =
false>
2345 _GLIBCXX20_CONSTEXPR
2346 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple<_U1, _U2>&& __in)
2347 : _Inherited(__tag, __a,
static_cast<_Tuple_impl<0, _U1, _U2>&&
>(__in))
2348 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2350 template<
typename _Alloc,
typename _U1,
typename _U2,
2351 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
2352 _GLIBCXX20_CONSTEXPR
2353 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2355 : _Inherited(__tag, __a, __in.first, __in.second)
2356 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2358 template<
typename _Alloc,
typename _U1,
typename _U2,
2359 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
2361 _GLIBCXX20_CONSTEXPR
2362 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2364 : _Inherited(__tag, __a, __in.first, __in.second)
2365 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2367 template<
typename _Alloc,
typename _U1,
typename _U2,
2368 _ImplicitCtor<true, _U1, _U2> =
true>
2369 _GLIBCXX20_CONSTEXPR
2370 tuple(allocator_arg_t __tag,
const _Alloc& __a,
pair<_U1, _U2>&& __in)
2373 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2375 template<
typename _Alloc,
typename _U1,
typename _U2,
2376 _ExplicitCtor<true, _U1, _U2> =
false>
2378 _GLIBCXX20_CONSTEXPR
2379 tuple(allocator_arg_t __tag,
const _Alloc& __a,
pair<_U1, _U2>&& __in)
2382 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2386 _GLIBCXX20_CONSTEXPR
2388 operator=(__conditional_t<__assignable<const _T1&, const _T2&>(),
2390 const __nonesuch&> __in)
2391 noexcept(__nothrow_assignable<const _T1&, const _T2&>())
2393 this->_M_assign(__in);
2397 _GLIBCXX20_CONSTEXPR
2399 operator=(__conditional_t<__assignable<_T1, _T2>(),
2402 noexcept(__nothrow_assignable<_T1, _T2>())
2408 template<
typename _U1,
typename _U2>
2409 _GLIBCXX20_CONSTEXPR
2410 __enable_if_t<__assignable<const _U1&, const _U2&>(), tuple&>
2411 operator=(
const tuple<_U1, _U2>& __in)
2412 noexcept(__nothrow_assignable<const _U1&, const _U2&>())
2414 this->_M_assign(__in);
2418 template<
typename _U1,
typename _U2>
2419 _GLIBCXX20_CONSTEXPR
2420 __enable_if_t<__assignable<_U1, _U2>(), tuple&>
2421 operator=(tuple<_U1, _U2>&& __in)
2422 noexcept(__nothrow_assignable<_U1, _U2>())
2428 template<
typename _U1,
typename _U2>
2429 _GLIBCXX20_CONSTEXPR
2430 __enable_if_t<__assignable<const _U1&, const _U2&>(), tuple&>
2432 noexcept(__nothrow_assignable<const _U1&, const _U2&>())
2434 this->_M_head(*
this) = __in.first;
2435 this->_M_tail(*this)._M_head(*
this) = __in.second;
2439 template<
typename _U1,
typename _U2>
2440 _GLIBCXX20_CONSTEXPR
2441 __enable_if_t<__assignable<_U1, _U2>(), tuple&>
2443 noexcept(__nothrow_assignable<_U1, _U2>())
2450 _GLIBCXX20_CONSTEXPR
2453 noexcept(__and_<__is_nothrow_swappable<_T1>,
2454 __is_nothrow_swappable<_T2>>::value)
2455 { _Inherited::_M_swap(__in); }