794 class tuple :
public _Tuple_impl<0, _Elements...>
796 using _Inherited = _Tuple_impl<0, _Elements...>;
798#if __cpp_concepts && __cpp_consteval && __cpp_conditional_explicit
799 template<
typename... _UTypes>
800 static consteval bool
803 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
809 template<
typename... _UTypes>
810 static consteval bool
811 __nothrow_constructible()
813 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
819 template<
typename... _UTypes>
820 static consteval bool
823 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
824 return __and_v<is_convertible<_UTypes, _Elements>...>;
831 template<
typename... _UTypes>
832 static consteval bool
833 __disambiguating_constraint()
835 if constexpr (
sizeof...(_Elements) !=
sizeof...(_UTypes))
837 else if constexpr (
sizeof...(_Elements) == 1)
839 using _U0 =
typename _Nth_type<0, _UTypes...>::type;
840 return !is_same_v<remove_cvref_t<_U0>, tuple>;
842 else if constexpr (
sizeof...(_Elements) < 4)
844 using _U0 =
typename _Nth_type<0, _UTypes...>::type;
845 if constexpr (!is_same_v<remove_cvref_t<_U0>, allocator_arg_t>)
849 using _T0 =
typename _Nth_type<0, _Elements...>::type;
850 return is_same_v<remove_cvref_t<_T0>, allocator_arg_t>;
859 template<
typename _Tuple>
860 static consteval bool
863 if constexpr (
sizeof...(_Elements) != 1)
865 else if constexpr (is_same_v<remove_cvref_t<_Tuple>, tuple>)
869 using _Tp =
typename _Nth_type<0, _Elements...>::type;
870 if constexpr (is_convertible_v<_Tuple, _Tp>)
872 else if constexpr (is_constructible_v<_Tp, _Tuple>)
878 template<
typename... _Up>
879 static consteval bool
882#if __has_builtin(__reference_constructs_from_temporary)
883 return (__reference_constructs_from_temporary(_Elements, _Up&&)
890#if __cpp_lib_tuple_like
893 template<
typename _UTuple>
894 static consteval bool
895 __dangles_from_tuple_like()
902 template<
typename _UTuple>
903 static consteval bool
904 __constructible_from_tuple_like()
911 template<
typename _UTuple>
912 static consteval bool
913 __convertible_from_tuple_like()
923 explicit(!(__is_implicitly_default_constructible_v<_Elements> && ...))
925 noexcept((is_nothrow_default_constructible_v<_Elements> && ...))
926 requires (is_default_constructible_v<_Elements> && ...)
931 template<
typename =
void>
932 constexpr explicit(!__convertible<
const _Elements&...>())
933 tuple(
const type_identity_t<_Elements>&... __elements)
934 noexcept(__nothrow_constructible<
const _Elements&...>())
935 requires (__constructible<const _Elements&...>())
936 : _Inherited(__elements...)
939 template<
typename... _UTypes>
940 requires (__disambiguating_constraint<_UTypes...>())
941 && (__constructible<_UTypes...>())
942 && (!__dangles<_UTypes...>())
943 constexpr explicit(!__convertible<_UTypes...>())
944 tuple(_UTypes&&... __u)
945 noexcept(__nothrow_constructible<_UTypes...>())
949 template<
typename... _UTypes>
950 requires (__disambiguating_constraint<_UTypes...>())
951 && (__constructible<_UTypes...>())
952 && (__dangles<_UTypes...>())
953 tuple(_UTypes&&...) =
delete;
955 constexpr tuple(
const tuple&) =
default;
957 constexpr tuple(tuple&&) =
default;
959 template<
typename... _UTypes>
960 requires (__constructible<
const _UTypes&...>())
961 && (!__use_other_ctor<
const tuple<_UTypes...>&>())
962 && (!__dangles<
const _UTypes&...>())
963 constexpr explicit(!__convertible<const _UTypes&...>())
964 tuple(
const tuple<_UTypes...>& __u)
965 noexcept(__nothrow_constructible<
const _UTypes&...>())
966 : _Inherited(
static_cast<const _Tuple_impl<0, _UTypes...
>&>(__u))
969 template<
typename... _UTypes>
970 requires (__constructible<
const _UTypes&...>())
971 && (!__use_other_ctor<
const tuple<_UTypes...>&>())
972 && (__dangles<
const _UTypes&...>())
973 tuple(
const tuple<_UTypes...>&) =
delete;
975 template<
typename... _UTypes>
976 requires (__constructible<_UTypes...>())
977 && (!__use_other_ctor<tuple<_UTypes...>>())
978 && (!__dangles<_UTypes...>())
979 constexpr explicit(!__convertible<_UTypes...>())
980 tuple(tuple<_UTypes...>&& __u)
981 noexcept(__nothrow_constructible<_UTypes...>())
982 : _Inherited(
static_cast<_Tuple_impl<0, _UTypes...
>&&>(__u))
985 template<
typename... _UTypes>
986 requires (__constructible<_UTypes...>())
987 && (!__use_other_ctor<tuple<_UTypes...>>())
988 && (__dangles<_UTypes...>())
989 tuple(tuple<_UTypes...>&&) =
delete;
991#if __cpp_lib_ranges_zip
992 template<
typename... _UTypes>
993 requires (__constructible<_UTypes&...>())
994 && (!__use_other_ctor<tuple<_UTypes...>&>())
995 && (!__dangles<_UTypes&...>())
996 constexpr explicit(!__convertible<_UTypes&...>())
997 tuple(tuple<_UTypes...>& __u)
998 noexcept(__nothrow_constructible<_UTypes&...>())
999 : _Inherited(
static_cast<_Tuple_impl<0, _UTypes...
>&>(__u))
1002 template<
typename... _UTypes>
1003 requires (__constructible<_UTypes&...>())
1004 && (!__use_other_ctor<tuple<_UTypes...>&>())
1005 && (__dangles<_UTypes&...>())
1006 tuple(tuple<_UTypes...>&) =
delete;
1008 template<
typename... _UTypes>
1009 requires (__constructible<
const _UTypes...>())
1010 && (!__use_other_ctor<
const tuple<_UTypes...>>())
1011 && (!__dangles<
const _UTypes...>())
1012 constexpr explicit(!__convertible<const _UTypes...>())
1013 tuple(
const tuple<_UTypes...>&& __u)
1014 noexcept(__nothrow_constructible<
const _UTypes...>())
1015 : _Inherited(
static_cast<const _Tuple_impl<0, _UTypes...
>&&>(__u))
1018 template<
typename... _UTypes>
1019 requires (__constructible<
const _UTypes...>())
1020 && (!__use_other_ctor<
const tuple<_UTypes...>>())
1021 && (__dangles<
const _UTypes...>())
1022 tuple(
const tuple<_UTypes...>&&) =
delete;
1025 template<
typename _U1,
typename _U2>
1026 requires (
sizeof...(_Elements) == 2)
1027 && (__constructible<const _U1&, const _U2&>())
1028 && (!__dangles<const _U1&, const _U2&>())
1029 constexpr explicit(!__convertible<const _U1&, const _U2&>())
1031 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
1032 : _Inherited(__u.first, __u.second)
1035 template<
typename _U1,
typename _U2>
1036 requires (
sizeof...(_Elements) == 2)
1037 && (__constructible<const _U1&, const _U2&>())
1038 && (__dangles<const _U1&, const _U2&>())
1041 template<
typename _U1,
typename _U2>
1042 requires (
sizeof...(_Elements) == 2)
1043 && (__constructible<_U1, _U2>())
1044 && (!__dangles<_U1, _U2>())
1045 constexpr explicit(!__convertible<_U1, _U2>())
1047 noexcept(__nothrow_constructible<_U1, _U2>())
1052 template<
typename _U1,
typename _U2>
1053 requires (
sizeof...(_Elements) == 2)
1054 && (__constructible<_U1, _U2>())
1055 && (__dangles<_U1, _U2>())
1058#if __cpp_lib_ranges_zip
1059 template<
typename _U1,
typename _U2>
1060 requires (
sizeof...(_Elements) == 2)
1061 && (__constructible<_U1&, _U2&>())
1062 && (!__dangles<_U1&, _U2&>())
1063 constexpr explicit(!__convertible<_U1&, _U2&>())
1065 noexcept(__nothrow_constructible<_U1&, _U2&>())
1066 : _Inherited(__u.first, __u.second)
1069 template<
typename _U1,
typename _U2>
1070 requires (
sizeof...(_Elements) == 2)
1071 && (__constructible<_U1&, _U2&>())
1072 && (__dangles<_U1&, _U2&>())
1075 template<
typename _U1,
typename _U2>
1076 requires (
sizeof...(_Elements) == 2)
1077 && (__constructible<const _U1, const _U2>())
1078 && (!__dangles<const _U1, const _U2>())
1079 constexpr explicit(!__convertible<const _U1, const _U2>())
1081 noexcept(__nothrow_constructible<const _U1, const _U2>())
1086 template<
typename _U1,
typename _U2>
1087 requires (
sizeof...(_Elements) == 2)
1088 && (__constructible<const _U1, const _U2>())
1089 && (__dangles<const _U1, const _U2>())
1093#if __cpp_lib_tuple_like
1094 template<__eligible_tuple_like<tuple> _UTuple>
1095 requires (__constructible_from_tuple_like<_UTuple>())
1096 && (!__use_other_ctor<_UTuple>())
1097 && (!__dangles_from_tuple_like<_UTuple>())
1098 constexpr explicit(!__convertible_from_tuple_like<_UTuple>())
1099 tuple(_UTuple&& __u)
1100 : _Inherited(__tuple_like_tag_t{},
1105 template<__eligible_tuple_like<tuple> _UTuple>
1106 requires (__constructible_from_tuple_like<_UTuple>())
1107 && (!__use_other_ctor<_UTuple>())
1108 && (__dangles_from_tuple_like<_UTuple>())
1109 tuple(_UTuple&&) =
delete;
1114 template<
typename _Alloc>
1116 explicit(!(__is_implicitly_default_constructible_v<_Elements> && ...))
1117 tuple(allocator_arg_t __tag,
const _Alloc& __a)
1118 requires (is_default_constructible_v<_Elements> && ...)
1119 : _Inherited(__tag, __a)
1122 template<
typename _Alloc>
1123 constexpr explicit(!__convertible<
const _Elements&...>())
1124 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1125 const type_identity_t<_Elements>&... __elements)
1126 requires (__constructible<
const _Elements&...>())
1127 : _Inherited(__tag, __a, __elements...)
1130 template<
typename _Alloc,
typename... _UTypes>
1131 requires (__disambiguating_constraint<_UTypes...>())
1132 && (__constructible<_UTypes...>())
1133 && (!__dangles<_UTypes...>())
1134 constexpr explicit(!__convertible<_UTypes...>())
1135 tuple(allocator_arg_t __tag,
const _Alloc& __a, _UTypes&&... __u)
1139 template<
typename _Alloc,
typename... _UTypes>
1140 requires (__disambiguating_constraint<_UTypes...>())
1141 && (__constructible<_UTypes...>())
1142 && (__dangles<_UTypes...>())
1143 tuple(allocator_arg_t,
const _Alloc&, _UTypes&&...) =
delete;
1145 template<
typename _Alloc>
1147 tuple(allocator_arg_t __tag,
const _Alloc& __a,
const tuple& __u)
1148 : _Inherited(__tag, __a,
static_cast<const _Inherited&
>(__u))
1151 template<
typename _Alloc>
1152 requires (__constructible<_Elements...>())
1154 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple&& __u)
1155 : _Inherited(__tag, __a,
static_cast<_Inherited&&
>(__u))
1158 template<
typename _Alloc,
typename... _UTypes>
1159 requires (__constructible<
const _UTypes&...>())
1160 && (!__use_other_ctor<
const tuple<_UTypes...>&>())
1161 && (!__dangles<
const _UTypes&...>())
1162 constexpr explicit(!__convertible<const _UTypes&...>())
1163 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1164 const tuple<_UTypes...>& __u)
1165 : _Inherited(__tag, __a,
1166 static_cast<const _Tuple_impl<0, _UTypes...
>&>(__u))
1169 template<
typename _Alloc,
typename... _UTypes>
1170 requires (__constructible<
const _UTypes&...>())
1171 && (!__use_other_ctor<
const tuple<_UTypes...>&>())
1172 && (__dangles<
const _UTypes&...>())
1173 tuple(allocator_arg_t,
const _Alloc&,
const tuple<_UTypes...>&) =
delete;
1175 template<
typename _Alloc,
typename... _UTypes>
1176 requires (__constructible<_UTypes...>())
1177 && (!__use_other_ctor<tuple<_UTypes...>>())
1178 && (!__dangles<_UTypes...>())
1179 constexpr explicit(!__use_other_ctor<tuple<_UTypes...>>())
1180 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple<_UTypes...>&& __u)
1181 : _Inherited(__tag, __a,
static_cast<_Tuple_impl<0, _UTypes...
>&&>(__u))
1184 template<
typename _Alloc,
typename... _UTypes>
1185 requires (__constructible<_UTypes...>())
1186 && (!__use_other_ctor<tuple<_UTypes...>>())
1187 && (__dangles<_UTypes...>())
1188 tuple(allocator_arg_t,
const _Alloc&, tuple<_UTypes...>&&) =
delete;
1190#if __cpp_lib_ranges_zip
1191 template<
typename _Alloc,
typename... _UTypes>
1192 requires (__constructible<_UTypes&...>())
1193 && (!__use_other_ctor<tuple<_UTypes...>&>())
1194 && (!__dangles<_UTypes&...>())
1195 constexpr explicit(!__convertible<_UTypes&...>())
1196 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple<_UTypes...>& __u)
1197 : _Inherited(__tag, __a,
static_cast<_Tuple_impl<0, _UTypes...
>&>(__u))
1200 template<
typename _Alloc,
typename... _UTypes>
1201 requires (__constructible<_UTypes&...>())
1202 && (!__use_other_ctor<tuple<_UTypes...>&>())
1203 && (__dangles<_UTypes&...>())
1204 tuple(allocator_arg_t,
const _Alloc&, tuple<_UTypes...>&) =
delete;
1206 template<
typename _Alloc,
typename... _UTypes>
1207 requires (__constructible<
const _UTypes...>())
1208 && (!__use_other_ctor<
const tuple<_UTypes...>>())
1209 && (!__dangles<
const _UTypes...>())
1210 constexpr explicit(!__convertible<const _UTypes...>())
1211 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1212 const tuple<_UTypes...>&& __u)
1213 : _Inherited(__tag, __a,
1214 static_cast<const _Tuple_impl<0, _UTypes...
>&&>(__u))
1217 template<
typename _Alloc,
typename... _UTypes>
1218 requires (__constructible<
const _UTypes...>())
1219 && (!__use_other_ctor<
const tuple<_UTypes...>>())
1220 && (__dangles<
const _UTypes...>())
1221 tuple(allocator_arg_t,
const _Alloc&,
const tuple<_UTypes...>&&) =
delete;
1224 template<
typename _Alloc,
typename _U1,
typename _U2>
1225 requires (
sizeof...(_Elements) == 2)
1226 && (__constructible<const _U1&, const _U2&>())
1227 && (!__dangles<const _U1&, const _U2&>())
1228 constexpr explicit(!__convertible<const _U1&, const _U2&>())
1229 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1231 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
1232 : _Inherited(__tag, __a, __u.first, __u.second)
1235 template<
typename _Alloc,
typename _U1,
typename _U2>
1236 requires (
sizeof...(_Elements) == 2)
1237 && (__constructible<const _U1&, const _U2&>())
1238 && (__dangles<const _U1&, const _U2&>())
1239 tuple(allocator_arg_t,
const _Alloc&,
const pair<_U1, _U2>&) =
delete;
1241 template<
typename _Alloc,
typename _U1,
typename _U2>
1242 requires (
sizeof...(_Elements) == 2)
1243 && (__constructible<_U1, _U2>())
1244 && (!__dangles<_U1, _U2>())
1245 constexpr explicit(!__convertible<_U1, _U2>())
1246 tuple(allocator_arg_t __tag,
const _Alloc& __a,
pair<_U1, _U2>&& __u)
1247 noexcept(__nothrow_constructible<_U1, _U2>())
1251 template<
typename _Alloc,
typename _U1,
typename _U2>
1252 requires (
sizeof...(_Elements) == 2)
1253 && (__constructible<_U1, _U2>())
1254 && (__dangles<_U1, _U2>())
1255 tuple(allocator_arg_t,
const _Alloc&,
pair<_U1, _U2>&&) =
delete;
1257#if __cpp_lib_ranges_zip
1258 template<
typename _Alloc,
typename _U1,
typename _U2>
1259 requires (
sizeof...(_Elements) == 2)
1260 && (__constructible<_U1&, _U2&>())
1261 && (!__dangles<_U1&, _U2&>())
1262 constexpr explicit(!__convertible<_U1&, _U2&>())
1263 tuple(allocator_arg_t __tag,
const _Alloc& __a,
pair<_U1, _U2>& __u)
1264 noexcept(__nothrow_constructible<_U1&, _U2&>())
1265 : _Inherited(__tag, __a, __u.first, __u.second)
1268 template<
typename _Alloc,
typename _U1,
typename _U2>
1269 requires (
sizeof...(_Elements) == 2)
1270 && (__constructible<_U1&, _U2&>())
1271 && (__dangles<_U1&, _U2&>())
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 constexpr explicit(!__convertible<const _U1, const _U2>())
1279 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1281 noexcept(__nothrow_constructible<const _U1, const _U2>())
1285 template<
typename _Alloc,
typename _U1,
typename _U2>
1286 requires (
sizeof...(_Elements) == 2)
1287 && (__constructible<const _U1, const _U2>())
1288 && (__dangles<const _U1, const _U2>())
1289 tuple(allocator_arg_t,
const _Alloc&,
const pair<_U1, _U2>&&) =
delete;
1292#if __cpp_lib_tuple_like
1293 template<
typename _Alloc, __eligible_tuple_like<tuple> _UTuple>
1294 requires (__constructible_from_tuple_like<_UTuple>())
1295 && (!__use_other_ctor<_UTuple>())
1296 && (!__dangles_from_tuple_like<_UTuple>())
1297 constexpr explicit(!__convertible_from_tuple_like<_UTuple>())
1298 tuple(allocator_arg_t __tag,
const _Alloc& __a, _UTuple&& __u)
1299 : _Inherited(__tuple_like_tag_t{},
1304 template<
typename _Alloc, __eligible_tuple_like<tuple> _UTuple>
1305 requires (__constructible_from_tuple_like<_UTuple>())
1306 && (!__use_other_ctor<_UTuple>())
1307 && (__dangles_from_tuple_like<_UTuple>())
1308 tuple(allocator_arg_t,
const _Alloc&, _UTuple&&) =
delete;
1313 template<
bool _Cond>
1314 using _TCC = _TupleConstraints<_Cond, _Elements...>;
1317 template<
bool _Dummy>
1318 using _ImplicitDefaultCtor = __enable_if_t<
1319 _TCC<_Dummy>::__is_implicitly_default_constructible(),
1323 template<
bool _Dummy>
1324 using _ExplicitDefaultCtor = __enable_if_t<
1325 _TCC<_Dummy>::__is_explicitly_default_constructible(),
1329 template<
bool _Cond,
typename... _Args>
1330 using _ImplicitCtor = __enable_if_t<
1331 _TCC<_Cond>::template __is_implicitly_constructible<_Args...>(),
1335 template<
bool _Cond,
typename... _Args>
1336 using _ExplicitCtor = __enable_if_t<
1337 _TCC<_Cond>::template __is_explicitly_constructible<_Args...>(),
1341 template<
typename... _UElements>
1342 static constexpr bool __nothrow_constructible()
1345 __and_<is_nothrow_constructible<_Elements, _UElements>...>::value;
1349 template<
typename _Up>
1350 static constexpr bool __valid_args()
1352 return sizeof...(_Elements) == 1
1353 && !
is_same<tuple, __remove_cvref_t<_Up>>::value;
1357 template<
typename,
typename,
typename... _Tail>
1358 static constexpr bool __valid_args()
1359 {
return (
sizeof...(_Tail) + 2) ==
sizeof...(_Elements); }
1370 template<
typename _Tuple,
typename = tuple,
1371 typename = __remove_cvref_t<_Tuple>>
1372 struct _UseOtherCtor
1377 template<
typename _Tuple,
typename _Tp,
typename _Up>
1378 struct _UseOtherCtor<_Tuple, tuple<_Tp>, tuple<_Up>>
1379 : __or_<is_convertible<_Tuple, _Tp>, is_constructible<_Tp, _Tuple>>::type
1383 template<
typename _Tuple,
typename _Tp>
1384 struct _UseOtherCtor<_Tuple, tuple<_Tp>, tuple<_Tp>>
1391 template<
typename _Tuple>
1392 static constexpr bool __use_other_ctor()
1393 {
return _UseOtherCtor<_Tuple>::value; }
1396#undef __glibcxx_no_dangling_refs
1397#if __has_builtin(__reference_constructs_from_temporary) \
1398 && defined _GLIBCXX_DEBUG
1400# if __cpp_fold_expressions
1401# define __glibcxx_dangling_refs(U) \
1402 (__reference_constructs_from_temporary(_Elements, U) || ...)
1404# define __glibcxx_dangling_refs(U) \
1405 __or_<__bool_constant<__reference_constructs_from_temporary(_Elements, U) \
1408# define __glibcxx_no_dangling_refs(U) \
1409 static_assert(!__glibcxx_dangling_refs(U), \
1410 "std::tuple constructor creates a dangling reference")
1412# define __glibcxx_no_dangling_refs(U)
1417 template<
typename _Dummy = void,
1418 _ImplicitDefaultCtor<is_void<_Dummy>::value> =
true>
1421 noexcept(__and_<is_nothrow_default_constructible<_Elements>...>::value)
1424 template<
typename _Dummy = void,
1425 _ExplicitDefaultCtor<is_void<_Dummy>::value> =
false>
1428 noexcept(__and_<is_nothrow_default_constructible<_Elements>...>::value)
1431 template<
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
1432 _ImplicitCtor<_NotEmpty, const _Elements&...> =
true>
1434 tuple(
const __type_identity_t<_Elements>&... __elements)
1435 noexcept(__nothrow_constructible<
const _Elements&...>())
1436 : _Inherited(__elements...) { }
1438 template<
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
1439 _ExplicitCtor<_NotEmpty, const _Elements&...> =
false>
1441 tuple(
const __type_identity_t<_Elements>&... __elements)
1442 noexcept(__nothrow_constructible<
const _Elements&...>())
1443 : _Inherited(__elements...) { }
1445 template<
typename... _UElements,
1446 bool _Valid = __valid_args<_UElements...>(),
1447 _ImplicitCtor<_Valid, _UElements...> =
true>
1449 tuple(_UElements&&... __elements)
1450 noexcept(__nothrow_constructible<_UElements...>())
1452 { __glibcxx_no_dangling_refs(_UElements&&); }
1454 template<
typename... _UElements,
1455 bool _Valid = __valid_args<_UElements...>(),
1456 _ExplicitCtor<_Valid, _UElements...> =
false>
1458 tuple(_UElements&&... __elements)
1459 noexcept(__nothrow_constructible<_UElements...>())
1461 { __glibcxx_no_dangling_refs(_UElements&&); }
1463 constexpr tuple(
const tuple&) =
default;
1465 constexpr tuple(tuple&&) =
default;
1467 template<
typename... _UElements,
1468 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1469 && !__use_other_ctor<
const tuple<_UElements...>&>(),
1470 _ImplicitCtor<_Valid,
const _UElements&...> =
true>
1472 tuple(
const tuple<_UElements...>& __in)
1473 noexcept(__nothrow_constructible<
const _UElements&...>())
1474 : _Inherited(
static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
1475 { __glibcxx_no_dangling_refs(
const _UElements&); }
1477 template<
typename... _UElements,
1478 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1479 && !__use_other_ctor<
const tuple<_UElements...>&>(),
1480 _ExplicitCtor<_Valid,
const _UElements&...> =
false>
1482 tuple(
const tuple<_UElements...>& __in)
1483 noexcept(__nothrow_constructible<
const _UElements&...>())
1484 : _Inherited(
static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
1485 { __glibcxx_no_dangling_refs(
const _UElements&); }
1487 template<
typename... _UElements,
1488 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1489 && !__use_other_ctor<tuple<_UElements...>&&>(),
1490 _ImplicitCtor<_Valid, _UElements...> =
true>
1492 tuple(tuple<_UElements...>&& __in)
1493 noexcept(__nothrow_constructible<_UElements...>())
1494 : _Inherited(
static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
1495 { __glibcxx_no_dangling_refs(_UElements&&); }
1497 template<
typename... _UElements,
1498 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1499 && !__use_other_ctor<tuple<_UElements...>&&>(),
1500 _ExplicitCtor<_Valid, _UElements...> =
false>
1502 tuple(tuple<_UElements...>&& __in)
1503 noexcept(__nothrow_constructible<_UElements...>())
1504 : _Inherited(
static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
1505 { __glibcxx_no_dangling_refs(_UElements&&); }
1509 template<
typename _Alloc,
1510 _ImplicitDefaultCtor<is_object<_Alloc>::value> =
true>
1511 _GLIBCXX20_CONSTEXPR
1512 tuple(allocator_arg_t __tag,
const _Alloc& __a)
1513 : _Inherited(__tag, __a) { }
1515 template<
typename _Alloc,
1516 _ExplicitDefaultCtor<is_object<_Alloc>::value> =
false>
1517 _GLIBCXX20_CONSTEXPR
1519 tuple(allocator_arg_t __tag,
const _Alloc& __a)
1520 : _Inherited(__tag, __a) { }
1522 template<
typename _Alloc,
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
1523 _ImplicitCtor<_NotEmpty, const _Elements&...> =
true>
1524 _GLIBCXX20_CONSTEXPR
1525 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1526 const __type_identity_t<_Elements>&... __elements)
1527 : _Inherited(__tag, __a, __elements...) { }
1529 template<
typename _Alloc,
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
1530 _ExplicitCtor<_NotEmpty, const _Elements&...> =
false>
1531 _GLIBCXX20_CONSTEXPR
1533 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1534 const __type_identity_t<_Elements>&... __elements)
1535 : _Inherited(__tag, __a, __elements...) { }
1537 template<
typename _Alloc,
typename... _UElements,
1538 bool _Valid = __valid_args<_UElements...>(),
1539 _ImplicitCtor<_Valid, _UElements...> =
true>
1540 _GLIBCXX20_CONSTEXPR
1541 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1542 _UElements&&... __elements)
1544 { __glibcxx_no_dangling_refs(_UElements&&); }
1546 template<
typename _Alloc,
typename... _UElements,
1547 bool _Valid = __valid_args<_UElements...>(),
1548 _ExplicitCtor<_Valid, _UElements...> =
false>
1549 _GLIBCXX20_CONSTEXPR
1551 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1552 _UElements&&... __elements)
1554 { __glibcxx_no_dangling_refs(_UElements&&); }
1556 template<
typename _Alloc>
1557 _GLIBCXX20_CONSTEXPR
1558 tuple(allocator_arg_t __tag,
const _Alloc& __a,
const tuple& __in)
1559 : _Inherited(__tag, __a,
static_cast<const _Inherited&
>(__in)) { }
1561 template<
typename _Alloc>
1562 _GLIBCXX20_CONSTEXPR
1563 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple&& __in)
1564 : _Inherited(__tag, __a,
static_cast<_Inherited&&
>(__in)) { }
1566 template<
typename _Alloc,
typename... _UElements,
1567 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1568 && !__use_other_ctor<
const tuple<_UElements...>&>(),
1569 _ImplicitCtor<_Valid,
const _UElements&...> =
true>
1570 _GLIBCXX20_CONSTEXPR
1571 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1572 const tuple<_UElements...>& __in)
1573 : _Inherited(__tag, __a,
1574 static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
1575 { __glibcxx_no_dangling_refs(
const _UElements&); }
1577 template<
typename _Alloc,
typename... _UElements,
1578 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1579 && !__use_other_ctor<
const tuple<_UElements...>&>(),
1580 _ExplicitCtor<_Valid,
const _UElements&...> =
false>
1581 _GLIBCXX20_CONSTEXPR
1583 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1584 const tuple<_UElements...>& __in)
1585 : _Inherited(__tag, __a,
1586 static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
1587 { __glibcxx_no_dangling_refs(
const _UElements&); }
1589 template<
typename _Alloc,
typename... _UElements,
1590 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1591 && !__use_other_ctor<tuple<_UElements...>&&>(),
1592 _ImplicitCtor<_Valid, _UElements...> =
true>
1593 _GLIBCXX20_CONSTEXPR
1594 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1595 tuple<_UElements...>&& __in)
1596 : _Inherited(__tag, __a,
1597 static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
1598 { __glibcxx_no_dangling_refs(_UElements&&); }
1600 template<
typename _Alloc,
typename... _UElements,
1601 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1602 && !__use_other_ctor<tuple<_UElements...>&&>(),
1603 _ExplicitCtor<_Valid, _UElements...> =
false>
1604 _GLIBCXX20_CONSTEXPR
1606 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1607 tuple<_UElements...>&& __in)
1608 : _Inherited(__tag, __a,
1609 static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
1610 { __glibcxx_no_dangling_refs(_UElements&&); }
1615#if __cpp_concepts && __cpp_consteval
1617 template<
typename... _UTypes>
1618 static consteval bool
1621 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
1627 template<
typename... _UTypes>
1628 static consteval bool
1629 __nothrow_assignable()
1631 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
1637#if __cpp_lib_ranges_zip
1638 template<
typename... _UTypes>
1639 static consteval bool
1640 __const_assignable()
1642 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
1649#if __cpp_lib_tuple_like
1650 template<
typename _UTuple>
1651 static consteval bool
1652 __assignable_from_tuple_like()
1659 template<
typename _UTuple>
1660 static consteval bool
1661 __const_assignable_from_tuple_like()
1671 tuple& operator=(
const tuple& __u) =
delete;
1674 operator=(
const tuple& __u)
1675 noexcept(__nothrow_assignable<
const _Elements&...>())
1676 requires (__assignable<const _Elements&...>())
1678 this->_M_assign(__u);
1683 operator=(tuple&& __u)
1684 noexcept(__nothrow_assignable<_Elements...>())
1685 requires (__assignable<_Elements...>())
1691 template<
typename... _UTypes>
1692 requires (__assignable<
const _UTypes&...>())
1694 operator=(
const tuple<_UTypes...>& __u)
1695 noexcept(__nothrow_assignable<
const _UTypes&...>())
1697 this->_M_assign(__u);
1701 template<
typename... _UTypes>
1702 requires (__assignable<_UTypes...>())
1704 operator=(tuple<_UTypes...>&& __u)
1705 noexcept(__nothrow_assignable<_UTypes...>())
1711#if __cpp_lib_ranges_zip
1712 constexpr const tuple&
1713 operator=(
const tuple& __u)
const
1714 requires (__const_assignable<
const _Elements&...>())
1716 this->_M_assign(__u);
1720 constexpr const tuple&
1721 operator=(tuple&& __u)
const
1722 requires (__const_assignable<_Elements...>())
1728 template<
typename... _UTypes>
1729 constexpr const tuple&
1730 operator=(
const tuple<_UTypes...>& __u)
const
1731 requires (__const_assignable<
const _UTypes&...>())
1733 this->_M_assign(__u);
1737 template<
typename... _UTypes>
1738 constexpr const tuple&
1739 operator=(tuple<_UTypes...>&& __u)
const
1740 requires (__const_assignable<_UTypes...>())
1747 template<
typename _U1,
typename _U2>
1748 requires (__assignable<const _U1&, const _U2&>())
1751 noexcept(__nothrow_assignable<const _U1&, const _U2&>())
1753 this->_M_head(*
this) = __u.first;
1754 this->_M_tail(*this)._M_head(*
this) = __u.second;
1758 template<
typename _U1,
typename _U2>
1759 requires (__assignable<_U1, _U2>())
1762 noexcept(__nothrow_assignable<_U1, _U2>())
1769#if __cpp_lib_ranges_zip
1770 template<
typename _U1,
typename _U2>
1771 requires (__const_assignable<const _U1&, const _U2>())
1772 constexpr const tuple&
1775 this->_M_head(*
this) = __u.first;
1776 this->_M_tail(*this)._M_head(*
this) = __u.second;
1780 template<
typename _U1,
typename _U2>
1781 requires (__const_assignable<_U1, _U2>())
1782 constexpr const tuple&
1791#if __cpp_lib_tuple_like
1792 template<__eligible_tuple_like<tuple> _UTuple>
1793 requires (__assignable_from_tuple_like<_UTuple>())
1795 operator=(_UTuple&& __u)
1801 template<__eligible_tuple_like<tuple> _UTuple>
1802 requires (__const_assignable_from_tuple_like<_UTuple>())
1803 constexpr const tuple&
1804 operator=(_UTuple&& __u)
const
1810 template<__tuple_like _UTuple>
1811 requires (!__is_tuple_v<_UTuple>)
1812 friend constexpr bool
1813 operator== [[nodiscard]] (
const tuple& __t,
const _UTuple& __u)
1815 static_assert(
sizeof...(_Elements) == tuple_size_v<_UTuple>,
1816 "tuple objects can only be compared if they have equal sizes.");
1818 return (
bool(std::get<_Is>(__t) == std::get<_Is>(__u))
1823 template<__tuple_like _UTuple,
1825 struct __tuple_like_common_comparison_category;
1827 template<__tuple_like _UTuple,
size_t... _Is>
1829 {
typename void_t<__detail::__synth3way_t<_Elements, tuple_element_t<_Is, _UTuple>>...>; }
1830 struct __tuple_like_common_comparison_category<_UTuple,
index_sequence<_Is...>>
1832 using type = common_comparison_category_t
1833 <__detail::__synth3way_t<_Elements, tuple_element_t<_Is, _UTuple>>...>;
1836 template<__tuple_like _UTuple>
1837 requires (!__is_tuple_v<_UTuple>)
1838 friend constexpr typename __tuple_like_common_comparison_category<_UTuple>::type
1839 operator<=>(
const tuple& __t,
const _UTuple& __u)
1841 using _Cat =
typename __tuple_like_common_comparison_category<_UTuple>::type;
1849 template<
typename... _UElements>
1851 __enable_if_t<
sizeof...(_UElements) ==
sizeof...(_Elements),
bool>
1853 {
return __and_<is_assignable<_Elements&, _UElements>...>::value; }
1856 template<
typename... _UElements>
1857 static constexpr bool __nothrow_assignable()
1860 __and_<is_nothrow_assignable<_Elements&, _UElements>...>::value;
1865 _GLIBCXX20_CONSTEXPR
1867 operator=(__conditional_t<__assignable<const _Elements&...>(),
1869 const __nonesuch&> __in)
1870 noexcept(__nothrow_assignable<
const _Elements&...>())
1872 this->_M_assign(__in);
1876 _GLIBCXX20_CONSTEXPR
1878 operator=(__conditional_t<__assignable<_Elements...>(),
1881 noexcept(__nothrow_assignable<_Elements...>())
1887 template<
typename... _UElements>
1888 _GLIBCXX20_CONSTEXPR
1889 __enable_if_t<__assignable<
const _UElements&...>(), tuple&>
1890 operator=(
const tuple<_UElements...>& __in)
1891 noexcept(__nothrow_assignable<
const _UElements&...>())
1893 this->_M_assign(__in);
1897 template<
typename... _UElements>
1898 _GLIBCXX20_CONSTEXPR
1899 __enable_if_t<__assignable<_UElements...>(), tuple&>
1900 operator=(tuple<_UElements...>&& __in)
1901 noexcept(__nothrow_assignable<_UElements...>())
1909 _GLIBCXX20_CONSTEXPR
1912 noexcept(__and_<__is_nothrow_swappable<_Elements>...>::value)
1913 { _Inherited::_M_swap(__in); }
1915#if __cpp_lib_ranges_zip
1923 swap(
const tuple& __in)
const
1924 noexcept(__and_v<__is_nothrow_swappable<const _Elements>...>)
1925 requires (is_swappable_v<const _Elements> && ...)
1926 { _Inherited::_M_swap(__in); }
2024 class tuple<_T1, _T2> :
public _Tuple_impl<0, _T1, _T2>
2026 typedef _Tuple_impl<0, _T1, _T2> _Inherited;
2029 template<
bool _Dummy,
typename _U1,
typename _U2>
2030 using _ImplicitDefaultCtor = __enable_if_t<
2031 _TupleConstraints<_Dummy, _U1, _U2>::
2032 __is_implicitly_default_constructible(),
2036 template<
bool _Dummy,
typename _U1,
typename _U2>
2037 using _ExplicitDefaultCtor = __enable_if_t<
2038 _TupleConstraints<_Dummy, _U1, _U2>::
2039 __is_explicitly_default_constructible(),
2042 template<
bool _Dummy>
2043 using _TCC = _TupleConstraints<_Dummy, _T1, _T2>;
2046 template<
bool _Cond,
typename _U1,
typename _U2>
2047 using _ImplicitCtor = __enable_if_t<
2048 _TCC<_Cond>::template __is_implicitly_constructible<_U1, _U2>(),
2052 template<
bool _Cond,
typename _U1,
typename _U2>
2053 using _ExplicitCtor = __enable_if_t<
2054 _TCC<_Cond>::template __is_explicitly_constructible<_U1, _U2>(),
2057 template<
typename _U1,
typename _U2>
2058 static constexpr bool __assignable()
2060 return __and_<is_assignable<_T1&, _U1>,
2064 template<
typename _U1,
typename _U2>
2065 static constexpr bool __nothrow_assignable()
2067 return __and_<is_nothrow_assignable<_T1&, _U1>,
2071 template<
typename _U1,
typename _U2>
2072 static constexpr bool __nothrow_constructible()
2074 return __and_<is_nothrow_constructible<_T1, _U1>,
2078 static constexpr bool __nothrow_default_constructible()
2080 return __and_<is_nothrow_default_constructible<_T1>,
2084 template<
typename _U1>
2085 static constexpr bool __is_alloc_arg()
2089#undef __glibcxx_no_dangling_refs
2091#if __has_builtin(__reference_constructs_from_temporary) \
2092 && defined _GLIBCXX_DEBUG
2093# define __glibcxx_no_dangling_refs(_U1, _U2) \
2094 static_assert(!__reference_constructs_from_temporary(_T1, _U1) \
2095 && !__reference_constructs_from_temporary(_T2, _U2), \
2096 "std::tuple constructor creates a dangling reference")
2098# define __glibcxx_no_dangling_refs(_U1, _U2)
2103 template<
bool _Dummy =
true,
2104 _ImplicitDefaultCtor<_Dummy, _T1, _T2> =
true>
2107 noexcept(__nothrow_default_constructible())
2110 template<
bool _Dummy =
true,
2111 _ExplicitDefaultCtor<_Dummy, _T1, _T2> =
false>
2114 noexcept(__nothrow_default_constructible())
2117 template<
bool _Dummy =
true,
2118 _ImplicitCtor<_Dummy, const _T1&, const _T2&> =
true>
2120 tuple(
const _T1& __a1,
const _T2& __a2)
2121 noexcept(__nothrow_constructible<const _T1&, const _T2&>())
2122 : _Inherited(__a1, __a2) { }
2124 template<
bool _Dummy =
true,
2125 _ExplicitCtor<_Dummy, const _T1&, const _T2&> =
false>
2127 tuple(
const _T1& __a1,
const _T2& __a2)
2128 noexcept(__nothrow_constructible<const _T1&, const _T2&>())
2129 : _Inherited(__a1, __a2) { }
2131 template<
typename _U1,
typename _U2,
2132 _ImplicitCtor<!__is_alloc_arg<_U1>(), _U1, _U2> =
true>
2134 tuple(_U1&& __a1, _U2&& __a2)
2135 noexcept(__nothrow_constructible<_U1, _U2>())
2137 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2139 template<
typename _U1,
typename _U2,
2140 _ExplicitCtor<!__is_alloc_arg<_U1>(), _U1, _U2> =
false>
2142 tuple(_U1&& __a1, _U2&& __a2)
2143 noexcept(__nothrow_constructible<_U1, _U2>())
2145 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2147 constexpr tuple(
const tuple&) =
default;
2149 constexpr tuple(tuple&&) =
default;
2151 template<
typename _U1,
typename _U2,
2152 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
2154 tuple(
const tuple<_U1, _U2>& __in)
2155 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
2156 : _Inherited(
static_cast<const _Tuple_impl<0, _U1, _U2>&
>(__in))
2157 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2159 template<
typename _U1,
typename _U2,
2160 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
2162 tuple(
const tuple<_U1, _U2>& __in)
2163 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
2164 : _Inherited(
static_cast<const _Tuple_impl<0, _U1, _U2>&
>(__in))
2165 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2167 template<
typename _U1,
typename _U2,
2168 _ImplicitCtor<true, _U1, _U2> =
true>
2170 tuple(tuple<_U1, _U2>&& __in)
2171 noexcept(__nothrow_constructible<_U1, _U2>())
2172 : _Inherited(
static_cast<_Tuple_impl<0, _U1, _U2>&&
>(__in))
2173 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2175 template<
typename _U1,
typename _U2,
2176 _ExplicitCtor<true, _U1, _U2> =
false>
2178 tuple(tuple<_U1, _U2>&& __in)
2179 noexcept(__nothrow_constructible<_U1, _U2>())
2180 : _Inherited(
static_cast<_Tuple_impl<0, _U1, _U2>&&
>(__in))
2181 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2183 template<
typename _U1,
typename _U2,
2184 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
2187 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
2188 : _Inherited(__in.first, __in.second)
2189 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2191 template<
typename _U1,
typename _U2,
2192 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
2195 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
2196 : _Inherited(__in.first, __in.second)
2197 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2199 template<
typename _U1,
typename _U2,
2200 _ImplicitCtor<true, _U1, _U2> =
true>
2203 noexcept(__nothrow_constructible<_U1, _U2>())
2206 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2208 template<
typename _U1,
typename _U2,
2209 _ExplicitCtor<true, _U1, _U2> =
false>
2212 noexcept(__nothrow_constructible<_U1, _U2>())
2215 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2219 template<
typename _Alloc,
2220 _ImplicitDefaultCtor<is_object<_Alloc>::value, _T1, _T2> =
true>
2221 _GLIBCXX20_CONSTEXPR
2222 tuple(allocator_arg_t __tag,
const _Alloc& __a)
2223 : _Inherited(__tag, __a) { }
2225 template<
typename _Alloc,
2226 _ExplicitDefaultCtor<is_object<_Alloc>::value, _T1, _T2> =
false>
2227 _GLIBCXX20_CONSTEXPR
2229 tuple(allocator_arg_t __tag,
const _Alloc& __a)
2230 : _Inherited(__tag, __a) { }
2232 template<
typename _Alloc,
bool _Dummy =
true,
2233 _ImplicitCtor<_Dummy, const _T1&, const _T2&> =
true>
2234 _GLIBCXX20_CONSTEXPR
2235 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2236 const _T1& __a1,
const _T2& __a2)
2237 : _Inherited(__tag, __a, __a1, __a2) { }
2239 template<
typename _Alloc,
bool _Dummy =
true,
2240 _ExplicitCtor<_Dummy, const _T1&, const _T2&> =
false>
2242 _GLIBCXX20_CONSTEXPR
2243 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2244 const _T1& __a1,
const _T2& __a2)
2245 : _Inherited(__tag, __a, __a1, __a2) { }
2247 template<
typename _Alloc,
typename _U1,
typename _U2,
2248 _ImplicitCtor<true, _U1, _U2> =
true>
2249 _GLIBCXX20_CONSTEXPR
2250 tuple(allocator_arg_t __tag,
const _Alloc& __a, _U1&& __a1, _U2&& __a2)
2253 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2255 template<
typename _Alloc,
typename _U1,
typename _U2,
2256 _ExplicitCtor<true, _U1, _U2> =
false>
2258 _GLIBCXX20_CONSTEXPR
2259 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2260 _U1&& __a1, _U2&& __a2)
2263 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2265 template<
typename _Alloc>
2266 _GLIBCXX20_CONSTEXPR
2267 tuple(allocator_arg_t __tag,
const _Alloc& __a,
const tuple& __in)
2268 : _Inherited(__tag, __a,
static_cast<const _Inherited&
>(__in)) { }
2270 template<
typename _Alloc>
2271 _GLIBCXX20_CONSTEXPR
2272 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple&& __in)
2273 : _Inherited(__tag, __a,
static_cast<_Inherited&&
>(__in)) { }
2275 template<
typename _Alloc,
typename _U1,
typename _U2,
2276 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
2277 _GLIBCXX20_CONSTEXPR
2278 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2279 const tuple<_U1, _U2>& __in)
2280 : _Inherited(__tag, __a,
2281 static_cast<const _Tuple_impl<0, _U1, _U2>&
>(__in))
2282 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2284 template<
typename _Alloc,
typename _U1,
typename _U2,
2285 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
2287 _GLIBCXX20_CONSTEXPR
2288 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2289 const tuple<_U1, _U2>& __in)
2290 : _Inherited(__tag, __a,
2291 static_cast<const _Tuple_impl<0, _U1, _U2>&
>(__in))
2292 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2294 template<
typename _Alloc,
typename _U1,
typename _U2,
2295 _ImplicitCtor<true, _U1, _U2> =
true>
2296 _GLIBCXX20_CONSTEXPR
2297 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple<_U1, _U2>&& __in)
2298 : _Inherited(__tag, __a,
static_cast<_Tuple_impl<0, _U1, _U2>&&
>(__in))
2299 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2301 template<
typename _Alloc,
typename _U1,
typename _U2,
2302 _ExplicitCtor<true, _U1, _U2> =
false>
2304 _GLIBCXX20_CONSTEXPR
2305 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple<_U1, _U2>&& __in)
2306 : _Inherited(__tag, __a,
static_cast<_Tuple_impl<0, _U1, _U2>&&
>(__in))
2307 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2309 template<
typename _Alloc,
typename _U1,
typename _U2,
2310 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
2311 _GLIBCXX20_CONSTEXPR
2312 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2314 : _Inherited(__tag, __a, __in.first, __in.second)
2315 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2317 template<
typename _Alloc,
typename _U1,
typename _U2,
2318 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
2320 _GLIBCXX20_CONSTEXPR
2321 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2323 : _Inherited(__tag, __a, __in.first, __in.second)
2324 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2326 template<
typename _Alloc,
typename _U1,
typename _U2,
2327 _ImplicitCtor<true, _U1, _U2> =
true>
2328 _GLIBCXX20_CONSTEXPR
2329 tuple(allocator_arg_t __tag,
const _Alloc& __a,
pair<_U1, _U2>&& __in)
2332 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2334 template<
typename _Alloc,
typename _U1,
typename _U2,
2335 _ExplicitCtor<true, _U1, _U2> =
false>
2337 _GLIBCXX20_CONSTEXPR
2338 tuple(allocator_arg_t __tag,
const _Alloc& __a,
pair<_U1, _U2>&& __in)
2341 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2345 _GLIBCXX20_CONSTEXPR
2347 operator=(__conditional_t<__assignable<const _T1&, const _T2&>(),
2349 const __nonesuch&> __in)
2350 noexcept(__nothrow_assignable<const _T1&, const _T2&>())
2352 this->_M_assign(__in);
2356 _GLIBCXX20_CONSTEXPR
2358 operator=(__conditional_t<__assignable<_T1, _T2>(),
2361 noexcept(__nothrow_assignable<_T1, _T2>())
2367 template<
typename _U1,
typename _U2>
2368 _GLIBCXX20_CONSTEXPR
2369 __enable_if_t<__assignable<const _U1&, const _U2&>(), tuple&>
2370 operator=(
const tuple<_U1, _U2>& __in)
2371 noexcept(__nothrow_assignable<const _U1&, const _U2&>())
2373 this->_M_assign(__in);
2377 template<
typename _U1,
typename _U2>
2378 _GLIBCXX20_CONSTEXPR
2379 __enable_if_t<__assignable<_U1, _U2>(), tuple&>
2380 operator=(tuple<_U1, _U2>&& __in)
2381 noexcept(__nothrow_assignable<_U1, _U2>())
2387 template<
typename _U1,
typename _U2>
2388 _GLIBCXX20_CONSTEXPR
2389 __enable_if_t<__assignable<const _U1&, const _U2&>(), tuple&>
2391 noexcept(__nothrow_assignable<const _U1&, const _U2&>())
2393 this->_M_head(*
this) = __in.first;
2394 this->_M_tail(*this)._M_head(*
this) = __in.second;
2398 template<
typename _U1,
typename _U2>
2399 _GLIBCXX20_CONSTEXPR
2400 __enable_if_t<__assignable<_U1, _U2>(), tuple&>
2402 noexcept(__nothrow_assignable<_U1, _U2>())
2409 _GLIBCXX20_CONSTEXPR
2412 noexcept(__and_<__is_nothrow_swappable<_T1>,
2413 __is_nothrow_swappable<_T2>>::value)
2414 { _Inherited::_M_swap(__in); }