836 class tuple :
public _Tuple_impl<0, _Elements...>
838 using _Inherited = _Tuple_impl<0, _Elements...>;
840#if __cpp_concepts && __cpp_consteval && __cpp_conditional_explicit
841 template<
typename... _UTypes>
842 static consteval bool
845 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
851 template<
typename... _UTypes>
852 static consteval bool
853 __nothrow_constructible()
855 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
861 template<
typename... _UTypes>
862 static consteval bool
865 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
866 return __and_v<is_convertible<_UTypes, _Elements>...>;
873 template<
typename... _UTypes>
874 static consteval bool
875 __disambiguating_constraint()
877 if constexpr (
sizeof...(_Elements) !=
sizeof...(_UTypes))
879 else if constexpr (
sizeof...(_Elements) == 1)
881 using _U0 =
typename _Nth_type<0, _UTypes...>
::type;
882 return !is_same_v<remove_cvref_t<_U0>, tuple>;
884 else if constexpr (
sizeof...(_Elements) < 4)
886 using _U0 =
typename _Nth_type<0, _UTypes...>
::type;
887 if constexpr (!is_same_v<remove_cvref_t<_U0>, allocator_arg_t>)
891 using _T0 =
typename _Nth_type<0, _Elements...>
::type;
892 return is_same_v<remove_cvref_t<_T0>, allocator_arg_t>;
901 template<
typename _Tuple>
902 static consteval bool
905 if constexpr (
sizeof...(_Elements) != 1)
907 else if constexpr (is_same_v<remove_cvref_t<_Tuple>, tuple>)
911 using _Tp =
typename _Nth_type<0, _Elements...>
::type;
912 if constexpr (is_convertible_v<_Tuple, _Tp>)
914 else if constexpr (is_constructible_v<_Tp, _Tuple>)
920 template<
typename... _Up>
921 static consteval bool
924#if __has_builtin(__reference_constructs_from_temporary)
925 return (__reference_constructs_from_temporary(_Elements, _Up&&)
932#if __cpp_lib_tuple_like
935 template<
typename _UTuple>
936 static consteval bool
937 __dangles_from_tuple_like()
944 template<
typename _UTuple>
945 static consteval bool
946 __constructible_from_tuple_like()
953 template<
typename _UTuple>
954 static consteval bool
955 __convertible_from_tuple_like()
965 explicit(!(__is_implicitly_default_constructible_v<_Elements> && ...))
967 noexcept((is_nothrow_default_constructible_v<_Elements> && ...))
968 requires (is_default_constructible_v<_Elements> && ...)
973 template<
typename =
void>
974 constexpr explicit(!__convertible<
const _Elements&...>())
975 tuple(
const _Elements&... __elements)
976 noexcept(__nothrow_constructible<
const _Elements&...>())
977 requires (__constructible<const _Elements&...>())
978 : _Inherited(__elements...)
981 template<
typename... _UTypes>
982 requires (__disambiguating_constraint<_UTypes...>())
983 && (__constructible<_UTypes...>())
984 && (!__dangles<_UTypes...>())
985 constexpr explicit(!__convertible<_UTypes...>())
986 tuple(_UTypes&&... __u)
987 noexcept(__nothrow_constructible<_UTypes...>())
991 template<
typename... _UTypes>
992 requires (__disambiguating_constraint<_UTypes...>())
993 && (__constructible<_UTypes...>())
994 && (__dangles<_UTypes...>())
995 tuple(_UTypes&&...) =
delete;
997 constexpr tuple(
const tuple&) =
default;
999 constexpr tuple(tuple&&) =
default;
1001 template<
typename... _UTypes>
1002 requires (__constructible<
const _UTypes&...>())
1003 && (!__use_other_ctor<
const tuple<_UTypes...>&>())
1004 && (!__dangles<
const _UTypes&...>())
1005 constexpr explicit(!__convertible<const _UTypes&...>())
1006 tuple(
const tuple<_UTypes...>& __u)
1007 noexcept(__nothrow_constructible<
const _UTypes&...>())
1008 : _Inherited(
static_cast<const _Tuple_impl<0, _UTypes...
>&>(__u))
1011 template<
typename... _UTypes>
1012 requires (__constructible<
const _UTypes&...>())
1013 && (!__use_other_ctor<
const tuple<_UTypes...>&>())
1014 && (__dangles<
const _UTypes&...>())
1015 tuple(
const tuple<_UTypes...>&) =
delete;
1017 template<
typename... _UTypes>
1018 requires (__constructible<_UTypes...>())
1019 && (!__use_other_ctor<tuple<_UTypes...>>())
1020 && (!__dangles<_UTypes...>())
1021 constexpr explicit(!__convertible<_UTypes...>())
1022 tuple(tuple<_UTypes...>&& __u)
1023 noexcept(__nothrow_constructible<_UTypes...>())
1024 : _Inherited(
static_cast<_Tuple_impl<0, _UTypes...
>&&>(__u))
1027 template<
typename... _UTypes>
1028 requires (__constructible<_UTypes...>())
1029 && (!__use_other_ctor<tuple<_UTypes...>>())
1030 && (__dangles<_UTypes...>())
1031 tuple(tuple<_UTypes...>&&) =
delete;
1033#if __cpp_lib_ranges_zip
1034 template<
typename... _UTypes>
1035 requires (__constructible<_UTypes&...>())
1036 && (!__use_other_ctor<tuple<_UTypes...>&>())
1037 && (!__dangles<_UTypes&...>())
1038 constexpr explicit(!__convertible<_UTypes&...>())
1039 tuple(tuple<_UTypes...>& __u)
1040 noexcept(__nothrow_constructible<_UTypes&...>())
1041 : _Inherited(
static_cast<_Tuple_impl<0, _UTypes...
>&>(__u))
1044 template<
typename... _UTypes>
1045 requires (__constructible<_UTypes&...>())
1046 && (!__use_other_ctor<tuple<_UTypes...>&>())
1047 && (__dangles<_UTypes&...>())
1048 tuple(tuple<_UTypes...>&) =
delete;
1050 template<
typename... _UTypes>
1051 requires (__constructible<
const _UTypes...>())
1052 && (!__use_other_ctor<
const tuple<_UTypes...>>())
1053 && (!__dangles<
const _UTypes...>())
1054 constexpr explicit(!__convertible<const _UTypes...>())
1055 tuple(
const tuple<_UTypes...>&& __u)
1056 noexcept(__nothrow_constructible<
const _UTypes...>())
1057 : _Inherited(
static_cast<const _Tuple_impl<0, _UTypes...
>&&>(__u))
1060 template<
typename... _UTypes>
1061 requires (__constructible<
const _UTypes...>())
1062 && (!__use_other_ctor<
const tuple<_UTypes...>>())
1063 && (__dangles<
const _UTypes...>())
1064 tuple(
const tuple<_UTypes...>&&) =
delete;
1067 template<
typename _U1,
typename _U2>
1068 requires (
sizeof...(_Elements) == 2)
1069 && (__constructible<const _U1&, const _U2&>())
1070 && (!__dangles<const _U1&, const _U2&>())
1071 constexpr explicit(!__convertible<const _U1&, const _U2&>())
1073 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
1074 : _Inherited(__u.first, __u.second)
1077 template<
typename _U1,
typename _U2>
1078 requires (
sizeof...(_Elements) == 2)
1079 && (__constructible<const _U1&, const _U2&>())
1080 && (__dangles<const _U1&, const _U2&>())
1083 template<
typename _U1,
typename _U2>
1084 requires (
sizeof...(_Elements) == 2)
1085 && (__constructible<_U1, _U2>())
1086 && (!__dangles<_U1, _U2>())
1087 constexpr explicit(!__convertible<_U1, _U2>())
1089 noexcept(__nothrow_constructible<_U1, _U2>())
1094 template<
typename _U1,
typename _U2>
1095 requires (
sizeof...(_Elements) == 2)
1096 && (__constructible<_U1, _U2>())
1097 && (__dangles<_U1, _U2>())
1100#if __cpp_lib_ranges_zip
1101 template<
typename _U1,
typename _U2>
1102 requires (
sizeof...(_Elements) == 2)
1103 && (__constructible<_U1&, _U2&>())
1104 && (!__dangles<_U1&, _U2&>())
1105 constexpr explicit(!__convertible<_U1&, _U2&>())
1107 noexcept(__nothrow_constructible<_U1&, _U2&>())
1108 : _Inherited(__u.first, __u.second)
1111 template<
typename _U1,
typename _U2>
1112 requires (
sizeof...(_Elements) == 2)
1113 && (__constructible<_U1&, _U2&>())
1114 && (__dangles<_U1&, _U2&>())
1117 template<
typename _U1,
typename _U2>
1118 requires (
sizeof...(_Elements) == 2)
1119 && (__constructible<const _U1, const _U2>())
1120 && (!__dangles<const _U1, const _U2>())
1121 constexpr explicit(!__convertible<const _U1, const _U2>())
1123 noexcept(__nothrow_constructible<const _U1, const _U2>())
1128 template<
typename _U1,
typename _U2>
1129 requires (
sizeof...(_Elements) == 2)
1130 && (__constructible<const _U1, const _U2>())
1131 && (__dangles<const _U1, const _U2>())
1135#if __cpp_lib_tuple_like
1136 template<__eligible_tuple_like<tuple> _UTuple>
1137 requires (__constructible_from_tuple_like<_UTuple>())
1138 && (!__use_other_ctor<_UTuple>())
1139 && (!__dangles_from_tuple_like<_UTuple>())
1140 constexpr explicit(!__convertible_from_tuple_like<_UTuple>())
1141 tuple(_UTuple&& __u)
1142 : _Inherited(__tuple_like_tag_t{},
1147 template<__eligible_tuple_like<tuple> _UTuple>
1148 requires (__constructible_from_tuple_like<_UTuple>())
1149 && (!__use_other_ctor<_UTuple>())
1150 && (__dangles_from_tuple_like<_UTuple>())
1151 tuple(_UTuple&&) =
delete;
1156 template<
typename _Alloc>
1158 explicit(!(__is_implicitly_default_constructible_v<_Elements> && ...))
1159 tuple(allocator_arg_t __tag,
const _Alloc& __a)
1160 requires (is_default_constructible_v<_Elements> && ...)
1161 : _Inherited(__tag, __a)
1164 template<
typename _Alloc>
1165 constexpr explicit(!__convertible<
const _Elements&...>())
1166 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1167 const _Elements&... __elements)
1168 requires (__constructible<
const _Elements&...>())
1169 : _Inherited(__tag, __a, __elements...)
1172 template<
typename _Alloc,
typename... _UTypes>
1173 requires (__disambiguating_constraint<_UTypes...>())
1174 && (__constructible<_UTypes...>())
1175 && (!__dangles<_UTypes...>())
1176 constexpr explicit(!__convertible<_UTypes...>())
1177 tuple(allocator_arg_t __tag,
const _Alloc& __a, _UTypes&&... __u)
1181 template<
typename _Alloc,
typename... _UTypes>
1182 requires (__disambiguating_constraint<_UTypes...>())
1183 && (__constructible<_UTypes...>())
1184 && (__dangles<_UTypes...>())
1185 tuple(allocator_arg_t,
const _Alloc&, _UTypes&&...) =
delete;
1187 template<
typename _Alloc>
1189 tuple(allocator_arg_t __tag,
const _Alloc& __a,
const tuple& __u)
1190 : _Inherited(__tag, __a,
static_cast<const _Inherited&
>(__u))
1193 template<
typename _Alloc>
1194 requires (__constructible<_Elements...>())
1196 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple&& __u)
1197 : _Inherited(__tag, __a,
static_cast<_Inherited&&
>(__u))
1200 template<
typename _Alloc,
typename... _UTypes>
1201 requires (__constructible<
const _UTypes&...>())
1202 && (!__use_other_ctor<
const tuple<_UTypes...>&>())
1203 && (!__dangles<
const _UTypes&...>())
1204 constexpr explicit(!__convertible<const _UTypes&...>())
1205 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1206 const tuple<_UTypes...>& __u)
1207 : _Inherited(__tag, __a,
1208 static_cast<const _Tuple_impl<0, _UTypes...
>&>(__u))
1211 template<
typename _Alloc,
typename... _UTypes>
1212 requires (__constructible<
const _UTypes&...>())
1213 && (!__use_other_ctor<
const tuple<_UTypes...>&>())
1214 && (__dangles<
const _UTypes&...>())
1215 tuple(allocator_arg_t,
const _Alloc&,
const tuple<_UTypes...>&) =
delete;
1217 template<
typename _Alloc,
typename... _UTypes>
1218 requires (__constructible<_UTypes...>())
1219 && (!__use_other_ctor<tuple<_UTypes...>>())
1220 && (!__dangles<_UTypes...>())
1221 constexpr explicit(!__use_other_ctor<tuple<_UTypes...>>())
1222 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple<_UTypes...>&& __u)
1223 : _Inherited(__tag, __a,
static_cast<_Tuple_impl<0, _UTypes...
>&&>(__u))
1226 template<
typename _Alloc,
typename... _UTypes>
1227 requires (__constructible<_UTypes...>())
1228 && (!__use_other_ctor<tuple<_UTypes...>>())
1229 && (__dangles<_UTypes...>())
1230 tuple(allocator_arg_t,
const _Alloc&, tuple<_UTypes...>&&) =
delete;
1232#if __cpp_lib_ranges_zip
1233 template<
typename _Alloc,
typename... _UTypes>
1234 requires (__constructible<_UTypes&...>())
1235 && (!__use_other_ctor<tuple<_UTypes...>&>())
1236 && (!__dangles<_UTypes&...>())
1237 constexpr explicit(!__convertible<_UTypes&...>())
1238 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple<_UTypes...>& __u)
1239 : _Inherited(__tag, __a,
static_cast<_Tuple_impl<0, _UTypes...
>&>(__u))
1242 template<
typename _Alloc,
typename... _UTypes>
1243 requires (__constructible<_UTypes&...>())
1244 && (!__use_other_ctor<tuple<_UTypes...>&>())
1245 && (__dangles<_UTypes&...>())
1246 tuple(allocator_arg_t,
const _Alloc&, tuple<_UTypes...>&) =
delete;
1248 template<
typename _Alloc,
typename... _UTypes>
1249 requires (__constructible<
const _UTypes...>())
1250 && (!__use_other_ctor<
const tuple<_UTypes...>>())
1251 && (!__dangles<
const _UTypes...>())
1252 constexpr explicit(!__convertible<const _UTypes...>())
1253 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1254 const tuple<_UTypes...>&& __u)
1255 : _Inherited(__tag, __a,
1256 static_cast<const _Tuple_impl<0, _UTypes...
>&&>(__u))
1259 template<
typename _Alloc,
typename... _UTypes>
1260 requires (__constructible<
const _UTypes...>())
1261 && (!__use_other_ctor<
const tuple<_UTypes...>>())
1262 && (__dangles<
const _UTypes...>())
1263 tuple(allocator_arg_t,
const _Alloc&,
const tuple<_UTypes...>&&) =
delete;
1266 template<
typename _Alloc,
typename _U1,
typename _U2>
1267 requires (
sizeof...(_Elements) == 2)
1268 && (__constructible<const _U1&, const _U2&>())
1269 && (!__dangles<const _U1&, const _U2&>())
1270 constexpr explicit(!__convertible<const _U1&, const _U2&>())
1271 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1273 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
1274 : _Inherited(__tag, __a, __u.first, __u.second)
1277 template<
typename _Alloc,
typename _U1,
typename _U2>
1278 requires (
sizeof...(_Elements) == 2)
1279 && (__constructible<const _U1&, const _U2&>())
1280 && (__dangles<const _U1&, const _U2&>())
1281 tuple(allocator_arg_t,
const _Alloc&,
const pair<_U1, _U2>&) =
delete;
1283 template<
typename _Alloc,
typename _U1,
typename _U2>
1284 requires (
sizeof...(_Elements) == 2)
1285 && (__constructible<_U1, _U2>())
1286 && (!__dangles<_U1, _U2>())
1287 constexpr explicit(!__convertible<_U1, _U2>())
1288 tuple(allocator_arg_t __tag,
const _Alloc& __a,
pair<_U1, _U2>&& __u)
1289 noexcept(__nothrow_constructible<_U1, _U2>())
1293 template<
typename _Alloc,
typename _U1,
typename _U2>
1294 requires (
sizeof...(_Elements) == 2)
1295 && (__constructible<_U1, _U2>())
1296 && (__dangles<_U1, _U2>())
1297 tuple(allocator_arg_t,
const _Alloc&,
pair<_U1, _U2>&&) =
delete;
1299#if __cpp_lib_ranges_zip
1300 template<
typename _Alloc,
typename _U1,
typename _U2>
1301 requires (
sizeof...(_Elements) == 2)
1302 && (__constructible<_U1&, _U2&>())
1303 && (!__dangles<_U1&, _U2&>())
1304 constexpr explicit(!__convertible<_U1&, _U2&>())
1305 tuple(allocator_arg_t __tag,
const _Alloc& __a,
pair<_U1, _U2>& __u)
1306 noexcept(__nothrow_constructible<_U1&, _U2&>())
1307 : _Inherited(__tag, __a, __u.first, __u.second)
1310 template<
typename _Alloc,
typename _U1,
typename _U2>
1311 requires (
sizeof...(_Elements) == 2)
1312 && (__constructible<_U1&, _U2&>())
1313 && (__dangles<_U1&, _U2&>())
1316 template<
typename _Alloc,
typename _U1,
typename _U2>
1317 requires (
sizeof...(_Elements) == 2)
1318 && (__constructible<const _U1, const _U2>())
1319 && (!__dangles<const _U1, const _U2>())
1320 constexpr explicit(!__convertible<const _U1, const _U2>())
1321 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1323 noexcept(__nothrow_constructible<const _U1, const _U2>())
1327 template<
typename _Alloc,
typename _U1,
typename _U2>
1328 requires (
sizeof...(_Elements) == 2)
1329 && (__constructible<const _U1, const _U2>())
1330 && (__dangles<const _U1, const _U2>())
1331 tuple(allocator_arg_t,
const _Alloc&,
const pair<_U1, _U2>&&) =
delete;
1334#if __cpp_lib_tuple_like
1335 template<
typename _Alloc, __eligible_tuple_like<tuple> _UTuple>
1336 requires (__constructible_from_tuple_like<_UTuple>())
1337 && (!__use_other_ctor<_UTuple>())
1338 && (!__dangles_from_tuple_like<_UTuple>())
1339 constexpr explicit(!__convertible_from_tuple_like<_UTuple>())
1340 tuple(allocator_arg_t __tag,
const _Alloc& __a, _UTuple&& __u)
1341 : _Inherited(__tuple_like_tag_t{},
1346 template<
typename _Alloc, __eligible_tuple_like<tuple> _UTuple>
1347 requires (__constructible_from_tuple_like<_UTuple>())
1348 && (!__use_other_ctor<_UTuple>())
1349 && (__dangles_from_tuple_like<_UTuple>())
1350 tuple(allocator_arg_t,
const _Alloc&, _UTuple&&) =
delete;
1355 template<
bool _Cond>
1356 using _TCC = _TupleConstraints<_Cond, _Elements...>;
1359 template<
bool _Dummy>
1360 using _ImplicitDefaultCtor = __enable_if_t<
1361 _TCC<_Dummy>::__is_implicitly_default_constructible(),
1365 template<
bool _Dummy>
1366 using _ExplicitDefaultCtor = __enable_if_t<
1367 _TCC<_Dummy>::__is_explicitly_default_constructible(),
1371 template<
bool _Cond,
typename... _Args>
1372 using _ImplicitCtor = __enable_if_t<
1373 _TCC<_Cond>::template __is_implicitly_constructible<_Args...>(),
1377 template<
bool _Cond,
typename... _Args>
1378 using _ExplicitCtor = __enable_if_t<
1379 _TCC<_Cond>::template __is_explicitly_constructible<_Args...>(),
1383 template<
typename... _UElements>
1384 static constexpr bool __nothrow_constructible()
1387 __and_<is_nothrow_constructible<_Elements, _UElements>...>::value;
1391 template<
typename _Up>
1392 static constexpr bool __valid_args()
1394 return sizeof...(_Elements) == 1
1395 && !
is_same<tuple, __remove_cvref_t<_Up>>::value;
1399 template<
typename,
typename,
typename... _Tail>
1400 static constexpr bool __valid_args()
1401 {
return (
sizeof...(_Tail) + 2) ==
sizeof...(_Elements); }
1412 template<
typename _Tuple,
typename = tuple,
1413 typename = __remove_cvref_t<_Tuple>>
1414 struct _UseOtherCtor
1419 template<
typename _Tuple,
typename _Tp,
typename _Up>
1420 struct _UseOtherCtor<_Tuple, tuple<_Tp>, tuple<_Up>>
1421 : __or_<is_convertible<_Tuple, _Tp>, is_constructible<_Tp, _Tuple>>
::type
1425 template<
typename _Tuple,
typename _Tp>
1426 struct _UseOtherCtor<_Tuple, tuple<_Tp>, tuple<_Tp>>
1433 template<
typename _Tuple>
1434 static constexpr bool __use_other_ctor()
1435 {
return _UseOtherCtor<_Tuple>::value; }
1438#undef __glibcxx_no_dangling_refs
1439#if __has_builtin(__reference_constructs_from_temporary) \
1440 && defined _GLIBCXX_DEBUG
1442# if __cpp_fold_expressions
1443# define __glibcxx_dangling_refs(U) \
1444 (__reference_constructs_from_temporary(_Elements, U) || ...)
1446# define __glibcxx_dangling_refs(U) \
1447 __or_<__bool_constant<__reference_constructs_from_temporary(_Elements, U) \
1450# define __glibcxx_no_dangling_refs(U) \
1451 static_assert(!__glibcxx_dangling_refs(U), \
1452 "std::tuple constructor creates a dangling reference")
1454# define __glibcxx_no_dangling_refs(U)
1459 template<
typename _Dummy = void,
1460 _ImplicitDefaultCtor<is_void<_Dummy>::value> =
true>
1463 noexcept(__and_<is_nothrow_default_constructible<_Elements>...>::value)
1466 template<
typename _Dummy = void,
1467 _ExplicitDefaultCtor<is_void<_Dummy>::value> =
false>
1470 noexcept(__and_<is_nothrow_default_constructible<_Elements>...>::value)
1473 template<
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
1474 _ImplicitCtor<_NotEmpty, const _Elements&...> =
true>
1476 tuple(
const _Elements&... __elements)
1477 noexcept(__nothrow_constructible<
const _Elements&...>())
1478 : _Inherited(__elements...) { }
1480 template<
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
1481 _ExplicitCtor<_NotEmpty, const _Elements&...> =
false>
1483 tuple(
const _Elements&... __elements)
1484 noexcept(__nothrow_constructible<
const _Elements&...>())
1485 : _Inherited(__elements...) { }
1487 template<
typename... _UElements,
1488 bool _Valid = __valid_args<_UElements...>(),
1489 _ImplicitCtor<_Valid, _UElements...> =
true>
1491 tuple(_UElements&&... __elements)
1492 noexcept(__nothrow_constructible<_UElements...>())
1494 { __glibcxx_no_dangling_refs(_UElements&&); }
1496 template<
typename... _UElements,
1497 bool _Valid = __valid_args<_UElements...>(),
1498 _ExplicitCtor<_Valid, _UElements...> =
false>
1500 tuple(_UElements&&... __elements)
1501 noexcept(__nothrow_constructible<_UElements...>())
1503 { __glibcxx_no_dangling_refs(_UElements&&); }
1505 constexpr tuple(
const tuple&) =
default;
1507 constexpr tuple(tuple&&) =
default;
1509 template<
typename... _UElements,
1510 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1511 && !__use_other_ctor<
const tuple<_UElements...>&>(),
1512 _ImplicitCtor<_Valid,
const _UElements&...> =
true>
1514 tuple(
const tuple<_UElements...>& __in)
1515 noexcept(__nothrow_constructible<
const _UElements&...>())
1516 : _Inherited(
static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
1517 { __glibcxx_no_dangling_refs(
const _UElements&); }
1519 template<
typename... _UElements,
1520 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1521 && !__use_other_ctor<
const tuple<_UElements...>&>(),
1522 _ExplicitCtor<_Valid,
const _UElements&...> =
false>
1524 tuple(
const tuple<_UElements...>& __in)
1525 noexcept(__nothrow_constructible<
const _UElements&...>())
1526 : _Inherited(
static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
1527 { __glibcxx_no_dangling_refs(
const _UElements&); }
1529 template<
typename... _UElements,
1530 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1531 && !__use_other_ctor<tuple<_UElements...>&&>(),
1532 _ImplicitCtor<_Valid, _UElements...> =
true>
1534 tuple(tuple<_UElements...>&& __in)
1535 noexcept(__nothrow_constructible<_UElements...>())
1536 : _Inherited(
static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
1537 { __glibcxx_no_dangling_refs(_UElements&&); }
1539 template<
typename... _UElements,
1540 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1541 && !__use_other_ctor<tuple<_UElements...>&&>(),
1542 _ExplicitCtor<_Valid, _UElements...> =
false>
1544 tuple(tuple<_UElements...>&& __in)
1545 noexcept(__nothrow_constructible<_UElements...>())
1546 : _Inherited(
static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
1547 { __glibcxx_no_dangling_refs(_UElements&&); }
1551 template<
typename _Alloc,
1552 _ImplicitDefaultCtor<is_object<_Alloc>::value> =
true>
1553 _GLIBCXX20_CONSTEXPR
1554 tuple(allocator_arg_t __tag,
const _Alloc& __a)
1555 : _Inherited(__tag, __a) { }
1557 template<
typename _Alloc,
1558 _ExplicitDefaultCtor<is_object<_Alloc>::value> =
false>
1559 _GLIBCXX20_CONSTEXPR
1561 tuple(allocator_arg_t __tag,
const _Alloc& __a)
1562 : _Inherited(__tag, __a) { }
1564 template<
typename _Alloc,
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
1565 _ImplicitCtor<_NotEmpty, const _Elements&...> =
true>
1566 _GLIBCXX20_CONSTEXPR
1567 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1568 const _Elements&... __elements)
1569 : _Inherited(__tag, __a, __elements...) { }
1571 template<
typename _Alloc,
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
1572 _ExplicitCtor<_NotEmpty, const _Elements&...> =
false>
1573 _GLIBCXX20_CONSTEXPR
1575 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1576 const _Elements&... __elements)
1577 : _Inherited(__tag, __a, __elements...) { }
1579 template<
typename _Alloc,
typename... _UElements,
1580 bool _Valid = __valid_args<_UElements...>(),
1581 _ImplicitCtor<_Valid, _UElements...> =
true>
1582 _GLIBCXX20_CONSTEXPR
1583 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1584 _UElements&&... __elements)
1586 { __glibcxx_no_dangling_refs(_UElements&&); }
1588 template<
typename _Alloc,
typename... _UElements,
1589 bool _Valid = __valid_args<_UElements...>(),
1590 _ExplicitCtor<_Valid, _UElements...> =
false>
1591 _GLIBCXX20_CONSTEXPR
1593 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1594 _UElements&&... __elements)
1596 { __glibcxx_no_dangling_refs(_UElements&&); }
1598 template<
typename _Alloc>
1599 _GLIBCXX20_CONSTEXPR
1600 tuple(allocator_arg_t __tag,
const _Alloc& __a,
const tuple& __in)
1601 : _Inherited(__tag, __a,
static_cast<const _Inherited&
>(__in)) { }
1603 template<
typename _Alloc>
1604 _GLIBCXX20_CONSTEXPR
1605 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple&& __in)
1606 : _Inherited(__tag, __a,
static_cast<_Inherited&&
>(__in)) { }
1608 template<
typename _Alloc,
typename... _UElements,
1609 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1610 && !__use_other_ctor<
const tuple<_UElements...>&>(),
1611 _ImplicitCtor<_Valid,
const _UElements&...> =
true>
1612 _GLIBCXX20_CONSTEXPR
1613 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1614 const tuple<_UElements...>& __in)
1615 : _Inherited(__tag, __a,
1616 static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
1617 { __glibcxx_no_dangling_refs(
const _UElements&); }
1619 template<
typename _Alloc,
typename... _UElements,
1620 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1621 && !__use_other_ctor<
const tuple<_UElements...>&>(),
1622 _ExplicitCtor<_Valid,
const _UElements&...> =
false>
1623 _GLIBCXX20_CONSTEXPR
1625 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1626 const tuple<_UElements...>& __in)
1627 : _Inherited(__tag, __a,
1628 static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
1629 { __glibcxx_no_dangling_refs(
const _UElements&); }
1631 template<
typename _Alloc,
typename... _UElements,
1632 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1633 && !__use_other_ctor<tuple<_UElements...>&&>(),
1634 _ImplicitCtor<_Valid, _UElements...> =
true>
1635 _GLIBCXX20_CONSTEXPR
1636 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1637 tuple<_UElements...>&& __in)
1638 : _Inherited(__tag, __a,
1639 static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
1640 { __glibcxx_no_dangling_refs(_UElements&&); }
1642 template<
typename _Alloc,
typename... _UElements,
1643 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1644 && !__use_other_ctor<tuple<_UElements...>&&>(),
1645 _ExplicitCtor<_Valid, _UElements...> =
false>
1646 _GLIBCXX20_CONSTEXPR
1648 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1649 tuple<_UElements...>&& __in)
1650 : _Inherited(__tag, __a,
1651 static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
1652 { __glibcxx_no_dangling_refs(_UElements&&); }
1657#if __cpp_concepts && __cpp_consteval
1659 template<
typename... _UTypes>
1660 static consteval bool
1663 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
1669 template<
typename... _UTypes>
1670 static consteval bool
1671 __nothrow_assignable()
1673 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
1679#if __cpp_lib_ranges_zip
1680 template<
typename... _UTypes>
1681 static consteval bool
1682 __const_assignable()
1684 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
1691#if __cpp_lib_tuple_like
1692 template<
typename _UTuple>
1693 static consteval bool
1694 __assignable_from_tuple_like()
1701 template<
typename _UTuple>
1702 static consteval bool
1703 __const_assignable_from_tuple_like()
1713 tuple& operator=(
const tuple& __u) =
delete;
1716 operator=(
const tuple& __u)
1717 noexcept(__nothrow_assignable<
const _Elements&...>())
1718 requires (__assignable<const _Elements&...>())
1720 this->_M_assign(__u);
1725 operator=(tuple&& __u)
1726 noexcept(__nothrow_assignable<_Elements...>())
1727 requires (__assignable<_Elements...>())
1733 template<
typename... _UTypes>
1734 requires (__assignable<
const _UTypes&...>())
1736 operator=(
const tuple<_UTypes...>& __u)
1737 noexcept(__nothrow_assignable<
const _UTypes&...>())
1739 this->_M_assign(__u);
1743 template<
typename... _UTypes>
1744 requires (__assignable<_UTypes...>())
1746 operator=(tuple<_UTypes...>&& __u)
1747 noexcept(__nothrow_assignable<_UTypes...>())
1753#if __cpp_lib_ranges_zip
1754 constexpr const tuple&
1755 operator=(
const tuple& __u)
const
1756 requires (__const_assignable<
const _Elements&...>())
1758 this->_M_assign(__u);
1762 constexpr const tuple&
1763 operator=(tuple&& __u)
const
1764 requires (__const_assignable<_Elements...>())
1770 template<
typename... _UTypes>
1771 constexpr const tuple&
1772 operator=(
const tuple<_UTypes...>& __u)
const
1773 requires (__const_assignable<
const _UTypes&...>())
1775 this->_M_assign(__u);
1779 template<
typename... _UTypes>
1780 constexpr const tuple&
1781 operator=(tuple<_UTypes...>&& __u)
const
1782 requires (__const_assignable<_UTypes...>())
1789 template<
typename _U1,
typename _U2>
1790 requires (__assignable<const _U1&, const _U2&>())
1793 noexcept(__nothrow_assignable<const _U1&, const _U2&>())
1795 this->_M_head(*
this) = __u.first;
1796 this->_M_tail(*this)._M_head(*
this) = __u.second;
1800 template<
typename _U1,
typename _U2>
1801 requires (__assignable<_U1, _U2>())
1804 noexcept(__nothrow_assignable<_U1, _U2>())
1811#if __cpp_lib_ranges_zip
1812 template<
typename _U1,
typename _U2>
1813 requires (__const_assignable<const _U1&, const _U2>())
1814 constexpr const tuple&
1817 this->_M_head(*
this) = __u.first;
1818 this->_M_tail(*this)._M_head(*
this) = __u.second;
1822 template<
typename _U1,
typename _U2>
1823 requires (__const_assignable<_U1, _U2>())
1824 constexpr const tuple&
1833#if __cpp_lib_tuple_like
1834 template<__eligible_tuple_like<tuple> _UTuple>
1835 requires (__assignable_from_tuple_like<_UTuple>())
1837 operator=(_UTuple&& __u)
1843 template<__eligible_tuple_like<tuple> _UTuple>
1844 requires (__const_assignable_from_tuple_like<_UTuple>())
1845 constexpr const tuple&
1846 operator=(_UTuple&& __u)
const
1852 template<__tuple_like _UTuple>
1853 requires (!__is_tuple_v<_UTuple>)
1854 friend constexpr bool
1855 operator==(
const tuple& __t,
const _UTuple& __u)
1857 static_assert(
sizeof...(_Elements) == tuple_size_v<_UTuple>,
1858 "tuple objects can only be compared if they have equal sizes.");
1860 return (
bool(std::get<_Is>(__t) == std::get<_Is>(__u))
1865 template<__tuple_like _UTuple,
1867 struct __tuple_like_common_comparison_category;
1869 template<__tuple_like _UTuple,
size_t... _Is>
1871 {
typename void_t<__detail::__synth3way_t<_Elements, tuple_element_t<_Is, _UTuple>>...>; }
1872 struct __tuple_like_common_comparison_category<_UTuple,
index_sequence<_Is...>>
1874 using type = common_comparison_category_t
1875 <__detail::__synth3way_t<_Elements, tuple_element_t<_Is, _UTuple>>...>;
1878 template<__tuple_like _UTuple>
1879 requires (!__is_tuple_v<_UTuple>)
1880 friend constexpr typename __tuple_like_common_comparison_category<_UTuple>::type
1881 operator<=>(
const tuple& __t,
const _UTuple& __u)
1883 using _Cat =
typename __tuple_like_common_comparison_category<_UTuple>::type;
1891 template<
typename... _UElements>
1893 __enable_if_t<
sizeof...(_UElements) ==
sizeof...(_Elements),
bool>
1895 {
return __and_<is_assignable<_Elements&, _UElements>...>::value; }
1898 template<
typename... _UElements>
1899 static constexpr bool __nothrow_assignable()
1902 __and_<is_nothrow_assignable<_Elements&, _UElements>...>::value;
1907 _GLIBCXX20_CONSTEXPR
1909 operator=(__conditional_t<__assignable<const _Elements&...>(),
1911 const __nonesuch&> __in)
1912 noexcept(__nothrow_assignable<
const _Elements&...>())
1914 this->_M_assign(__in);
1918 _GLIBCXX20_CONSTEXPR
1920 operator=(__conditional_t<__assignable<_Elements...>(),
1923 noexcept(__nothrow_assignable<_Elements...>())
1929 template<
typename... _UElements>
1930 _GLIBCXX20_CONSTEXPR
1931 __enable_if_t<__assignable<
const _UElements&...>(), tuple&>
1932 operator=(
const tuple<_UElements...>& __in)
1933 noexcept(__nothrow_assignable<
const _UElements&...>())
1935 this->_M_assign(__in);
1939 template<
typename... _UElements>
1940 _GLIBCXX20_CONSTEXPR
1941 __enable_if_t<__assignable<_UElements...>(), tuple&>
1942 operator=(tuple<_UElements...>&& __in)
1943 noexcept(__nothrow_assignable<_UElements...>())
1951 _GLIBCXX20_CONSTEXPR
1954 noexcept(__and_<__is_nothrow_swappable<_Elements>...>::value)
1955 { _Inherited::_M_swap(__in); }
1957#if __cpp_lib_ranges_zip
1965 swap(
const tuple& __in)
const
1966 noexcept(__and_v<__is_nothrow_swappable<const _Elements>...>)
1967 requires (is_swappable_v<const _Elements> && ...)
1968 { _Inherited::_M_swap(__in); }
2011 class tuple<_T1, _T2> :
public _Tuple_impl<0, _T1, _T2>
2013 typedef _Tuple_impl<0, _T1, _T2> _Inherited;
2016 template<
bool _Dummy,
typename _U1,
typename _U2>
2017 using _ImplicitDefaultCtor = __enable_if_t<
2018 _TupleConstraints<_Dummy, _U1, _U2>::
2019 __is_implicitly_default_constructible(),
2023 template<
bool _Dummy,
typename _U1,
typename _U2>
2024 using _ExplicitDefaultCtor = __enable_if_t<
2025 _TupleConstraints<_Dummy, _U1, _U2>::
2026 __is_explicitly_default_constructible(),
2029 template<
bool _Dummy>
2030 using _TCC = _TupleConstraints<_Dummy, _T1, _T2>;
2033 template<
bool _Cond,
typename _U1,
typename _U2>
2034 using _ImplicitCtor = __enable_if_t<
2035 _TCC<_Cond>::template __is_implicitly_constructible<_U1, _U2>(),
2039 template<
bool _Cond,
typename _U1,
typename _U2>
2040 using _ExplicitCtor = __enable_if_t<
2041 _TCC<_Cond>::template __is_explicitly_constructible<_U1, _U2>(),
2044 template<
typename _U1,
typename _U2>
2045 static constexpr bool __assignable()
2047 return __and_<is_assignable<_T1&, _U1>,
2051 template<
typename _U1,
typename _U2>
2052 static constexpr bool __nothrow_assignable()
2054 return __and_<is_nothrow_assignable<_T1&, _U1>,
2058 template<
typename _U1,
typename _U2>
2059 static constexpr bool __nothrow_constructible()
2061 return __and_<is_nothrow_constructible<_T1, _U1>,
2065 static constexpr bool __nothrow_default_constructible()
2067 return __and_<is_nothrow_default_constructible<_T1>,
2071 template<
typename _U1>
2072 static constexpr bool __is_alloc_arg()
2076#undef __glibcxx_no_dangling_refs
2078#if __has_builtin(__reference_constructs_from_temporary) \
2079 && defined _GLIBCXX_DEBUG
2080# define __glibcxx_no_dangling_refs(_U1, _U2) \
2081 static_assert(!__reference_constructs_from_temporary(_T1, _U1) \
2082 && !__reference_constructs_from_temporary(_T2, _U2), \
2083 "std::tuple constructor creates a dangling reference")
2085# define __glibcxx_no_dangling_refs(_U1, _U2)
2090 template<
bool _Dummy =
true,
2091 _ImplicitDefaultCtor<_Dummy, _T1, _T2> =
true>
2094 noexcept(__nothrow_default_constructible())
2097 template<
bool _Dummy =
true,
2098 _ExplicitDefaultCtor<_Dummy, _T1, _T2> =
false>
2101 noexcept(__nothrow_default_constructible())
2104 template<
bool _Dummy =
true,
2105 _ImplicitCtor<_Dummy, const _T1&, const _T2&> =
true>
2107 tuple(
const _T1& __a1,
const _T2& __a2)
2108 noexcept(__nothrow_constructible<const _T1&, const _T2&>())
2109 : _Inherited(__a1, __a2) { }
2111 template<
bool _Dummy =
true,
2112 _ExplicitCtor<_Dummy, const _T1&, const _T2&> =
false>
2114 tuple(
const _T1& __a1,
const _T2& __a2)
2115 noexcept(__nothrow_constructible<const _T1&, const _T2&>())
2116 : _Inherited(__a1, __a2) { }
2118 template<
typename _U1,
typename _U2,
2119 _ImplicitCtor<!__is_alloc_arg<_U1>(), _U1, _U2> =
true>
2121 tuple(_U1&& __a1, _U2&& __a2)
2122 noexcept(__nothrow_constructible<_U1, _U2>())
2124 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2126 template<
typename _U1,
typename _U2,
2127 _ExplicitCtor<!__is_alloc_arg<_U1>(), _U1, _U2> =
false>
2129 tuple(_U1&& __a1, _U2&& __a2)
2130 noexcept(__nothrow_constructible<_U1, _U2>())
2132 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2134 constexpr tuple(
const tuple&) =
default;
2136 constexpr tuple(tuple&&) =
default;
2138 template<
typename _U1,
typename _U2,
2139 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
2141 tuple(
const tuple<_U1, _U2>& __in)
2142 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
2143 : _Inherited(
static_cast<const _Tuple_impl<0, _U1, _U2>&
>(__in))
2144 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2146 template<
typename _U1,
typename _U2,
2147 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
2149 tuple(
const tuple<_U1, _U2>& __in)
2150 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
2151 : _Inherited(
static_cast<const _Tuple_impl<0, _U1, _U2>&
>(__in))
2152 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2154 template<
typename _U1,
typename _U2,
2155 _ImplicitCtor<true, _U1, _U2> =
true>
2157 tuple(tuple<_U1, _U2>&& __in)
2158 noexcept(__nothrow_constructible<_U1, _U2>())
2159 : _Inherited(
static_cast<_Tuple_impl<0, _U1, _U2>&&
>(__in))
2160 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2162 template<
typename _U1,
typename _U2,
2163 _ExplicitCtor<true, _U1, _U2> =
false>
2165 tuple(tuple<_U1, _U2>&& __in)
2166 noexcept(__nothrow_constructible<_U1, _U2>())
2167 : _Inherited(
static_cast<_Tuple_impl<0, _U1, _U2>&&
>(__in))
2168 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2170 template<
typename _U1,
typename _U2,
2171 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
2174 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
2175 : _Inherited(__in.first, __in.second)
2176 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2178 template<
typename _U1,
typename _U2,
2179 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
2182 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
2183 : _Inherited(__in.first, __in.second)
2184 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2186 template<
typename _U1,
typename _U2,
2187 _ImplicitCtor<true, _U1, _U2> =
true>
2190 noexcept(__nothrow_constructible<_U1, _U2>())
2193 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2195 template<
typename _U1,
typename _U2,
2196 _ExplicitCtor<true, _U1, _U2> =
false>
2199 noexcept(__nothrow_constructible<_U1, _U2>())
2202 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2206 template<
typename _Alloc,
2207 _ImplicitDefaultCtor<is_object<_Alloc>::value, _T1, _T2> =
true>
2208 _GLIBCXX20_CONSTEXPR
2209 tuple(allocator_arg_t __tag,
const _Alloc& __a)
2210 : _Inherited(__tag, __a) { }
2212 template<
typename _Alloc,
2213 _ExplicitDefaultCtor<is_object<_Alloc>::value, _T1, _T2> =
false>
2214 _GLIBCXX20_CONSTEXPR
2216 tuple(allocator_arg_t __tag,
const _Alloc& __a)
2217 : _Inherited(__tag, __a) { }
2219 template<
typename _Alloc,
bool _Dummy =
true,
2220 _ImplicitCtor<_Dummy, const _T1&, const _T2&> =
true>
2221 _GLIBCXX20_CONSTEXPR
2222 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2223 const _T1& __a1,
const _T2& __a2)
2224 : _Inherited(__tag, __a, __a1, __a2) { }
2226 template<
typename _Alloc,
bool _Dummy =
true,
2227 _ExplicitCtor<_Dummy, const _T1&, const _T2&> =
false>
2229 _GLIBCXX20_CONSTEXPR
2230 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2231 const _T1& __a1,
const _T2& __a2)
2232 : _Inherited(__tag, __a, __a1, __a2) { }
2234 template<
typename _Alloc,
typename _U1,
typename _U2,
2235 _ImplicitCtor<true, _U1, _U2> =
true>
2236 _GLIBCXX20_CONSTEXPR
2237 tuple(allocator_arg_t __tag,
const _Alloc& __a, _U1&& __a1, _U2&& __a2)
2240 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2242 template<
typename _Alloc,
typename _U1,
typename _U2,
2243 _ExplicitCtor<true, _U1, _U2> =
false>
2245 _GLIBCXX20_CONSTEXPR
2246 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2247 _U1&& __a1, _U2&& __a2)
2250 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2252 template<
typename _Alloc>
2253 _GLIBCXX20_CONSTEXPR
2254 tuple(allocator_arg_t __tag,
const _Alloc& __a,
const tuple& __in)
2255 : _Inherited(__tag, __a,
static_cast<const _Inherited&
>(__in)) { }
2257 template<
typename _Alloc>
2258 _GLIBCXX20_CONSTEXPR
2259 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple&& __in)
2260 : _Inherited(__tag, __a,
static_cast<_Inherited&&
>(__in)) { }
2262 template<
typename _Alloc,
typename _U1,
typename _U2,
2263 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
2264 _GLIBCXX20_CONSTEXPR
2265 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2266 const tuple<_U1, _U2>& __in)
2267 : _Inherited(__tag, __a,
2268 static_cast<const _Tuple_impl<0, _U1, _U2>&
>(__in))
2269 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2271 template<
typename _Alloc,
typename _U1,
typename _U2,
2272 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
2274 _GLIBCXX20_CONSTEXPR
2275 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2276 const tuple<_U1, _U2>& __in)
2277 : _Inherited(__tag, __a,
2278 static_cast<const _Tuple_impl<0, _U1, _U2>&
>(__in))
2279 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2281 template<
typename _Alloc,
typename _U1,
typename _U2,
2282 _ImplicitCtor<true, _U1, _U2> =
true>
2283 _GLIBCXX20_CONSTEXPR
2284 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple<_U1, _U2>&& __in)
2285 : _Inherited(__tag, __a,
static_cast<_Tuple_impl<0, _U1, _U2>&&
>(__in))
2286 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2288 template<
typename _Alloc,
typename _U1,
typename _U2,
2289 _ExplicitCtor<true, _U1, _U2> =
false>
2291 _GLIBCXX20_CONSTEXPR
2292 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple<_U1, _U2>&& __in)
2293 : _Inherited(__tag, __a,
static_cast<_Tuple_impl<0, _U1, _U2>&&
>(__in))
2294 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2296 template<
typename _Alloc,
typename _U1,
typename _U2,
2297 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
2298 _GLIBCXX20_CONSTEXPR
2299 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2301 : _Inherited(__tag, __a, __in.first, __in.second)
2302 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2304 template<
typename _Alloc,
typename _U1,
typename _U2,
2305 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
2307 _GLIBCXX20_CONSTEXPR
2308 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2310 : _Inherited(__tag, __a, __in.first, __in.second)
2311 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2313 template<
typename _Alloc,
typename _U1,
typename _U2,
2314 _ImplicitCtor<true, _U1, _U2> =
true>
2315 _GLIBCXX20_CONSTEXPR
2316 tuple(allocator_arg_t __tag,
const _Alloc& __a,
pair<_U1, _U2>&& __in)
2319 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2321 template<
typename _Alloc,
typename _U1,
typename _U2,
2322 _ExplicitCtor<true, _U1, _U2> =
false>
2324 _GLIBCXX20_CONSTEXPR
2325 tuple(allocator_arg_t __tag,
const _Alloc& __a,
pair<_U1, _U2>&& __in)
2328 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2332 _GLIBCXX20_CONSTEXPR
2334 operator=(__conditional_t<__assignable<const _T1&, const _T2&>(),
2336 const __nonesuch&> __in)
2337 noexcept(__nothrow_assignable<const _T1&, const _T2&>())
2339 this->_M_assign(__in);
2343 _GLIBCXX20_CONSTEXPR
2345 operator=(__conditional_t<__assignable<_T1, _T2>(),
2348 noexcept(__nothrow_assignable<_T1, _T2>())
2354 template<
typename _U1,
typename _U2>
2355 _GLIBCXX20_CONSTEXPR
2356 __enable_if_t<__assignable<const _U1&, const _U2&>(), tuple&>
2357 operator=(
const tuple<_U1, _U2>& __in)
2358 noexcept(__nothrow_assignable<const _U1&, const _U2&>())
2360 this->_M_assign(__in);
2364 template<
typename _U1,
typename _U2>
2365 _GLIBCXX20_CONSTEXPR
2366 __enable_if_t<__assignable<_U1, _U2>(), tuple&>
2367 operator=(tuple<_U1, _U2>&& __in)
2368 noexcept(__nothrow_assignable<_U1, _U2>())
2374 template<
typename _U1,
typename _U2>
2375 _GLIBCXX20_CONSTEXPR
2376 __enable_if_t<__assignable<const _U1&, const _U2&>(), tuple&>
2378 noexcept(__nothrow_assignable<const _U1&, const _U2&>())
2380 this->_M_head(*
this) = __in.first;
2381 this->_M_tail(*this)._M_head(*
this) = __in.second;
2385 template<
typename _U1,
typename _U2>
2386 _GLIBCXX20_CONSTEXPR
2387 __enable_if_t<__assignable<_U1, _U2>(), tuple&>
2389 noexcept(__nothrow_assignable<_U1, _U2>())
2396 _GLIBCXX20_CONSTEXPR
2399 noexcept(__and_<__is_nothrow_swappable<_T1>,
2400 __is_nothrow_swappable<_T2>>::value)
2401 { _Inherited::_M_swap(__in); }