@@ -1338,12 +1338,25 @@ struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J
13381338 }
13391339};
13401340
1341+ template <class _TupleDst , class _TupleSrc , size_t ... _Indices>
1342+ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _TupleDst
1343+ __tuple_cat_select_element_wise (_TupleSrc&& __src, __tuple_indices<_Indices...>) {
1344+ static_assert (tuple_size<_TupleDst>::value == tuple_size<_TupleSrc>::value,
1345+ " misuse of __tuple_cat_select_element_wise with tuples of different sizes" );
1346+ return _TupleDst (std::get<_Indices>(std::forward<_TupleSrc>(__src))...);
1347+ }
1348+
13411349template <class _Tuple0 , class ... _Tuples>
13421350inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename __tuple_cat_return<_Tuple0, _Tuples...>::type
13431351tuple_cat (_Tuple0&& __t0, _Tuples&&... __tpls) {
1344- using _T0 _LIBCPP_NODEBUG = __libcpp_remove_reference_t <_Tuple0>;
1345- return __tuple_cat<tuple<>, __tuple_indices<>, typename __make_tuple_indices<tuple_size<_T0>::value>::type>()(
1346- tuple<>(), std::forward<_Tuple0>(__t0), std::forward<_Tuples>(__tpls)...);
1352+ using _T0 _LIBCPP_NODEBUG = __libcpp_remove_reference_t <_Tuple0>;
1353+ using _TRet _LIBCPP_NODEBUG = typename __tuple_cat_return<_Tuple0, _Tuples...>::type;
1354+ using _T0Indices _LIBCPP_NODEBUG = typename __make_tuple_indices<tuple_size<_T0>::value>::type;
1355+ using _TRetIndices _LIBCPP_NODEBUG = typename __make_tuple_indices<tuple_size<_TRet>::value>::type;
1356+ return std::__tuple_cat_select_element_wise<_TRet>(
1357+ __tuple_cat<tuple<>, __tuple_indices<>, _T0Indice>()(
1358+ tuple<>(), std::forward<_Tuple0>(__t0), std::forward<_Tuples>(__tpls)...),
1359+ _TRetIndice ());
13471360}
13481361
13491362template <class ... _Tp, class _Alloc >
0 commit comments