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;
958 tuple(tuple&&)
requires (is_move_constructible_v<_Elements> && ...)
961 template<
typename... _UTypes>
962 requires (__constructible<
const _UTypes&...>())
963 && (!__use_other_ctor<
const tuple<_UTypes...>&>())
964 && (!__dangles<
const _UTypes&...>())
965 constexpr explicit(!__convertible<const _UTypes&...>())
966 tuple(
const tuple<_UTypes...>& __u)
967 noexcept(__nothrow_constructible<
const _UTypes&...>())
968 : _Inherited(
static_cast<const _Tuple_impl<0, _UTypes...
>&>(__u))
971 template<
typename... _UTypes>
972 requires (__constructible<
const _UTypes&...>())
973 && (!__use_other_ctor<
const tuple<_UTypes...>&>())
974 && (__dangles<
const _UTypes&...>())
975 tuple(
const tuple<_UTypes...>&) =
delete;
977 template<
typename... _UTypes>
978 requires (__constructible<_UTypes...>())
979 && (!__use_other_ctor<tuple<_UTypes...>>())
980 && (!__dangles<_UTypes...>())
981 constexpr explicit(!__convertible<_UTypes...>())
982 tuple(tuple<_UTypes...>&& __u)
983 noexcept(__nothrow_constructible<_UTypes...>())
984 : _Inherited(
static_cast<_Tuple_impl<0, _UTypes...
>&&>(__u))
987 template<
typename... _UTypes>
988 requires (__constructible<_UTypes...>())
989 && (!__use_other_ctor<tuple<_UTypes...>>())
990 && (__dangles<_UTypes...>())
991 tuple(tuple<_UTypes...>&&) =
delete;
993#if __cpp_lib_ranges_zip
994 template<
typename... _UTypes>
995 requires (__constructible<_UTypes&...>())
996 && (!__use_other_ctor<tuple<_UTypes...>&>())
997 && (!__dangles<_UTypes&...>())
998 constexpr explicit(!__convertible<_UTypes&...>())
999 tuple(tuple<_UTypes...>& __u)
1000 noexcept(__nothrow_constructible<_UTypes&...>())
1001 : _Inherited(
static_cast<_Tuple_impl<0, _UTypes...
>&>(__u))
1004 template<
typename... _UTypes>
1005 requires (__constructible<_UTypes&...>())
1006 && (!__use_other_ctor<tuple<_UTypes...>&>())
1007 && (__dangles<_UTypes&...>())
1008 tuple(tuple<_UTypes...>&) =
delete;
1010 template<
typename... _UTypes>
1011 requires (__constructible<
const _UTypes...>())
1012 && (!__use_other_ctor<
const tuple<_UTypes...>>())
1013 && (!__dangles<
const _UTypes...>())
1014 constexpr explicit(!__convertible<const _UTypes...>())
1015 tuple(
const tuple<_UTypes...>&& __u)
1016 noexcept(__nothrow_constructible<
const _UTypes...>())
1017 : _Inherited(
static_cast<const _Tuple_impl<0, _UTypes...
>&&>(__u))
1020 template<
typename... _UTypes>
1021 requires (__constructible<
const _UTypes...>())
1022 && (!__use_other_ctor<
const tuple<_UTypes...>>())
1023 && (__dangles<
const _UTypes...>())
1024 tuple(
const tuple<_UTypes...>&&) =
delete;
1027 template<
typename _U1,
typename _U2>
1028 requires (
sizeof...(_Elements) == 2)
1029 && (__constructible<const _U1&, const _U2&>())
1030 && (!__dangles<const _U1&, const _U2&>())
1031 constexpr explicit(!__convertible<const _U1&, const _U2&>())
1033 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
1034 : _Inherited(__u.first, __u.second)
1037 template<
typename _U1,
typename _U2>
1038 requires (
sizeof...(_Elements) == 2)
1039 && (__constructible<const _U1&, const _U2&>())
1040 && (__dangles<const _U1&, const _U2&>())
1043 template<
typename _U1,
typename _U2>
1044 requires (
sizeof...(_Elements) == 2)
1045 && (__constructible<_U1, _U2>())
1046 && (!__dangles<_U1, _U2>())
1047 constexpr explicit(!__convertible<_U1, _U2>())
1049 noexcept(__nothrow_constructible<_U1, _U2>())
1054 template<
typename _U1,
typename _U2>
1055 requires (
sizeof...(_Elements) == 2)
1056 && (__constructible<_U1, _U2>())
1057 && (__dangles<_U1, _U2>())
1060#if __cpp_lib_ranges_zip
1061 template<
typename _U1,
typename _U2>
1062 requires (
sizeof...(_Elements) == 2)
1063 && (__constructible<_U1&, _U2&>())
1064 && (!__dangles<_U1&, _U2&>())
1065 constexpr explicit(!__convertible<_U1&, _U2&>())
1067 noexcept(__nothrow_constructible<_U1&, _U2&>())
1068 : _Inherited(__u.first, __u.second)
1071 template<
typename _U1,
typename _U2>
1072 requires (
sizeof...(_Elements) == 2)
1073 && (__constructible<_U1&, _U2&>())
1074 && (__dangles<_U1&, _U2&>())
1077 template<
typename _U1,
typename _U2>
1078 requires (
sizeof...(_Elements) == 2)
1079 && (__constructible<const _U1, const _U2>())
1080 && (!__dangles<const _U1, const _U2>())
1081 constexpr explicit(!__convertible<const _U1, const _U2>())
1083 noexcept(__nothrow_constructible<const _U1, const _U2>())
1088 template<
typename _U1,
typename _U2>
1089 requires (
sizeof...(_Elements) == 2)
1090 && (__constructible<const _U1, const _U2>())
1091 && (__dangles<const _U1, const _U2>())
1095#if __cpp_lib_tuple_like
1096 template<__eligible_tuple_like<tuple> _UTuple>
1097 requires (__constructible_from_tuple_like<_UTuple>())
1098 && (!__use_other_ctor<_UTuple>())
1099 && (!__dangles_from_tuple_like<_UTuple>())
1100 constexpr explicit(!__convertible_from_tuple_like<_UTuple>())
1101 tuple(_UTuple&& __u)
1102 : _Inherited(__tuple_like_tag_t{},
1107 template<__eligible_tuple_like<tuple> _UTuple>
1108 requires (__constructible_from_tuple_like<_UTuple>())
1109 && (!__use_other_ctor<_UTuple>())
1110 && (__dangles_from_tuple_like<_UTuple>())
1111 tuple(_UTuple&&) =
delete;
1116 template<
typename _Alloc>
1118 explicit(!(__is_implicitly_default_constructible_v<_Elements> && ...))
1119 tuple(allocator_arg_t __tag,
const _Alloc& __a)
1120 requires (is_default_constructible_v<_Elements> && ...)
1121 : _Inherited(__tag, __a)
1124 template<
typename _Alloc>
1125 constexpr explicit(!__convertible<
const _Elements&...>())
1126 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1127 const type_identity_t<_Elements>&... __elements)
1128 requires (__constructible<
const _Elements&...>())
1129 : _Inherited(__tag, __a, __elements...)
1132 template<
typename _Alloc,
typename... _UTypes>
1133 requires (__disambiguating_constraint<_UTypes...>())
1134 && (__constructible<_UTypes...>())
1135 && (!__dangles<_UTypes...>())
1136 constexpr explicit(!__convertible<_UTypes...>())
1137 tuple(allocator_arg_t __tag,
const _Alloc& __a, _UTypes&&... __u)
1141 template<
typename _Alloc,
typename... _UTypes>
1142 requires (__disambiguating_constraint<_UTypes...>())
1143 && (__constructible<_UTypes...>())
1144 && (__dangles<_UTypes...>())
1145 tuple(allocator_arg_t,
const _Alloc&, _UTypes&&...) =
delete;
1147 template<
typename _Alloc>
1149 tuple(allocator_arg_t __tag,
const _Alloc& __a,
const tuple& __u)
1150 : _Inherited(__tag, __a,
static_cast<const _Inherited&
>(__u))
1153 template<
typename _Alloc>
1154 requires (__constructible<_Elements...>())
1156 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple&& __u)
1157 : _Inherited(__tag, __a,
static_cast<_Inherited&&
>(__u))
1160 template<
typename _Alloc,
typename... _UTypes>
1161 requires (__constructible<
const _UTypes&...>())
1162 && (!__use_other_ctor<
const tuple<_UTypes...>&>())
1163 && (!__dangles<
const _UTypes&...>())
1164 constexpr explicit(!__convertible<const _UTypes&...>())
1165 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1166 const tuple<_UTypes...>& __u)
1167 : _Inherited(__tag, __a,
1168 static_cast<const _Tuple_impl<0, _UTypes...
>&>(__u))
1171 template<
typename _Alloc,
typename... _UTypes>
1172 requires (__constructible<
const _UTypes&...>())
1173 && (!__use_other_ctor<
const tuple<_UTypes...>&>())
1174 && (__dangles<
const _UTypes&...>())
1175 tuple(allocator_arg_t,
const _Alloc&,
const tuple<_UTypes...>&) =
delete;
1177 template<
typename _Alloc,
typename... _UTypes>
1178 requires (__constructible<_UTypes...>())
1179 && (!__use_other_ctor<tuple<_UTypes...>>())
1180 && (!__dangles<_UTypes...>())
1181 constexpr explicit(!__use_other_ctor<tuple<_UTypes...>>())
1182 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple<_UTypes...>&& __u)
1183 : _Inherited(__tag, __a,
static_cast<_Tuple_impl<0, _UTypes...
>&&>(__u))
1186 template<
typename _Alloc,
typename... _UTypes>
1187 requires (__constructible<_UTypes...>())
1188 && (!__use_other_ctor<tuple<_UTypes...>>())
1189 && (__dangles<_UTypes...>())
1190 tuple(allocator_arg_t,
const _Alloc&, tuple<_UTypes...>&&) =
delete;
1192#if __cpp_lib_ranges_zip
1193 template<
typename _Alloc,
typename... _UTypes>
1194 requires (__constructible<_UTypes&...>())
1195 && (!__use_other_ctor<tuple<_UTypes...>&>())
1196 && (!__dangles<_UTypes&...>())
1197 constexpr explicit(!__convertible<_UTypes&...>())
1198 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple<_UTypes...>& __u)
1199 : _Inherited(__tag, __a,
static_cast<_Tuple_impl<0, _UTypes...
>&>(__u))
1202 template<
typename _Alloc,
typename... _UTypes>
1203 requires (__constructible<_UTypes&...>())
1204 && (!__use_other_ctor<tuple<_UTypes...>&>())
1205 && (__dangles<_UTypes&...>())
1206 tuple(allocator_arg_t,
const _Alloc&, tuple<_UTypes...>&) =
delete;
1208 template<
typename _Alloc,
typename... _UTypes>
1209 requires (__constructible<
const _UTypes...>())
1210 && (!__use_other_ctor<
const tuple<_UTypes...>>())
1211 && (!__dangles<
const _UTypes...>())
1212 constexpr explicit(!__convertible<const _UTypes...>())
1213 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1214 const tuple<_UTypes...>&& __u)
1215 : _Inherited(__tag, __a,
1216 static_cast<const _Tuple_impl<0, _UTypes...
>&&>(__u))
1219 template<
typename _Alloc,
typename... _UTypes>
1220 requires (__constructible<
const _UTypes...>())
1221 && (!__use_other_ctor<
const tuple<_UTypes...>>())
1222 && (__dangles<
const _UTypes...>())
1223 tuple(allocator_arg_t,
const _Alloc&,
const tuple<_UTypes...>&&) =
delete;
1226 template<
typename _Alloc,
typename _U1,
typename _U2>
1227 requires (
sizeof...(_Elements) == 2)
1228 && (__constructible<const _U1&, const _U2&>())
1229 && (!__dangles<const _U1&, const _U2&>())
1230 constexpr explicit(!__convertible<const _U1&, const _U2&>())
1231 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1233 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
1234 : _Inherited(__tag, __a, __u.first, __u.second)
1237 template<
typename _Alloc,
typename _U1,
typename _U2>
1238 requires (
sizeof...(_Elements) == 2)
1239 && (__constructible<const _U1&, const _U2&>())
1240 && (__dangles<const _U1&, const _U2&>())
1241 tuple(allocator_arg_t,
const _Alloc&,
const pair<_U1, _U2>&) =
delete;
1243 template<
typename _Alloc,
typename _U1,
typename _U2>
1244 requires (
sizeof...(_Elements) == 2)
1245 && (__constructible<_U1, _U2>())
1246 && (!__dangles<_U1, _U2>())
1247 constexpr explicit(!__convertible<_U1, _U2>())
1248 tuple(allocator_arg_t __tag,
const _Alloc& __a,
pair<_U1, _U2>&& __u)
1249 noexcept(__nothrow_constructible<_U1, _U2>())
1253 template<
typename _Alloc,
typename _U1,
typename _U2>
1254 requires (
sizeof...(_Elements) == 2)
1255 && (__constructible<_U1, _U2>())
1256 && (__dangles<_U1, _U2>())
1257 tuple(allocator_arg_t,
const _Alloc&,
pair<_U1, _U2>&&) =
delete;
1259#if __cpp_lib_ranges_zip
1260 template<
typename _Alloc,
typename _U1,
typename _U2>
1261 requires (
sizeof...(_Elements) == 2)
1262 && (__constructible<_U1&, _U2&>())
1263 && (!__dangles<_U1&, _U2&>())
1264 constexpr explicit(!__convertible<_U1&, _U2&>())
1265 tuple(allocator_arg_t __tag,
const _Alloc& __a,
pair<_U1, _U2>& __u)
1266 noexcept(__nothrow_constructible<_U1&, _U2&>())
1267 : _Inherited(__tag, __a, __u.first, __u.second)
1270 template<
typename _Alloc,
typename _U1,
typename _U2>
1271 requires (
sizeof...(_Elements) == 2)
1272 && (__constructible<_U1&, _U2&>())
1273 && (__dangles<_U1&, _U2&>())
1276 template<
typename _Alloc,
typename _U1,
typename _U2>
1277 requires (
sizeof...(_Elements) == 2)
1278 && (__constructible<const _U1, const _U2>())
1279 && (!__dangles<const _U1, const _U2>())
1280 constexpr explicit(!__convertible<const _U1, const _U2>())
1281 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1283 noexcept(__nothrow_constructible<const _U1, const _U2>())
1287 template<
typename _Alloc,
typename _U1,
typename _U2>
1288 requires (
sizeof...(_Elements) == 2)
1289 && (__constructible<const _U1, const _U2>())
1290 && (__dangles<const _U1, const _U2>())
1291 tuple(allocator_arg_t,
const _Alloc&,
const pair<_U1, _U2>&&) =
delete;
1294#if __cpp_lib_tuple_like
1295 template<
typename _Alloc, __eligible_tuple_like<tuple> _UTuple>
1296 requires (__constructible_from_tuple_like<_UTuple>())
1297 && (!__use_other_ctor<_UTuple>())
1298 && (!__dangles_from_tuple_like<_UTuple>())
1299 constexpr explicit(!__convertible_from_tuple_like<_UTuple>())
1300 tuple(allocator_arg_t __tag,
const _Alloc& __a, _UTuple&& __u)
1301 : _Inherited(__tuple_like_tag_t{},
1306 template<
typename _Alloc, __eligible_tuple_like<tuple> _UTuple>
1307 requires (__constructible_from_tuple_like<_UTuple>())
1308 && (!__use_other_ctor<_UTuple>())
1309 && (__dangles_from_tuple_like<_UTuple>())
1310 tuple(allocator_arg_t,
const _Alloc&, _UTuple&&) =
delete;
1315 template<
bool _Cond>
1316 using _TCC = _TupleConstraints<_Cond, _Elements...>;
1319 template<
bool _Dummy>
1320 using _ImplicitDefaultCtor = __enable_if_t<
1321 _TCC<_Dummy>::__is_implicitly_default_constructible(),
1325 template<
bool _Dummy>
1326 using _ExplicitDefaultCtor = __enable_if_t<
1327 _TCC<_Dummy>::__is_explicitly_default_constructible(),
1331 template<
bool _Cond,
typename... _Args>
1332 using _ImplicitCtor = __enable_if_t<
1333 _TCC<_Cond>::template __is_implicitly_constructible<_Args...>(),
1337 template<
bool _Cond,
typename... _Args>
1338 using _ExplicitCtor = __enable_if_t<
1339 _TCC<_Cond>::template __is_explicitly_constructible<_Args...>(),
1343 template<
typename... _UElements>
1344 static constexpr bool __nothrow_constructible()
1347 __and_<is_nothrow_constructible<_Elements, _UElements>...>::value;
1351 template<
typename _Up>
1352 static constexpr bool __valid_args()
1354 return sizeof...(_Elements) == 1
1355 && !
is_same<tuple, __remove_cvref_t<_Up>>::value;
1359 template<
typename,
typename,
typename... _Tail>
1360 static constexpr bool __valid_args()
1361 {
return (
sizeof...(_Tail) + 2) ==
sizeof...(_Elements); }
1372 template<
typename _Tuple,
typename = tuple,
1373 typename = __remove_cvref_t<_Tuple>>
1374 struct _UseOtherCtor
1379 template<
typename _Tuple,
typename _Tp,
typename _Up>
1380 struct _UseOtherCtor<_Tuple, tuple<_Tp>, tuple<_Up>>
1381 : __or_<is_convertible<_Tuple, _Tp>, is_constructible<_Tp, _Tuple>>::type
1385 template<
typename _Tuple,
typename _Tp>
1386 struct _UseOtherCtor<_Tuple, tuple<_Tp>, tuple<_Tp>>
1393 template<
typename _Tuple>
1394 static constexpr bool __use_other_ctor()
1395 {
return _UseOtherCtor<_Tuple>::value; }
1398#undef __glibcxx_no_dangling_refs
1399#if __has_builtin(__reference_constructs_from_temporary) \
1400 && defined _GLIBCXX_DEBUG
1402# if __cpp_fold_expressions
1403# define __glibcxx_dangling_refs(U) \
1404 (__reference_constructs_from_temporary(_Elements, U) || ...)
1406# define __glibcxx_dangling_refs(U) \
1407 __or_<__bool_constant<__reference_constructs_from_temporary(_Elements, U) \
1410# define __glibcxx_no_dangling_refs(U) \
1411 static_assert(!__glibcxx_dangling_refs(U), \
1412 "std::tuple constructor creates a dangling reference")
1414# define __glibcxx_no_dangling_refs(U)
1419 template<
typename _Dummy = void,
1420 _ImplicitDefaultCtor<is_void<_Dummy>::value> =
true>
1423 noexcept(__and_<is_nothrow_default_constructible<_Elements>...>::value)
1426 template<
typename _Dummy = void,
1427 _ExplicitDefaultCtor<is_void<_Dummy>::value> =
false>
1430 noexcept(__and_<is_nothrow_default_constructible<_Elements>...>::value)
1433 template<
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
1434 _ImplicitCtor<_NotEmpty, const _Elements&...> =
true>
1436 tuple(
const __type_identity_t<_Elements>&... __elements)
1437 noexcept(__nothrow_constructible<
const _Elements&...>())
1438 : _Inherited(__elements...) { }
1440 template<
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
1441 _ExplicitCtor<_NotEmpty, const _Elements&...> =
false>
1443 tuple(
const __type_identity_t<_Elements>&... __elements)
1444 noexcept(__nothrow_constructible<
const _Elements&...>())
1445 : _Inherited(__elements...) { }
1447 template<
typename... _UElements,
1448 bool _Valid = __valid_args<_UElements...>(),
1449 _ImplicitCtor<_Valid, _UElements...> =
true>
1451 tuple(_UElements&&... __elements)
1452 noexcept(__nothrow_constructible<_UElements...>())
1454 { __glibcxx_no_dangling_refs(_UElements&&); }
1456 template<
typename... _UElements,
1457 bool _Valid = __valid_args<_UElements...>(),
1458 _ExplicitCtor<_Valid, _UElements...> =
false>
1460 tuple(_UElements&&... __elements)
1461 noexcept(__nothrow_constructible<_UElements...>())
1463 { __glibcxx_no_dangling_refs(_UElements&&); }
1465 constexpr tuple(
const tuple&) =
default;
1467 constexpr tuple(tuple&&) =
default;
1469 template<
typename... _UElements,
1470 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1471 && !__use_other_ctor<
const tuple<_UElements...>&>(),
1472 _ImplicitCtor<_Valid,
const _UElements&...> =
true>
1474 tuple(
const tuple<_UElements...>& __in)
1475 noexcept(__nothrow_constructible<
const _UElements&...>())
1476 : _Inherited(
static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
1477 { __glibcxx_no_dangling_refs(
const _UElements&); }
1479 template<
typename... _UElements,
1480 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1481 && !__use_other_ctor<
const tuple<_UElements...>&>(),
1482 _ExplicitCtor<_Valid,
const _UElements&...> =
false>
1484 tuple(
const tuple<_UElements...>& __in)
1485 noexcept(__nothrow_constructible<
const _UElements&...>())
1486 : _Inherited(
static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
1487 { __glibcxx_no_dangling_refs(
const _UElements&); }
1489 template<
typename... _UElements,
1490 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1491 && !__use_other_ctor<tuple<_UElements...>&&>(),
1492 _ImplicitCtor<_Valid, _UElements...> =
true>
1494 tuple(tuple<_UElements...>&& __in)
1495 noexcept(__nothrow_constructible<_UElements...>())
1496 : _Inherited(
static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
1497 { __glibcxx_no_dangling_refs(_UElements&&); }
1499 template<
typename... _UElements,
1500 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1501 && !__use_other_ctor<tuple<_UElements...>&&>(),
1502 _ExplicitCtor<_Valid, _UElements...> =
false>
1504 tuple(tuple<_UElements...>&& __in)
1505 noexcept(__nothrow_constructible<_UElements...>())
1506 : _Inherited(
static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
1507 { __glibcxx_no_dangling_refs(_UElements&&); }
1511 template<
typename _Alloc,
1512 _ImplicitDefaultCtor<is_object<_Alloc>::value> =
true>
1513 _GLIBCXX20_CONSTEXPR
1514 tuple(allocator_arg_t __tag,
const _Alloc& __a)
1515 : _Inherited(__tag, __a) { }
1517 template<
typename _Alloc,
1518 _ExplicitDefaultCtor<is_object<_Alloc>::value> =
false>
1519 _GLIBCXX20_CONSTEXPR
1521 tuple(allocator_arg_t __tag,
const _Alloc& __a)
1522 : _Inherited(__tag, __a) { }
1524 template<
typename _Alloc,
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
1525 _ImplicitCtor<_NotEmpty, const _Elements&...> =
true>
1526 _GLIBCXX20_CONSTEXPR
1527 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1528 const __type_identity_t<_Elements>&... __elements)
1529 : _Inherited(__tag, __a, __elements...) { }
1531 template<
typename _Alloc,
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
1532 _ExplicitCtor<_NotEmpty, const _Elements&...> =
false>
1533 _GLIBCXX20_CONSTEXPR
1535 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1536 const __type_identity_t<_Elements>&... __elements)
1537 : _Inherited(__tag, __a, __elements...) { }
1539 template<
typename _Alloc,
typename... _UElements,
1540 bool _Valid = __valid_args<_UElements...>(),
1541 _ImplicitCtor<_Valid, _UElements...> =
true>
1542 _GLIBCXX20_CONSTEXPR
1543 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1544 _UElements&&... __elements)
1546 { __glibcxx_no_dangling_refs(_UElements&&); }
1548 template<
typename _Alloc,
typename... _UElements,
1549 bool _Valid = __valid_args<_UElements...>(),
1550 _ExplicitCtor<_Valid, _UElements...> =
false>
1551 _GLIBCXX20_CONSTEXPR
1553 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1554 _UElements&&... __elements)
1556 { __glibcxx_no_dangling_refs(_UElements&&); }
1558 template<
typename _Alloc>
1559 _GLIBCXX20_CONSTEXPR
1560 tuple(allocator_arg_t __tag,
const _Alloc& __a,
const tuple& __in)
1561 : _Inherited(__tag, __a,
static_cast<const _Inherited&
>(__in)) { }
1563 template<
typename _Alloc>
1564 _GLIBCXX20_CONSTEXPR
1565 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple&& __in)
1566 : _Inherited(__tag, __a,
static_cast<_Inherited&&
>(__in)) { }
1568 template<
typename _Alloc,
typename... _UElements,
1569 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1570 && !__use_other_ctor<
const tuple<_UElements...>&>(),
1571 _ImplicitCtor<_Valid,
const _UElements&...> =
true>
1572 _GLIBCXX20_CONSTEXPR
1573 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1574 const tuple<_UElements...>& __in)
1575 : _Inherited(__tag, __a,
1576 static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
1577 { __glibcxx_no_dangling_refs(
const _UElements&); }
1579 template<
typename _Alloc,
typename... _UElements,
1580 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1581 && !__use_other_ctor<
const tuple<_UElements...>&>(),
1582 _ExplicitCtor<_Valid,
const _UElements&...> =
false>
1583 _GLIBCXX20_CONSTEXPR
1585 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1586 const tuple<_UElements...>& __in)
1587 : _Inherited(__tag, __a,
1588 static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
1589 { __glibcxx_no_dangling_refs(
const _UElements&); }
1591 template<
typename _Alloc,
typename... _UElements,
1592 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1593 && !__use_other_ctor<tuple<_UElements...>&&>(),
1594 _ImplicitCtor<_Valid, _UElements...> =
true>
1595 _GLIBCXX20_CONSTEXPR
1596 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1597 tuple<_UElements...>&& __in)
1598 : _Inherited(__tag, __a,
1599 static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
1600 { __glibcxx_no_dangling_refs(_UElements&&); }
1602 template<
typename _Alloc,
typename... _UElements,
1603 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1604 && !__use_other_ctor<tuple<_UElements...>&&>(),
1605 _ExplicitCtor<_Valid, _UElements...> =
false>
1606 _GLIBCXX20_CONSTEXPR
1608 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1609 tuple<_UElements...>&& __in)
1610 : _Inherited(__tag, __a,
1611 static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
1612 { __glibcxx_no_dangling_refs(_UElements&&); }
1617#if __cpp_concepts && __cpp_consteval
1619 template<
typename... _UTypes>
1620 static consteval bool
1623 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
1629 template<
typename... _UTypes>
1630 static consteval bool
1631 __nothrow_assignable()
1633 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
1639#if __cpp_lib_ranges_zip
1640 template<
typename... _UTypes>
1641 static consteval bool
1642 __const_assignable()
1644 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
1651#if __cpp_lib_tuple_like
1652 template<
typename _UTuple>
1653 static consteval bool
1654 __assignable_from_tuple_like()
1661 template<
typename _UTuple>
1662 static consteval bool
1663 __const_assignable_from_tuple_like()
1673 tuple& operator=(
const tuple& __u) =
delete;
1676 operator=(
const tuple& __u)
1677 noexcept(__nothrow_assignable<
const _Elements&...>())
1678 requires (__assignable<const _Elements&...>())
1680 this->_M_assign(__u);
1685 operator=(tuple&& __u)
1686 noexcept(__nothrow_assignable<_Elements...>())
1687 requires (__assignable<_Elements...>())
1693 template<
typename... _UTypes>
1694 requires (__assignable<
const _UTypes&...>())
1696 operator=(
const tuple<_UTypes...>& __u)
1697 noexcept(__nothrow_assignable<
const _UTypes&...>())
1699 this->_M_assign(__u);
1703 template<
typename... _UTypes>
1704 requires (__assignable<_UTypes...>())
1706 operator=(tuple<_UTypes...>&& __u)
1707 noexcept(__nothrow_assignable<_UTypes...>())
1713#if __cpp_lib_ranges_zip
1714 constexpr const tuple&
1715 operator=(
const tuple& __u)
const
1716 requires (__const_assignable<
const _Elements&...>())
1718 this->_M_assign(__u);
1722 constexpr const tuple&
1723 operator=(tuple&& __u)
const
1724 requires (__const_assignable<_Elements...>())
1730 template<
typename... _UTypes>
1731 constexpr const tuple&
1732 operator=(
const tuple<_UTypes...>& __u)
const
1733 requires (__const_assignable<
const _UTypes&...>())
1735 this->_M_assign(__u);
1739 template<
typename... _UTypes>
1740 constexpr const tuple&
1741 operator=(tuple<_UTypes...>&& __u)
const
1742 requires (__const_assignable<_UTypes...>())
1749 template<
typename _U1,
typename _U2>
1750 requires (__assignable<const _U1&, const _U2&>())
1753 noexcept(__nothrow_assignable<const _U1&, const _U2&>())
1755 this->_M_head(*
this) = __u.first;
1756 this->_M_tail(*this)._M_head(*
this) = __u.second;
1760 template<
typename _U1,
typename _U2>
1761 requires (__assignable<_U1, _U2>())
1764 noexcept(__nothrow_assignable<_U1, _U2>())
1771#if __cpp_lib_ranges_zip
1772 template<
typename _U1,
typename _U2>
1773 requires (__const_assignable<const _U1&, const _U2>())
1774 constexpr const tuple&
1777 this->_M_head(*
this) = __u.first;
1778 this->_M_tail(*this)._M_head(*
this) = __u.second;
1782 template<
typename _U1,
typename _U2>
1783 requires (__const_assignable<_U1, _U2>())
1784 constexpr const tuple&
1793#if __cpp_lib_tuple_like
1794 template<__eligible_tuple_like<tuple> _UTuple>
1795 requires (__assignable_from_tuple_like<_UTuple>())
1797 operator=(_UTuple&& __u)
1803 template<__eligible_tuple_like<tuple> _UTuple>
1804 requires (__const_assignable_from_tuple_like<_UTuple>())
1805 constexpr const tuple&
1806 operator=(_UTuple&& __u)
const
1812 template<__tuple_like _UTuple>
1813 requires (!__is_tuple_v<_UTuple>)
1814 friend constexpr bool
1815 operator== [[nodiscard]] (
const tuple& __t,
const _UTuple& __u)
1817 static_assert(
sizeof...(_Elements) == tuple_size_v<_UTuple>,
1818 "tuple objects can only be compared if they have equal sizes.");
1820 return (
bool(std::get<_Is>(__t) == std::get<_Is>(__u))
1825 template<__tuple_like _UTuple,
1827 struct __tuple_like_common_comparison_category;
1829 template<__tuple_like _UTuple,
size_t... _Is>
1831 {
typename void_t<__detail::__synth3way_t<_Elements, tuple_element_t<_Is, _UTuple>>...>; }
1832 struct __tuple_like_common_comparison_category<_UTuple,
index_sequence<_Is...>>
1834 using type = common_comparison_category_t
1835 <__detail::__synth3way_t<_Elements, tuple_element_t<_Is, _UTuple>>...>;
1838 template<__tuple_like _UTuple>
1839 requires (!__is_tuple_v<_UTuple>)
1840 friend constexpr typename __tuple_like_common_comparison_category<_UTuple>::type
1841 operator<=>(
const tuple& __t,
const _UTuple& __u)
1843 using _Cat =
typename __tuple_like_common_comparison_category<_UTuple>::type;
1851 template<
typename... _UElements>
1853 __enable_if_t<
sizeof...(_UElements) ==
sizeof...(_Elements),
bool>
1855 {
return __and_<is_assignable<_Elements&, _UElements>...>::value; }
1858 template<
typename... _UElements>
1859 static constexpr bool __nothrow_assignable()
1862 __and_<is_nothrow_assignable<_Elements&, _UElements>...>::value;
1867 _GLIBCXX20_CONSTEXPR
1869 operator=(__conditional_t<__assignable<const _Elements&...>(),
1871 const __nonesuch&> __in)
1872 noexcept(__nothrow_assignable<
const _Elements&...>())
1874 this->_M_assign(__in);
1878 _GLIBCXX20_CONSTEXPR
1880 operator=(__conditional_t<__assignable<_Elements...>(),
1883 noexcept(__nothrow_assignable<_Elements...>())
1889 template<
typename... _UElements>
1890 _GLIBCXX20_CONSTEXPR
1891 __enable_if_t<__assignable<
const _UElements&...>(), tuple&>
1892 operator=(
const tuple<_UElements...>& __in)
1893 noexcept(__nothrow_assignable<
const _UElements&...>())
1895 this->_M_assign(__in);
1899 template<
typename... _UElements>
1900 _GLIBCXX20_CONSTEXPR
1901 __enable_if_t<__assignable<_UElements...>(), tuple&>
1902 operator=(tuple<_UElements...>&& __in)
1903 noexcept(__nothrow_assignable<_UElements...>())
1911 _GLIBCXX20_CONSTEXPR
1914 noexcept(__and_<__is_nothrow_swappable<_Elements>...>::value)
1915 { _Inherited::_M_swap(__in); }
1917#if __cpp_lib_ranges_zip
1925 swap(
const tuple& __in)
const
1926 noexcept(__and_v<__is_nothrow_swappable<const _Elements>...>)
1927 requires (is_swappable_v<const _Elements> && ...)
1928 { _Inherited::_M_swap(__in); }
2026 class tuple<_T1, _T2> :
public _Tuple_impl<0, _T1, _T2>
2028 typedef _Tuple_impl<0, _T1, _T2> _Inherited;
2031 template<
bool _Dummy,
typename _U1,
typename _U2>
2032 using _ImplicitDefaultCtor = __enable_if_t<
2033 _TupleConstraints<_Dummy, _U1, _U2>::
2034 __is_implicitly_default_constructible(),
2038 template<
bool _Dummy,
typename _U1,
typename _U2>
2039 using _ExplicitDefaultCtor = __enable_if_t<
2040 _TupleConstraints<_Dummy, _U1, _U2>::
2041 __is_explicitly_default_constructible(),
2044 template<
bool _Dummy>
2045 using _TCC = _TupleConstraints<_Dummy, _T1, _T2>;
2048 template<
bool _Cond,
typename _U1,
typename _U2>
2049 using _ImplicitCtor = __enable_if_t<
2050 _TCC<_Cond>::template __is_implicitly_constructible<_U1, _U2>(),
2054 template<
bool _Cond,
typename _U1,
typename _U2>
2055 using _ExplicitCtor = __enable_if_t<
2056 _TCC<_Cond>::template __is_explicitly_constructible<_U1, _U2>(),
2059 template<
typename _U1,
typename _U2>
2060 static constexpr bool __assignable()
2062 return __and_<is_assignable<_T1&, _U1>,
2066 template<
typename _U1,
typename _U2>
2067 static constexpr bool __nothrow_assignable()
2069 return __and_<is_nothrow_assignable<_T1&, _U1>,
2073 template<
typename _U1,
typename _U2>
2074 static constexpr bool __nothrow_constructible()
2076 return __and_<is_nothrow_constructible<_T1, _U1>,
2080 static constexpr bool __nothrow_default_constructible()
2082 return __and_<is_nothrow_default_constructible<_T1>,
2086 template<
typename _U1>
2087 static constexpr bool __is_alloc_arg()
2091#undef __glibcxx_no_dangling_refs
2093#if __has_builtin(__reference_constructs_from_temporary) \
2094 && defined _GLIBCXX_DEBUG
2095# define __glibcxx_no_dangling_refs(_U1, _U2) \
2096 static_assert(!__reference_constructs_from_temporary(_T1, _U1) \
2097 && !__reference_constructs_from_temporary(_T2, _U2), \
2098 "std::tuple constructor creates a dangling reference")
2100# define __glibcxx_no_dangling_refs(_U1, _U2)
2105 template<
bool _Dummy =
true,
2106 _ImplicitDefaultCtor<_Dummy, _T1, _T2> =
true>
2109 noexcept(__nothrow_default_constructible())
2112 template<
bool _Dummy =
true,
2113 _ExplicitDefaultCtor<_Dummy, _T1, _T2> =
false>
2116 noexcept(__nothrow_default_constructible())
2119 template<
bool _Dummy =
true,
2120 _ImplicitCtor<_Dummy, const _T1&, const _T2&> =
true>
2122 tuple(
const _T1& __a1,
const _T2& __a2)
2123 noexcept(__nothrow_constructible<const _T1&, const _T2&>())
2124 : _Inherited(__a1, __a2) { }
2126 template<
bool _Dummy =
true,
2127 _ExplicitCtor<_Dummy, const _T1&, const _T2&> =
false>
2129 tuple(
const _T1& __a1,
const _T2& __a2)
2130 noexcept(__nothrow_constructible<const _T1&, const _T2&>())
2131 : _Inherited(__a1, __a2) { }
2133 template<
typename _U1,
typename _U2,
2134 _ImplicitCtor<!__is_alloc_arg<_U1>(), _U1, _U2> =
true>
2136 tuple(_U1&& __a1, _U2&& __a2)
2137 noexcept(__nothrow_constructible<_U1, _U2>())
2139 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2141 template<
typename _U1,
typename _U2,
2142 _ExplicitCtor<!__is_alloc_arg<_U1>(), _U1, _U2> =
false>
2144 tuple(_U1&& __a1, _U2&& __a2)
2145 noexcept(__nothrow_constructible<_U1, _U2>())
2147 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2149 constexpr tuple(
const tuple&) =
default;
2151 constexpr tuple(tuple&&) =
default;
2153 template<
typename _U1,
typename _U2,
2154 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
2156 tuple(
const tuple<_U1, _U2>& __in)
2157 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
2158 : _Inherited(
static_cast<const _Tuple_impl<0, _U1, _U2>&
>(__in))
2159 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2161 template<
typename _U1,
typename _U2,
2162 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
2164 tuple(
const tuple<_U1, _U2>& __in)
2165 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
2166 : _Inherited(
static_cast<const _Tuple_impl<0, _U1, _U2>&
>(__in))
2167 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2169 template<
typename _U1,
typename _U2,
2170 _ImplicitCtor<true, _U1, _U2> =
true>
2172 tuple(tuple<_U1, _U2>&& __in)
2173 noexcept(__nothrow_constructible<_U1, _U2>())
2174 : _Inherited(
static_cast<_Tuple_impl<0, _U1, _U2>&&
>(__in))
2175 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2177 template<
typename _U1,
typename _U2,
2178 _ExplicitCtor<true, _U1, _U2> =
false>
2180 tuple(tuple<_U1, _U2>&& __in)
2181 noexcept(__nothrow_constructible<_U1, _U2>())
2182 : _Inherited(
static_cast<_Tuple_impl<0, _U1, _U2>&&
>(__in))
2183 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2185 template<
typename _U1,
typename _U2,
2186 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
2189 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
2190 : _Inherited(__in.first, __in.second)
2191 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2193 template<
typename _U1,
typename _U2,
2194 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
2197 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
2198 : _Inherited(__in.first, __in.second)
2199 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2201 template<
typename _U1,
typename _U2,
2202 _ImplicitCtor<true, _U1, _U2> =
true>
2205 noexcept(__nothrow_constructible<_U1, _U2>())
2208 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2210 template<
typename _U1,
typename _U2,
2211 _ExplicitCtor<true, _U1, _U2> =
false>
2214 noexcept(__nothrow_constructible<_U1, _U2>())
2217 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2221 template<
typename _Alloc,
2222 _ImplicitDefaultCtor<is_object<_Alloc>::value, _T1, _T2> =
true>
2223 _GLIBCXX20_CONSTEXPR
2224 tuple(allocator_arg_t __tag,
const _Alloc& __a)
2225 : _Inherited(__tag, __a) { }
2227 template<
typename _Alloc,
2228 _ExplicitDefaultCtor<is_object<_Alloc>::value, _T1, _T2> =
false>
2229 _GLIBCXX20_CONSTEXPR
2231 tuple(allocator_arg_t __tag,
const _Alloc& __a)
2232 : _Inherited(__tag, __a) { }
2234 template<
typename _Alloc,
bool _Dummy =
true,
2235 _ImplicitCtor<_Dummy, const _T1&, const _T2&> =
true>
2236 _GLIBCXX20_CONSTEXPR
2237 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2238 const _T1& __a1,
const _T2& __a2)
2239 : _Inherited(__tag, __a, __a1, __a2) { }
2241 template<
typename _Alloc,
bool _Dummy =
true,
2242 _ExplicitCtor<_Dummy, const _T1&, const _T2&> =
false>
2244 _GLIBCXX20_CONSTEXPR
2245 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2246 const _T1& __a1,
const _T2& __a2)
2247 : _Inherited(__tag, __a, __a1, __a2) { }
2249 template<
typename _Alloc,
typename _U1,
typename _U2,
2250 _ImplicitCtor<true, _U1, _U2> =
true>
2251 _GLIBCXX20_CONSTEXPR
2252 tuple(allocator_arg_t __tag,
const _Alloc& __a, _U1&& __a1, _U2&& __a2)
2255 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2257 template<
typename _Alloc,
typename _U1,
typename _U2,
2258 _ExplicitCtor<true, _U1, _U2> =
false>
2260 _GLIBCXX20_CONSTEXPR
2261 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2262 _U1&& __a1, _U2&& __a2)
2265 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2267 template<
typename _Alloc>
2268 _GLIBCXX20_CONSTEXPR
2269 tuple(allocator_arg_t __tag,
const _Alloc& __a,
const tuple& __in)
2270 : _Inherited(__tag, __a,
static_cast<const _Inherited&
>(__in)) { }
2272 template<
typename _Alloc>
2273 _GLIBCXX20_CONSTEXPR
2274 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple&& __in)
2275 : _Inherited(__tag, __a,
static_cast<_Inherited&&
>(__in)) { }
2277 template<
typename _Alloc,
typename _U1,
typename _U2,
2278 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
2279 _GLIBCXX20_CONSTEXPR
2280 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2281 const tuple<_U1, _U2>& __in)
2282 : _Inherited(__tag, __a,
2283 static_cast<const _Tuple_impl<0, _U1, _U2>&
>(__in))
2284 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2286 template<
typename _Alloc,
typename _U1,
typename _U2,
2287 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
2289 _GLIBCXX20_CONSTEXPR
2290 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2291 const tuple<_U1, _U2>& __in)
2292 : _Inherited(__tag, __a,
2293 static_cast<const _Tuple_impl<0, _U1, _U2>&
>(__in))
2294 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2296 template<
typename _Alloc,
typename _U1,
typename _U2,
2297 _ImplicitCtor<true, _U1, _U2> =
true>
2298 _GLIBCXX20_CONSTEXPR
2299 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple<_U1, _U2>&& __in)
2300 : _Inherited(__tag, __a,
static_cast<_Tuple_impl<0, _U1, _U2>&&
>(__in))
2301 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2303 template<
typename _Alloc,
typename _U1,
typename _U2,
2304 _ExplicitCtor<true, _U1, _U2> =
false>
2306 _GLIBCXX20_CONSTEXPR
2307 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple<_U1, _U2>&& __in)
2308 : _Inherited(__tag, __a,
static_cast<_Tuple_impl<0, _U1, _U2>&&
>(__in))
2309 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2311 template<
typename _Alloc,
typename _U1,
typename _U2,
2312 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
2313 _GLIBCXX20_CONSTEXPR
2314 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2316 : _Inherited(__tag, __a, __in.first, __in.second)
2317 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2319 template<
typename _Alloc,
typename _U1,
typename _U2,
2320 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
2322 _GLIBCXX20_CONSTEXPR
2323 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2325 : _Inherited(__tag, __a, __in.first, __in.second)
2326 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2328 template<
typename _Alloc,
typename _U1,
typename _U2,
2329 _ImplicitCtor<true, _U1, _U2> =
true>
2330 _GLIBCXX20_CONSTEXPR
2331 tuple(allocator_arg_t __tag,
const _Alloc& __a,
pair<_U1, _U2>&& __in)
2334 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2336 template<
typename _Alloc,
typename _U1,
typename _U2,
2337 _ExplicitCtor<true, _U1, _U2> =
false>
2339 _GLIBCXX20_CONSTEXPR
2340 tuple(allocator_arg_t __tag,
const _Alloc& __a,
pair<_U1, _U2>&& __in)
2343 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2347 _GLIBCXX20_CONSTEXPR
2349 operator=(__conditional_t<__assignable<const _T1&, const _T2&>(),
2351 const __nonesuch&> __in)
2352 noexcept(__nothrow_assignable<const _T1&, const _T2&>())
2354 this->_M_assign(__in);
2358 _GLIBCXX20_CONSTEXPR
2360 operator=(__conditional_t<__assignable<_T1, _T2>(),
2363 noexcept(__nothrow_assignable<_T1, _T2>())
2369 template<
typename _U1,
typename _U2>
2370 _GLIBCXX20_CONSTEXPR
2371 __enable_if_t<__assignable<const _U1&, const _U2&>(), tuple&>
2372 operator=(
const tuple<_U1, _U2>& __in)
2373 noexcept(__nothrow_assignable<const _U1&, const _U2&>())
2375 this->_M_assign(__in);
2379 template<
typename _U1,
typename _U2>
2380 _GLIBCXX20_CONSTEXPR
2381 __enable_if_t<__assignable<_U1, _U2>(), tuple&>
2382 operator=(tuple<_U1, _U2>&& __in)
2383 noexcept(__nothrow_assignable<_U1, _U2>())
2389 template<
typename _U1,
typename _U2>
2390 _GLIBCXX20_CONSTEXPR
2391 __enable_if_t<__assignable<const _U1&, const _U2&>(), tuple&>
2393 noexcept(__nothrow_assignable<const _U1&, const _U2&>())
2395 this->_M_head(*
this) = __in.first;
2396 this->_M_tail(*this)._M_head(*
this) = __in.second;
2400 template<
typename _U1,
typename _U2>
2401 _GLIBCXX20_CONSTEXPR
2402 __enable_if_t<__assignable<_U1, _U2>(), tuple&>
2404 noexcept(__nothrow_assignable<_U1, _U2>())
2411 _GLIBCXX20_CONSTEXPR
2414 noexcept(__and_<__is_nothrow_swappable<_T1>,
2415 __is_nothrow_swappable<_T2>>::value)
2416 { _Inherited::_M_swap(__in); }