[libcxx-commits] [libcxx] 6d663cd - [libc++] Simplify tuple_cat further (#163741)
via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Oct 20 03:54:34 PDT 2025
Author: Nikolas Klauser
Date: 2025-10-20T12:54:30+02:00
New Revision: 6d663cd365df4e9373e60484c9b67965d01ab4a1
URL: https://github.com/llvm/llvm-project/commit/6d663cd365df4e9373e60484c9b67965d01ab4a1
DIFF: https://github.com/llvm/llvm-project/commit/6d663cd365df4e9373e60484c9b67965d01ab4a1.diff
LOG: [libc++] Simplify tuple_cat further (#163741)
Added:
Modified:
libcxx/include/CMakeLists.txt
libcxx/include/module.modulemap.in
libcxx/include/tuple
Removed:
libcxx/include/__tuple/tuple_like_ext.h
################################################################################
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index ddace8bf8c728..dd1e71380e7fc 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -782,7 +782,6 @@ set(files
__tuple/sfinae_helpers.h
__tuple/tuple_element.h
__tuple/tuple_like.h
- __tuple/tuple_like_ext.h
__tuple/tuple_like_no_subrange.h
__tuple/tuple_size.h
__tuple/tuple_types.h
diff --git a/libcxx/include/__tuple/tuple_like_ext.h b/libcxx/include/__tuple/tuple_like_ext.h
deleted file mode 100644
index 5a6748a9cc79d..0000000000000
--- a/libcxx/include/__tuple/tuple_like_ext.h
+++ /dev/null
@@ -1,41 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___TUPLE_TUPLE_LIKE_EXT_H
-#define _LIBCPP___TUPLE_TUPLE_LIKE_EXT_H
-
-#include <__config>
-#include <__cstddef/size_t.h>
-#include <__fwd/array.h>
-#include <__fwd/pair.h>
-#include <__fwd/tuple.h>
-#include <__type_traits/integral_constant.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-template <class _Tp>
-struct __tuple_like_ext : false_type {};
-
-#ifndef _LIBCPP_CXX03_LANG
-template <class... _Tp>
-struct __tuple_like_ext<tuple<_Tp...> > : true_type {};
-#endif
-
-template <class _T1, class _T2>
-struct __tuple_like_ext<pair<_T1, _T2> > : true_type {};
-
-template <class _Tp, size_t _Size>
-struct __tuple_like_ext<array<_Tp, _Size> > : true_type {};
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___TUPLE_TUPLE_LIKE_EXT_H
diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in
index 894093b409e11..a86d6c6a43d0e 100644
--- a/libcxx/include/module.modulemap.in
+++ b/libcxx/include/module.modulemap.in
@@ -2115,7 +2115,6 @@ module std [system] {
module ignore { header "__tuple/ignore.h" }
module sfinae_helpers { header "__tuple/sfinae_helpers.h" }
module tuple_element { header "__tuple/tuple_element.h" }
- module tuple_like_ext { header "__tuple/tuple_like_ext.h" }
module tuple_like_no_subrange { header "__tuple/tuple_like_no_subrange.h" }
module tuple_like { header "__tuple/tuple_like.h" }
module tuple_size { header "__tuple/tuple_size.h" }
diff --git a/libcxx/include/tuple b/libcxx/include/tuple
index b0d0c38b115a2..5f3bb72e0678b 100644
--- a/libcxx/include/tuple
+++ b/libcxx/include/tuple
@@ -234,7 +234,6 @@ template <class... Types>
# include <__tuple/ignore.h>
# include <__tuple/tuple_element.h>
# include <__tuple/tuple_like.h>
-# include <__tuple/tuple_like_ext.h>
# include <__tuple/tuple_size.h>
# include <__tuple/tuple_types.h>
# include <__type_traits/common_reference.h>
@@ -1273,15 +1272,19 @@ operator<=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) {
template <class... _Tuples>
struct __tuple_cat_return_impl;
-template <class _Tuple>
-struct __tuple_cat_return_impl<_Tuple> {
- using type _LIBCPP_NODEBUG = _Tuple;
+template <class... _Types>
+struct __tuple_cat_return_impl<tuple<_Types...>> {
+ using type _LIBCPP_NODEBUG = tuple<_Types...>;
};
-template <class... _Types0, template <class...> class _Tuple, class... _Types1, class... _Tuples>
-struct __tuple_cat_return_impl<tuple<_Types0...>, _Tuple<_Types1...>, _Tuples...>
+template <class... _Types0, class... _Types1, class... _Tuples>
+struct __tuple_cat_return_impl<tuple<_Types0...>, tuple<_Types1...>, _Tuples...>
: __tuple_cat_return_impl<tuple<_Types0..., _Types1...>, _Tuples...> {};
+template <class... _Types0, class _Tp, class _Up, class... _Tuples>
+struct __tuple_cat_return_impl<tuple<_Types0...>, pair<_Tp, _Up>, _Tuples...>
+ : __tuple_cat_return_impl<tuple<_Types0..., _Tp, _Up>, _Tuples...> {};
+
template <class, class, class>
struct __tuple_cat_array;
@@ -1369,11 +1372,7 @@ __tuple_cat_select_element_wise(_TupleSrc&& __src, __index_sequence<_Indices...>
return _TupleDst(std::get<_Indices>(std::forward<_TupleSrc>(__src))...);
}
-template <class _Tuple0,
- class... _Tuples,
- __enable_if_t<
- _And<__tuple_like_ext<__remove_cvref_t<_Tuple0>>, __tuple_like_ext<__remove_cvref_t<_Tuples>>...>::value,
- int> = 0>
+template <class _Tuple0, class... _Tuples>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __tuple_cat_return_t<_Tuple0, _Tuples...>
tuple_cat(_Tuple0&& __t0, _Tuples&&... __tpls) {
using _T0 _LIBCPP_NODEBUG = __libcpp_remove_reference_t<_Tuple0>;
More information about the libcxx-commits
mailing list