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 _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;
996 constexpr tuple(tuple&&) =
default;
998 template<
typename... _UTypes>
999 requires (__constructible<
const _UTypes&...>())
1000 && (!__use_other_ctor<
const tuple<_UTypes...>&>())
1001 && (!__dangles<
const _UTypes&...>())
1002 constexpr explicit(!__convertible<const _UTypes&...>())
1003 tuple(
const tuple<_UTypes...>& __u)
1004 noexcept(__nothrow_constructible<
const _UTypes&...>())
1005 : _Inherited(
static_cast<const _Tuple_impl<0, _UTypes...
>&>(__u))
1008 template<
typename... _UTypes>
1009 requires (__constructible<
const _UTypes&...>())
1010 && (!__use_other_ctor<
const tuple<_UTypes...>&>())
1011 && (__dangles<
const _UTypes&...>())
1012 tuple(
const tuple<_UTypes...>&) =
delete;
1014 template<
typename... _UTypes>
1015 requires (__constructible<_UTypes...>())
1016 && (!__use_other_ctor<tuple<_UTypes...>>())
1017 && (!__dangles<_UTypes...>())
1018 constexpr explicit(!__convertible<_UTypes...>())
1019 tuple(tuple<_UTypes...>&& __u)
1020 noexcept(__nothrow_constructible<_UTypes...>())
1021 : _Inherited(
static_cast<_Tuple_impl<0, _UTypes...
>&&>(__u))
1024 template<
typename... _UTypes>
1025 requires (__constructible<_UTypes...>())
1026 && (!__use_other_ctor<tuple<_UTypes...>>())
1027 && (__dangles<_UTypes...>())
1028 tuple(tuple<_UTypes...>&&) =
delete;
1030#if __cpp_lib_ranges_zip
1031 template<
typename... _UTypes>
1032 requires (__constructible<_UTypes&...>())
1033 && (!__use_other_ctor<tuple<_UTypes...>&>())
1034 && (!__dangles<_UTypes&...>())
1035 constexpr explicit(!__convertible<_UTypes&...>())
1036 tuple(tuple<_UTypes...>& __u)
1037 noexcept(__nothrow_constructible<_UTypes&...>())
1038 : _Inherited(
static_cast<_Tuple_impl<0, _UTypes...
>&>(__u))
1041 template<
typename... _UTypes>
1042 requires (__constructible<_UTypes&...>())
1043 && (!__use_other_ctor<tuple<_UTypes...>&>())
1044 && (__dangles<_UTypes&...>())
1045 tuple(tuple<_UTypes...>&) =
delete;
1047 template<
typename... _UTypes>
1048 requires (__constructible<
const _UTypes...>())
1049 && (!__use_other_ctor<
const tuple<_UTypes...>>())
1050 && (!__dangles<
const _UTypes...>())
1051 constexpr explicit(!__convertible<const _UTypes...>())
1052 tuple(
const tuple<_UTypes...>&& __u)
1053 noexcept(__nothrow_constructible<
const _UTypes...>())
1054 : _Inherited(
static_cast<const _Tuple_impl<0, _UTypes...
>&&>(__u))
1057 template<
typename... _UTypes>
1058 requires (__constructible<
const _UTypes...>())
1059 && (!__use_other_ctor<
const tuple<_UTypes...>>())
1060 && (__dangles<
const _UTypes...>())
1061 tuple(
const tuple<_UTypes...>&&) =
delete;
1064 template<
typename _U1,
typename _U2>
1065 requires (
sizeof...(_Elements) == 2)
1066 && (__constructible<const _U1&, const _U2&>())
1067 && (!__dangles<const _U1&, const _U2&>())
1068 constexpr explicit(!__convertible<const _U1&, const _U2&>())
1070 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
1071 : _Inherited(__u.first, __u.second)
1074 template<
typename _U1,
typename _U2>
1075 requires (
sizeof...(_Elements) == 2)
1076 && (__constructible<const _U1&, const _U2&>())
1077 && (__dangles<const _U1&, const _U2&>())
1080 template<
typename _U1,
typename _U2>
1081 requires (
sizeof...(_Elements) == 2)
1082 && (__constructible<_U1, _U2>())
1083 && (!__dangles<_U1, _U2>())
1084 constexpr explicit(!__convertible<_U1, _U2>())
1086 noexcept(__nothrow_constructible<_U1, _U2>())
1091 template<
typename _U1,
typename _U2>
1092 requires (
sizeof...(_Elements) == 2)
1093 && (__constructible<_U1, _U2>())
1094 && (__dangles<_U1, _U2>())
1097#if __cpp_lib_ranges_zip
1098 template<
typename _U1,
typename _U2>
1099 requires (
sizeof...(_Elements) == 2)
1100 && (__constructible<_U1&, _U2&>())
1101 && (!__dangles<_U1&, _U2&>())
1102 constexpr explicit(!__convertible<_U1&, _U2&>())
1104 noexcept(__nothrow_constructible<_U1&, _U2&>())
1105 : _Inherited(__u.first, __u.second)
1108 template<
typename _U1,
typename _U2>
1109 requires (
sizeof...(_Elements) == 2)
1110 && (__constructible<_U1&, _U2&>())
1111 && (__dangles<_U1&, _U2&>())
1114 template<
typename _U1,
typename _U2>
1115 requires (
sizeof...(_Elements) == 2)
1116 && (__constructible<const _U1, const _U2>())
1117 && (!__dangles<const _U1, const _U2>())
1118 constexpr explicit(!__convertible<const _U1, const _U2>())
1120 noexcept(__nothrow_constructible<const _U1, const _U2>())
1125 template<
typename _U1,
typename _U2>
1126 requires (
sizeof...(_Elements) == 2)
1127 && (__constructible<const _U1, const _U2>())
1128 && (__dangles<const _U1, const _U2>())
1132#if __cpp_lib_tuple_like
1133 template<__eligible_tuple_like<tuple> _UTuple>
1134 requires (__constructible_from_tuple_like<_UTuple>())
1135 && (!__use_other_ctor<_UTuple>())
1136 && (!__dangles_from_tuple_like<_UTuple>())
1137 constexpr explicit(!__convertible_from_tuple_like<_UTuple>())
1138 tuple(_UTuple&& __u)
1139 : _Inherited(__tuple_like_tag_t{},
1144 template<__eligible_tuple_like<tuple> _UTuple>
1145 requires (__constructible_from_tuple_like<_UTuple>())
1146 && (!__use_other_ctor<_UTuple>())
1147 && (__dangles_from_tuple_like<_UTuple>())
1148 tuple(_UTuple&&) =
delete;
1153 template<
typename _Alloc>
1155 explicit(!(__is_implicitly_default_constructible_v<_Elements> && ...))
1156 tuple(allocator_arg_t __tag,
const _Alloc& __a)
1157 requires (is_default_constructible_v<_Elements> && ...)
1158 : _Inherited(__tag, __a)
1161 template<
typename _Alloc>
1162 constexpr explicit(!__convertible<
const _Elements&...>())
1163 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1164 const _Elements&... __elements)
1165 requires (__constructible<
const _Elements&...>())
1166 : _Inherited(__tag, __a, __elements...)
1169 template<
typename _Alloc,
typename... _UTypes>
1170 requires (__disambiguating_constraint<_UTypes...>())
1171 && (__constructible<_UTypes...>())
1172 && (!__dangles<_UTypes...>())
1173 constexpr explicit(!__convertible<_UTypes...>())
1174 tuple(allocator_arg_t __tag,
const _Alloc& __a, _UTypes&&... __u)
1178 template<
typename _Alloc,
typename... _UTypes>
1179 requires (__disambiguating_constraint<_UTypes...>())
1180 && (__constructible<_UTypes...>())
1181 && (__dangles<_UTypes...>())
1182 tuple(allocator_arg_t,
const _Alloc&, _UTypes&&...) =
delete;
1184 template<
typename _Alloc>
1186 tuple(allocator_arg_t __tag,
const _Alloc& __a,
const tuple& __u)
1187 : _Inherited(__tag, __a,
static_cast<const _Inherited&
>(__u))
1190 template<
typename _Alloc>
1191 requires (__constructible<_Elements...>())
1193 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple&& __u)
1194 : _Inherited(__tag, __a,
static_cast<_Inherited&&
>(__u))
1197 template<
typename _Alloc,
typename... _UTypes>
1198 requires (__constructible<
const _UTypes&...>())
1199 && (!__use_other_ctor<
const tuple<_UTypes...>&>())
1200 && (!__dangles<
const _UTypes&...>())
1201 constexpr explicit(!__convertible<const _UTypes&...>())
1202 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1203 const tuple<_UTypes...>& __u)
1204 : _Inherited(__tag, __a,
1205 static_cast<const _Tuple_impl<0, _UTypes...
>&>(__u))
1208 template<
typename _Alloc,
typename... _UTypes>
1209 requires (__constructible<
const _UTypes&...>())
1210 && (!__use_other_ctor<
const tuple<_UTypes...>&>())
1211 && (__dangles<
const _UTypes&...>())
1212 tuple(allocator_arg_t,
const _Alloc&,
const tuple<_UTypes...>&) =
delete;
1214 template<
typename _Alloc,
typename... _UTypes>
1215 requires (__constructible<_UTypes...>())
1216 && (!__use_other_ctor<tuple<_UTypes...>>())
1217 && (!__dangles<_UTypes...>())
1218 constexpr explicit(!__use_other_ctor<tuple<_UTypes...>>())
1219 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple<_UTypes...>&& __u)
1220 : _Inherited(__tag, __a,
static_cast<_Tuple_impl<0, _UTypes...
>&&>(__u))
1223 template<
typename _Alloc,
typename... _UTypes>
1224 requires (__constructible<_UTypes...>())
1225 && (!__use_other_ctor<tuple<_UTypes...>>())
1226 && (__dangles<_UTypes...>())
1227 tuple(allocator_arg_t,
const _Alloc&, tuple<_UTypes...>&&) =
delete;
1229#if __cpp_lib_ranges_zip
1230 template<
typename _Alloc,
typename... _UTypes>
1231 requires (__constructible<_UTypes&...>())
1232 && (!__use_other_ctor<tuple<_UTypes...>&>())
1233 && (!__dangles<_UTypes&...>())
1234 constexpr explicit(!__convertible<_UTypes&...>())
1235 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple<_UTypes...>& __u)
1236 : _Inherited(__tag, __a,
static_cast<_Tuple_impl<0, _UTypes...
>&>(__u))
1239 template<
typename _Alloc,
typename... _UTypes>
1240 requires (__constructible<_UTypes&...>())
1241 && (!__use_other_ctor<tuple<_UTypes...>&>())
1242 && (__dangles<_UTypes&...>())
1243 tuple(allocator_arg_t,
const _Alloc&, tuple<_UTypes...>&) =
delete;
1245 template<
typename _Alloc,
typename... _UTypes>
1246 requires (__constructible<
const _UTypes...>())
1247 && (!__use_other_ctor<
const tuple<_UTypes...>>())
1248 && (!__dangles<
const _UTypes...>())
1249 constexpr explicit(!__convertible<const _UTypes...>())
1250 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1251 const tuple<_UTypes...>&& __u)
1252 : _Inherited(__tag, __a,
1253 static_cast<const _Tuple_impl<0, _UTypes...
>&&>(__u))
1256 template<
typename _Alloc,
typename... _UTypes>
1257 requires (__constructible<
const _UTypes...>())
1258 && (!__use_other_ctor<
const tuple<_UTypes...>>())
1259 && (__dangles<
const _UTypes...>())
1260 tuple(allocator_arg_t,
const _Alloc&,
const tuple<_UTypes...>&&) =
delete;
1263 template<
typename _Alloc,
typename _U1,
typename _U2>
1264 requires (
sizeof...(_Elements) == 2)
1265 && (__constructible<const _U1&, const _U2&>())
1266 && (!__dangles<const _U1&, const _U2&>())
1267 constexpr explicit(!__convertible<const _U1&, const _U2&>())
1268 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1270 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
1271 : _Inherited(__tag, __a, __u.first, __u.second)
1274 template<
typename _Alloc,
typename _U1,
typename _U2>
1275 requires (
sizeof...(_Elements) == 2)
1276 && (__constructible<const _U1&, const _U2&>())
1277 && (__dangles<const _U1&, const _U2&>())
1278 tuple(allocator_arg_t,
const _Alloc&,
const pair<_U1, _U2>&) =
delete;
1280 template<
typename _Alloc,
typename _U1,
typename _U2>
1281 requires (
sizeof...(_Elements) == 2)
1282 && (__constructible<_U1, _U2>())
1283 && (!__dangles<_U1, _U2>())
1284 constexpr explicit(!__convertible<_U1, _U2>())
1285 tuple(allocator_arg_t __tag,
const _Alloc& __a,
pair<_U1, _U2>&& __u)
1286 noexcept(__nothrow_constructible<_U1, _U2>())
1290 template<
typename _Alloc,
typename _U1,
typename _U2>
1291 requires (
sizeof...(_Elements) == 2)
1292 && (__constructible<_U1, _U2>())
1293 && (__dangles<_U1, _U2>())
1294 tuple(allocator_arg_t,
const _Alloc&,
pair<_U1, _U2>&&) =
delete;
1296#if __cpp_lib_ranges_zip
1297 template<
typename _Alloc,
typename _U1,
typename _U2>
1298 requires (
sizeof...(_Elements) == 2)
1299 && (__constructible<_U1&, _U2&>())
1300 && (!__dangles<_U1&, _U2&>())
1301 constexpr explicit(!__convertible<_U1&, _U2&>())
1302 tuple(allocator_arg_t __tag,
const _Alloc& __a,
pair<_U1, _U2>& __u)
1303 noexcept(__nothrow_constructible<_U1&, _U2&>())
1304 : _Inherited(__tag, __a, __u.first, __u.second)
1307 template<
typename _Alloc,
typename _U1,
typename _U2>
1308 requires (
sizeof...(_Elements) == 2)
1309 && (__constructible<_U1&, _U2&>())
1310 && (__dangles<_U1&, _U2&>())
1313 template<
typename _Alloc,
typename _U1,
typename _U2>
1314 requires (
sizeof...(_Elements) == 2)
1315 && (__constructible<const _U1, const _U2>())
1316 && (!__dangles<const _U1, const _U2>())
1317 constexpr explicit(!__convertible<const _U1, const _U2>())
1318 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1320 noexcept(__nothrow_constructible<const _U1, const _U2>())
1324 template<
typename _Alloc,
typename _U1,
typename _U2>
1325 requires (
sizeof...(_Elements) == 2)
1326 && (__constructible<const _U1, const _U2>())
1327 && (__dangles<const _U1, const _U2>())
1328 tuple(allocator_arg_t,
const _Alloc&,
const pair<_U1, _U2>&&) =
delete;
1331#if __cpp_lib_tuple_like
1332 template<
typename _Alloc, __eligible_tuple_like<tuple> _UTuple>
1333 requires (__constructible_from_tuple_like<_UTuple>())
1334 && (!__use_other_ctor<_UTuple>())
1335 && (!__dangles_from_tuple_like<_UTuple>())
1336 constexpr explicit(!__convertible_from_tuple_like<_UTuple>())
1337 tuple(allocator_arg_t __tag,
const _Alloc& __a, _UTuple&& __u)
1338 : _Inherited(__tuple_like_tag_t{},
1343 template<
typename _Alloc, __eligible_tuple_like<tuple> _UTuple>
1344 requires (__constructible_from_tuple_like<_UTuple>())
1345 && (!__use_other_ctor<_UTuple>())
1346 && (__dangles_from_tuple_like<_UTuple>())
1347 tuple(allocator_arg_t,
const _Alloc&, _UTuple&&) =
delete;
1352 template<
bool _Cond>
1353 using _TCC = _TupleConstraints<_Cond, _Elements...>;
1356 template<
bool _Dummy>
1357 using _ImplicitDefaultCtor = __enable_if_t<
1358 _TCC<_Dummy>::__is_implicitly_default_constructible(),
1362 template<
bool _Dummy>
1363 using _ExplicitDefaultCtor = __enable_if_t<
1364 _TCC<_Dummy>::__is_explicitly_default_constructible(),
1368 template<
bool _Cond,
typename... _Args>
1369 using _ImplicitCtor = __enable_if_t<
1370 _TCC<_Cond>::template __is_implicitly_constructible<_Args...>(),
1374 template<
bool _Cond,
typename... _Args>
1375 using _ExplicitCtor = __enable_if_t<
1376 _TCC<_Cond>::template __is_explicitly_constructible<_Args...>(),
1380 template<
typename... _UElements>
1381 static constexpr bool __nothrow_constructible()
1384 __and_<is_nothrow_constructible<_Elements, _UElements>...>::value;
1388 template<
typename _Up>
1389 static constexpr bool __valid_args()
1391 return sizeof...(_Elements) == 1
1392 && !
is_same<tuple, __remove_cvref_t<_Up>>::value;
1396 template<
typename,
typename,
typename... _Tail>
1397 static constexpr bool __valid_args()
1398 {
return (
sizeof...(_Tail) + 2) ==
sizeof...(_Elements); }
1409 template<
typename _Tuple,
typename = tuple,
1410 typename = __remove_cvref_t<_Tuple>>
1411 struct _UseOtherCtor
1416 template<
typename _Tuple,
typename _Tp,
typename _Up>
1417 struct _UseOtherCtor<_Tuple, tuple<_Tp>, tuple<_Up>>
1418 : __or_<is_convertible<_Tuple, _Tp>, is_constructible<_Tp, _Tuple>>
::type
1422 template<
typename _Tuple,
typename _Tp>
1423 struct _UseOtherCtor<_Tuple, tuple<_Tp>, tuple<_Tp>>
1430 template<
typename _Tuple>
1431 static constexpr bool __use_other_ctor()
1432 {
return _UseOtherCtor<_Tuple>::value; }
1435#undef __glibcxx_no_dangling_refs
1436#if __has_builtin(__reference_constructs_from_temporary) \
1437 && defined _GLIBCXX_DEBUG
1439# if __cpp_fold_expressions
1440# define __glibcxx_dangling_refs(U) \
1441 (__reference_constructs_from_temporary(_Elements, U) || ...)
1443# define __glibcxx_dangling_refs(U) \
1444 __or_<__bool_constant<__reference_constructs_from_temporary(_Elements, U) \
1447# define __glibcxx_no_dangling_refs(U) \
1448 static_assert(!__glibcxx_dangling_refs(U), \
1449 "std::tuple constructor creates a dangling reference")
1451# define __glibcxx_no_dangling_refs(U)
1456 template<
typename _Dummy = void,
1457 _ImplicitDefaultCtor<is_void<_Dummy>::value> =
true>
1460 noexcept(__and_<is_nothrow_default_constructible<_Elements>...>::value)
1463 template<
typename _Dummy = void,
1464 _ExplicitDefaultCtor<is_void<_Dummy>::value> =
false>
1467 noexcept(__and_<is_nothrow_default_constructible<_Elements>...>::value)
1470 template<
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
1471 _ImplicitCtor<_NotEmpty, const _Elements&...> =
true>
1473 tuple(
const _Elements&... __elements)
1474 noexcept(__nothrow_constructible<
const _Elements&...>())
1475 : _Inherited(__elements...) { }
1477 template<
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
1478 _ExplicitCtor<_NotEmpty, const _Elements&...> =
false>
1480 tuple(
const _Elements&... __elements)
1481 noexcept(__nothrow_constructible<
const _Elements&...>())
1482 : _Inherited(__elements...) { }
1484 template<
typename... _UElements,
1485 bool _Valid = __valid_args<_UElements...>(),
1486 _ImplicitCtor<_Valid, _UElements...> =
true>
1488 tuple(_UElements&&... __elements)
1489 noexcept(__nothrow_constructible<_UElements...>())
1491 { __glibcxx_no_dangling_refs(_UElements&&); }
1493 template<
typename... _UElements,
1494 bool _Valid = __valid_args<_UElements...>(),
1495 _ExplicitCtor<_Valid, _UElements...> =
false>
1497 tuple(_UElements&&... __elements)
1498 noexcept(__nothrow_constructible<_UElements...>())
1500 { __glibcxx_no_dangling_refs(_UElements&&); }
1502 constexpr tuple(
const tuple&) =
default;
1504 constexpr tuple(tuple&&) =
default;
1506 template<
typename... _UElements,
1507 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1508 && !__use_other_ctor<
const tuple<_UElements...>&>(),
1509 _ImplicitCtor<_Valid,
const _UElements&...> =
true>
1511 tuple(
const tuple<_UElements...>& __in)
1512 noexcept(__nothrow_constructible<
const _UElements&...>())
1513 : _Inherited(
static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
1514 { __glibcxx_no_dangling_refs(
const _UElements&); }
1516 template<
typename... _UElements,
1517 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1518 && !__use_other_ctor<
const tuple<_UElements...>&>(),
1519 _ExplicitCtor<_Valid,
const _UElements&...> =
false>
1521 tuple(
const tuple<_UElements...>& __in)
1522 noexcept(__nothrow_constructible<
const _UElements&...>())
1523 : _Inherited(
static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
1524 { __glibcxx_no_dangling_refs(
const _UElements&); }
1526 template<
typename... _UElements,
1527 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1528 && !__use_other_ctor<tuple<_UElements...>&&>(),
1529 _ImplicitCtor<_Valid, _UElements...> =
true>
1531 tuple(tuple<_UElements...>&& __in)
1532 noexcept(__nothrow_constructible<_UElements...>())
1533 : _Inherited(
static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
1534 { __glibcxx_no_dangling_refs(_UElements&&); }
1536 template<
typename... _UElements,
1537 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1538 && !__use_other_ctor<tuple<_UElements...>&&>(),
1539 _ExplicitCtor<_Valid, _UElements...> =
false>
1541 tuple(tuple<_UElements...>&& __in)
1542 noexcept(__nothrow_constructible<_UElements...>())
1543 : _Inherited(
static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
1544 { __glibcxx_no_dangling_refs(_UElements&&); }
1548 template<
typename _Alloc,
1549 _ImplicitDefaultCtor<is_object<_Alloc>::value> =
true>
1550 _GLIBCXX20_CONSTEXPR
1551 tuple(allocator_arg_t __tag,
const _Alloc& __a)
1552 : _Inherited(__tag, __a) { }
1554 template<
typename _Alloc,
1555 _ExplicitDefaultCtor<is_object<_Alloc>::value> =
false>
1556 _GLIBCXX20_CONSTEXPR
1558 tuple(allocator_arg_t __tag,
const _Alloc& __a)
1559 : _Inherited(__tag, __a) { }
1561 template<
typename _Alloc,
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
1562 _ImplicitCtor<_NotEmpty, const _Elements&...> =
true>
1563 _GLIBCXX20_CONSTEXPR
1564 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1565 const _Elements&... __elements)
1566 : _Inherited(__tag, __a, __elements...) { }
1568 template<
typename _Alloc,
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
1569 _ExplicitCtor<_NotEmpty, const _Elements&...> =
false>
1570 _GLIBCXX20_CONSTEXPR
1572 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1573 const _Elements&... __elements)
1574 : _Inherited(__tag, __a, __elements...) { }
1576 template<
typename _Alloc,
typename... _UElements,
1577 bool _Valid = __valid_args<_UElements...>(),
1578 _ImplicitCtor<_Valid, _UElements...> =
true>
1579 _GLIBCXX20_CONSTEXPR
1580 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1581 _UElements&&... __elements)
1583 { __glibcxx_no_dangling_refs(_UElements&&); }
1585 template<
typename _Alloc,
typename... _UElements,
1586 bool _Valid = __valid_args<_UElements...>(),
1587 _ExplicitCtor<_Valid, _UElements...> =
false>
1588 _GLIBCXX20_CONSTEXPR
1590 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1591 _UElements&&... __elements)
1593 { __glibcxx_no_dangling_refs(_UElements&&); }
1595 template<
typename _Alloc>
1596 _GLIBCXX20_CONSTEXPR
1597 tuple(allocator_arg_t __tag,
const _Alloc& __a,
const tuple& __in)
1598 : _Inherited(__tag, __a,
static_cast<const _Inherited&
>(__in)) { }
1600 template<
typename _Alloc>
1601 _GLIBCXX20_CONSTEXPR
1602 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple&& __in)
1603 : _Inherited(__tag, __a,
static_cast<_Inherited&&
>(__in)) { }
1605 template<
typename _Alloc,
typename... _UElements,
1606 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1607 && !__use_other_ctor<
const tuple<_UElements...>&>(),
1608 _ImplicitCtor<_Valid,
const _UElements&...> =
true>
1609 _GLIBCXX20_CONSTEXPR
1610 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1611 const tuple<_UElements...>& __in)
1612 : _Inherited(__tag, __a,
1613 static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
1614 { __glibcxx_no_dangling_refs(
const _UElements&); }
1616 template<
typename _Alloc,
typename... _UElements,
1617 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1618 && !__use_other_ctor<
const tuple<_UElements...>&>(),
1619 _ExplicitCtor<_Valid,
const _UElements&...> =
false>
1620 _GLIBCXX20_CONSTEXPR
1622 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1623 const tuple<_UElements...>& __in)
1624 : _Inherited(__tag, __a,
1625 static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
1626 { __glibcxx_no_dangling_refs(
const _UElements&); }
1628 template<
typename _Alloc,
typename... _UElements,
1629 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1630 && !__use_other_ctor<tuple<_UElements...>&&>(),
1631 _ImplicitCtor<_Valid, _UElements...> =
true>
1632 _GLIBCXX20_CONSTEXPR
1633 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1634 tuple<_UElements...>&& __in)
1635 : _Inherited(__tag, __a,
1636 static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
1637 { __glibcxx_no_dangling_refs(_UElements&&); }
1639 template<
typename _Alloc,
typename... _UElements,
1640 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1641 && !__use_other_ctor<tuple<_UElements...>&&>(),
1642 _ExplicitCtor<_Valid, _UElements...> =
false>
1643 _GLIBCXX20_CONSTEXPR
1645 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1646 tuple<_UElements...>&& __in)
1647 : _Inherited(__tag, __a,
1648 static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
1649 { __glibcxx_no_dangling_refs(_UElements&&); }
1654#if __cpp_concepts && __cpp_consteval
1656 template<
typename... _UTypes>
1657 static consteval bool
1660 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
1666 template<
typename... _UTypes>
1667 static consteval bool
1668 __nothrow_assignable()
1670 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
1676#if __cpp_lib_ranges_zip
1677 template<
typename... _UTypes>
1678 static consteval bool
1679 __const_assignable()
1681 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
1688#if __cpp_lib_tuple_like
1689 template<
typename _UTuple>
1690 static consteval bool
1691 __assignable_from_tuple_like()
1698 template<
typename _UTuple>
1699 static consteval bool
1700 __const_assignable_from_tuple_like()
1710 tuple& operator=(
const tuple& __u) =
delete;
1713 operator=(
const tuple& __u)
1714 noexcept(__nothrow_assignable<
const _Elements&...>())
1715 requires (__assignable<const _Elements&...>())
1717 this->_M_assign(__u);
1722 operator=(tuple&& __u)
1723 noexcept(__nothrow_assignable<_Elements...>())
1724 requires (__assignable<_Elements...>())
1730 template<
typename... _UTypes>
1731 requires (__assignable<
const _UTypes&...>())
1733 operator=(
const tuple<_UTypes...>& __u)
1734 noexcept(__nothrow_assignable<
const _UTypes&...>())
1736 this->_M_assign(__u);
1740 template<
typename... _UTypes>
1741 requires (__assignable<_UTypes...>())
1743 operator=(tuple<_UTypes...>&& __u)
1744 noexcept(__nothrow_assignable<_UTypes...>())
1750#if __cpp_lib_ranges_zip
1751 constexpr const tuple&
1752 operator=(
const tuple& __u)
const
1753 requires (__const_assignable<
const _Elements&...>())
1755 this->_M_assign(__u);
1759 constexpr const tuple&
1760 operator=(tuple&& __u)
const
1761 requires (__const_assignable<_Elements...>())
1767 template<
typename... _UTypes>
1768 constexpr const tuple&
1769 operator=(
const tuple<_UTypes...>& __u)
const
1770 requires (__const_assignable<
const _UTypes&...>())
1772 this->_M_assign(__u);
1776 template<
typename... _UTypes>
1777 constexpr const tuple&
1778 operator=(tuple<_UTypes...>&& __u)
const
1779 requires (__const_assignable<_UTypes...>())
1786 template<
typename _U1,
typename _U2>
1787 requires (__assignable<const _U1&, const _U2&>())
1790 noexcept(__nothrow_assignable<const _U1&, const _U2&>())
1792 this->_M_head(*
this) = __u.first;
1793 this->_M_tail(*this)._M_head(*
this) = __u.second;
1797 template<
typename _U1,
typename _U2>
1798 requires (__assignable<_U1, _U2>())
1801 noexcept(__nothrow_assignable<_U1, _U2>())
1808#if __cpp_lib_ranges_zip
1809 template<
typename _U1,
typename _U2>
1810 requires (__const_assignable<const _U1&, const _U2>())
1811 constexpr const tuple&
1814 this->_M_head(*
this) = __u.first;
1815 this->_M_tail(*this)._M_head(*
this) = __u.second;
1819 template<
typename _U1,
typename _U2>
1820 requires (__const_assignable<_U1, _U2>())
1821 constexpr const tuple&
1830#if __cpp_lib_tuple_like
1831 template<__eligible_tuple_like<tuple> _UTuple>
1832 requires (__assignable_from_tuple_like<_UTuple>())
1834 operator=(_UTuple&& __u)
1840 template<__eligible_tuple_like<tuple> _UTuple>
1841 requires (__const_assignable_from_tuple_like<_UTuple>())
1842 constexpr const tuple&
1843 operator=(_UTuple&& __u)
const
1849 template<__tuple_like _UTuple>
1850 requires (!__is_tuple_v<_UTuple>)
1851 friend constexpr bool
1852 operator== [[nodiscard]] (
const tuple& __t,
const _UTuple& __u)
1854 static_assert(
sizeof...(_Elements) == tuple_size_v<_UTuple>,
1855 "tuple objects can only be compared if they have equal sizes.");
1857 return (
bool(std::get<_Is>(__t) == std::get<_Is>(__u))
1862 template<__tuple_like _UTuple,
1864 struct __tuple_like_common_comparison_category;
1866 template<__tuple_like _UTuple,
size_t... _Is>
1868 {
typename void_t<__detail::__synth3way_t<_Elements, tuple_element_t<_Is, _UTuple>>...>; }
1869 struct __tuple_like_common_comparison_category<_UTuple,
index_sequence<_Is...>>
1871 using type = common_comparison_category_t
1872 <__detail::__synth3way_t<_Elements, tuple_element_t<_Is, _UTuple>>...>;
1875 template<__tuple_like _UTuple>
1876 requires (!__is_tuple_v<_UTuple>)
1877 friend constexpr typename __tuple_like_common_comparison_category<_UTuple>::type
1878 operator<=>(
const tuple& __t,
const _UTuple& __u)
1880 using _Cat =
typename __tuple_like_common_comparison_category<_UTuple>::type;
1888 template<
typename... _UElements>
1890 __enable_if_t<
sizeof...(_UElements) ==
sizeof...(_Elements),
bool>
1892 {
return __and_<is_assignable<_Elements&, _UElements>...>::value; }
1895 template<
typename... _UElements>
1896 static constexpr bool __nothrow_assignable()
1899 __and_<is_nothrow_assignable<_Elements&, _UElements>...>::value;
1904 _GLIBCXX20_CONSTEXPR
1906 operator=(__conditional_t<__assignable<const _Elements&...>(),
1908 const __nonesuch&> __in)
1909 noexcept(__nothrow_assignable<
const _Elements&...>())
1911 this->_M_assign(__in);
1915 _GLIBCXX20_CONSTEXPR
1917 operator=(__conditional_t<__assignable<_Elements...>(),
1920 noexcept(__nothrow_assignable<_Elements...>())
1926 template<
typename... _UElements>
1927 _GLIBCXX20_CONSTEXPR
1928 __enable_if_t<__assignable<
const _UElements&...>(), tuple&>
1929 operator=(
const tuple<_UElements...>& __in)
1930 noexcept(__nothrow_assignable<
const _UElements&...>())
1932 this->_M_assign(__in);
1936 template<
typename... _UElements>
1937 _GLIBCXX20_CONSTEXPR
1938 __enable_if_t<__assignable<_UElements...>(), tuple&>
1939 operator=(tuple<_UElements...>&& __in)
1940 noexcept(__nothrow_assignable<_UElements...>())
1948 _GLIBCXX20_CONSTEXPR
1951 noexcept(__and_<__is_nothrow_swappable<_Elements>...>::value)
1952 { _Inherited::_M_swap(__in); }
1954#if __cpp_lib_ranges_zip
1962 swap(
const tuple& __in)
const
1963 noexcept(__and_v<__is_nothrow_swappable<const _Elements>...>)
1964 requires (is_swappable_v<const _Elements> && ...)
1965 { _Inherited::_M_swap(__in); }
2008 class tuple<_T1, _T2> :
public _Tuple_impl<0, _T1, _T2>
2010 typedef _Tuple_impl<0, _T1, _T2> _Inherited;
2013 template<
bool _Dummy,
typename _U1,
typename _U2>
2014 using _ImplicitDefaultCtor = __enable_if_t<
2015 _TupleConstraints<_Dummy, _U1, _U2>::
2016 __is_implicitly_default_constructible(),
2020 template<
bool _Dummy,
typename _U1,
typename _U2>
2021 using _ExplicitDefaultCtor = __enable_if_t<
2022 _TupleConstraints<_Dummy, _U1, _U2>::
2023 __is_explicitly_default_constructible(),
2026 template<
bool _Dummy>
2027 using _TCC = _TupleConstraints<_Dummy, _T1, _T2>;
2030 template<
bool _Cond,
typename _U1,
typename _U2>
2031 using _ImplicitCtor = __enable_if_t<
2032 _TCC<_Cond>::template __is_implicitly_constructible<_U1, _U2>(),
2036 template<
bool _Cond,
typename _U1,
typename _U2>
2037 using _ExplicitCtor = __enable_if_t<
2038 _TCC<_Cond>::template __is_explicitly_constructible<_U1, _U2>(),
2041 template<
typename _U1,
typename _U2>
2042 static constexpr bool __assignable()
2044 return __and_<is_assignable<_T1&, _U1>,
2048 template<
typename _U1,
typename _U2>
2049 static constexpr bool __nothrow_assignable()
2051 return __and_<is_nothrow_assignable<_T1&, _U1>,
2055 template<
typename _U1,
typename _U2>
2056 static constexpr bool __nothrow_constructible()
2058 return __and_<is_nothrow_constructible<_T1, _U1>,
2062 static constexpr bool __nothrow_default_constructible()
2064 return __and_<is_nothrow_default_constructible<_T1>,
2068 template<
typename _U1>
2069 static constexpr bool __is_alloc_arg()
2073#undef __glibcxx_no_dangling_refs
2075#if __has_builtin(__reference_constructs_from_temporary) \
2076 && defined _GLIBCXX_DEBUG
2077# define __glibcxx_no_dangling_refs(_U1, _U2) \
2078 static_assert(!__reference_constructs_from_temporary(_T1, _U1) \
2079 && !__reference_constructs_from_temporary(_T2, _U2), \
2080 "std::tuple constructor creates a dangling reference")
2082# define __glibcxx_no_dangling_refs(_U1, _U2)
2087 template<
bool _Dummy =
true,
2088 _ImplicitDefaultCtor<_Dummy, _T1, _T2> =
true>
2091 noexcept(__nothrow_default_constructible())
2094 template<
bool _Dummy =
true,
2095 _ExplicitDefaultCtor<_Dummy, _T1, _T2> =
false>
2098 noexcept(__nothrow_default_constructible())
2101 template<
bool _Dummy =
true,
2102 _ImplicitCtor<_Dummy, const _T1&, const _T2&> =
true>
2104 tuple(
const _T1& __a1,
const _T2& __a2)
2105 noexcept(__nothrow_constructible<const _T1&, const _T2&>())
2106 : _Inherited(__a1, __a2) { }
2108 template<
bool _Dummy =
true,
2109 _ExplicitCtor<_Dummy, const _T1&, const _T2&> =
false>
2111 tuple(
const _T1& __a1,
const _T2& __a2)
2112 noexcept(__nothrow_constructible<const _T1&, const _T2&>())
2113 : _Inherited(__a1, __a2) { }
2115 template<
typename _U1,
typename _U2,
2116 _ImplicitCtor<!__is_alloc_arg<_U1>(), _U1, _U2> =
true>
2118 tuple(_U1&& __a1, _U2&& __a2)
2119 noexcept(__nothrow_constructible<_U1, _U2>())
2121 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2123 template<
typename _U1,
typename _U2,
2124 _ExplicitCtor<!__is_alloc_arg<_U1>(), _U1, _U2> =
false>
2126 tuple(_U1&& __a1, _U2&& __a2)
2127 noexcept(__nothrow_constructible<_U1, _U2>())
2129 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2131 constexpr tuple(
const tuple&) =
default;
2133 constexpr tuple(tuple&&) =
default;
2135 template<
typename _U1,
typename _U2,
2136 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
2138 tuple(
const tuple<_U1, _U2>& __in)
2139 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
2140 : _Inherited(
static_cast<const _Tuple_impl<0, _U1, _U2>&
>(__in))
2141 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2143 template<
typename _U1,
typename _U2,
2144 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
2146 tuple(
const tuple<_U1, _U2>& __in)
2147 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
2148 : _Inherited(
static_cast<const _Tuple_impl<0, _U1, _U2>&
>(__in))
2149 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2151 template<
typename _U1,
typename _U2,
2152 _ImplicitCtor<true, _U1, _U2> =
true>
2154 tuple(tuple<_U1, _U2>&& __in)
2155 noexcept(__nothrow_constructible<_U1, _U2>())
2156 : _Inherited(
static_cast<_Tuple_impl<0, _U1, _U2>&&
>(__in))
2157 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2159 template<
typename _U1,
typename _U2,
2160 _ExplicitCtor<true, _U1, _U2> =
false>
2162 tuple(tuple<_U1, _U2>&& __in)
2163 noexcept(__nothrow_constructible<_U1, _U2>())
2164 : _Inherited(
static_cast<_Tuple_impl<0, _U1, _U2>&&
>(__in))
2165 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2167 template<
typename _U1,
typename _U2,
2168 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
2171 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
2172 : _Inherited(__in.first, __in.second)
2173 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2175 template<
typename _U1,
typename _U2,
2176 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
2179 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
2180 : _Inherited(__in.first, __in.second)
2181 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2183 template<
typename _U1,
typename _U2,
2184 _ImplicitCtor<true, _U1, _U2> =
true>
2187 noexcept(__nothrow_constructible<_U1, _U2>())
2190 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2192 template<
typename _U1,
typename _U2,
2193 _ExplicitCtor<true, _U1, _U2> =
false>
2196 noexcept(__nothrow_constructible<_U1, _U2>())
2199 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2203 template<
typename _Alloc,
2204 _ImplicitDefaultCtor<is_object<_Alloc>::value, _T1, _T2> =
true>
2205 _GLIBCXX20_CONSTEXPR
2206 tuple(allocator_arg_t __tag,
const _Alloc& __a)
2207 : _Inherited(__tag, __a) { }
2209 template<
typename _Alloc,
2210 _ExplicitDefaultCtor<is_object<_Alloc>::value, _T1, _T2> =
false>
2211 _GLIBCXX20_CONSTEXPR
2213 tuple(allocator_arg_t __tag,
const _Alloc& __a)
2214 : _Inherited(__tag, __a) { }
2216 template<
typename _Alloc,
bool _Dummy =
true,
2217 _ImplicitCtor<_Dummy, const _T1&, const _T2&> =
true>
2218 _GLIBCXX20_CONSTEXPR
2219 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2220 const _T1& __a1,
const _T2& __a2)
2221 : _Inherited(__tag, __a, __a1, __a2) { }
2223 template<
typename _Alloc,
bool _Dummy =
true,
2224 _ExplicitCtor<_Dummy, const _T1&, const _T2&> =
false>
2226 _GLIBCXX20_CONSTEXPR
2227 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2228 const _T1& __a1,
const _T2& __a2)
2229 : _Inherited(__tag, __a, __a1, __a2) { }
2231 template<
typename _Alloc,
typename _U1,
typename _U2,
2232 _ImplicitCtor<true, _U1, _U2> =
true>
2233 _GLIBCXX20_CONSTEXPR
2234 tuple(allocator_arg_t __tag,
const _Alloc& __a, _U1&& __a1, _U2&& __a2)
2237 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2239 template<
typename _Alloc,
typename _U1,
typename _U2,
2240 _ExplicitCtor<true, _U1, _U2> =
false>
2242 _GLIBCXX20_CONSTEXPR
2243 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2244 _U1&& __a1, _U2&& __a2)
2247 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2249 template<
typename _Alloc>
2250 _GLIBCXX20_CONSTEXPR
2251 tuple(allocator_arg_t __tag,
const _Alloc& __a,
const tuple& __in)
2252 : _Inherited(__tag, __a,
static_cast<const _Inherited&
>(__in)) { }
2254 template<
typename _Alloc>
2255 _GLIBCXX20_CONSTEXPR
2256 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple&& __in)
2257 : _Inherited(__tag, __a,
static_cast<_Inherited&&
>(__in)) { }
2259 template<
typename _Alloc,
typename _U1,
typename _U2,
2260 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
2261 _GLIBCXX20_CONSTEXPR
2262 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2263 const tuple<_U1, _U2>& __in)
2264 : _Inherited(__tag, __a,
2265 static_cast<const _Tuple_impl<0, _U1, _U2>&
>(__in))
2266 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2268 template<
typename _Alloc,
typename _U1,
typename _U2,
2269 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
2271 _GLIBCXX20_CONSTEXPR
2272 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2273 const tuple<_U1, _U2>& __in)
2274 : _Inherited(__tag, __a,
2275 static_cast<const _Tuple_impl<0, _U1, _U2>&
>(__in))
2276 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2278 template<
typename _Alloc,
typename _U1,
typename _U2,
2279 _ImplicitCtor<true, _U1, _U2> =
true>
2280 _GLIBCXX20_CONSTEXPR
2281 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple<_U1, _U2>&& __in)
2282 : _Inherited(__tag, __a,
static_cast<_Tuple_impl<0, _U1, _U2>&&
>(__in))
2283 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2285 template<
typename _Alloc,
typename _U1,
typename _U2,
2286 _ExplicitCtor<true, _U1, _U2> =
false>
2288 _GLIBCXX20_CONSTEXPR
2289 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple<_U1, _U2>&& __in)
2290 : _Inherited(__tag, __a,
static_cast<_Tuple_impl<0, _U1, _U2>&&
>(__in))
2291 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2293 template<
typename _Alloc,
typename _U1,
typename _U2,
2294 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
2295 _GLIBCXX20_CONSTEXPR
2296 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2298 : _Inherited(__tag, __a, __in.first, __in.second)
2299 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2301 template<
typename _Alloc,
typename _U1,
typename _U2,
2302 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
2304 _GLIBCXX20_CONSTEXPR
2305 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2307 : _Inherited(__tag, __a, __in.first, __in.second)
2308 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2310 template<
typename _Alloc,
typename _U1,
typename _U2,
2311 _ImplicitCtor<true, _U1, _U2> =
true>
2312 _GLIBCXX20_CONSTEXPR
2313 tuple(allocator_arg_t __tag,
const _Alloc& __a,
pair<_U1, _U2>&& __in)
2316 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2318 template<
typename _Alloc,
typename _U1,
typename _U2,
2319 _ExplicitCtor<true, _U1, _U2> =
false>
2321 _GLIBCXX20_CONSTEXPR
2322 tuple(allocator_arg_t __tag,
const _Alloc& __a,
pair<_U1, _U2>&& __in)
2325 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2329 _GLIBCXX20_CONSTEXPR
2331 operator=(__conditional_t<__assignable<const _T1&, const _T2&>(),
2333 const __nonesuch&> __in)
2334 noexcept(__nothrow_assignable<const _T1&, const _T2&>())
2336 this->_M_assign(__in);
2340 _GLIBCXX20_CONSTEXPR
2342 operator=(__conditional_t<__assignable<_T1, _T2>(),
2345 noexcept(__nothrow_assignable<_T1, _T2>())
2351 template<
typename _U1,
typename _U2>
2352 _GLIBCXX20_CONSTEXPR
2353 __enable_if_t<__assignable<const _U1&, const _U2&>(), tuple&>
2354 operator=(
const tuple<_U1, _U2>& __in)
2355 noexcept(__nothrow_assignable<const _U1&, const _U2&>())
2357 this->_M_assign(__in);
2361 template<
typename _U1,
typename _U2>
2362 _GLIBCXX20_CONSTEXPR
2363 __enable_if_t<__assignable<_U1, _U2>(), tuple&>
2364 operator=(tuple<_U1, _U2>&& __in)
2365 noexcept(__nothrow_assignable<_U1, _U2>())
2371 template<
typename _U1,
typename _U2>
2372 _GLIBCXX20_CONSTEXPR
2373 __enable_if_t<__assignable<const _U1&, const _U2&>(), tuple&>
2375 noexcept(__nothrow_assignable<const _U1&, const _U2&>())
2377 this->_M_head(*
this) = __in.first;
2378 this->_M_tail(*this)._M_head(*
this) = __in.second;
2382 template<
typename _U1,
typename _U2>
2383 _GLIBCXX20_CONSTEXPR
2384 __enable_if_t<__assignable<_U1, _U2>(), tuple&>
2386 noexcept(__nothrow_assignable<_U1, _U2>())
2393 _GLIBCXX20_CONSTEXPR
2396 noexcept(__and_<__is_nothrow_swappable<_T1>,
2397 __is_nothrow_swappable<_T2>>::value)
2398 { _Inherited::_M_swap(__in); }