Skip to content

Conversation

philnik777
Copy link
Contributor

This reduces the compile time quite a bit, since calls to std::get don't instantiate tuple_element anymore.

Copy link

github-actions bot commented Sep 4, 2025

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff origin/main HEAD --extensions ,h -- libcxx/include/__config libcxx/include/__fwd/pair.h libcxx/include/__fwd/tuple.h libcxx/include/__utility/pair.h libcxx/include/tuple

⚠️
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing origin/main to the base branch/commit you want to compare against.
⚠️

View the diff from clang-format here.
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 2d6c063d6..58df15aa0 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -573,7 +573,7 @@ typedef __char32_t char32_t;
       _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++17-extensions")                                                             \
       _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++20-extensions")                                                             \
       _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++23-extensions")
-      _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++26-extensions")
+_LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++26-extensions")
 #    define _LIBCPP_POP_EXTENSION_DIAGNOSTICS _LIBCPP_DIAGNOSTIC_POP
 #  else
 #    define _LIBCPP_PUSH_EXTENSION_DIAGNOSTICS
diff --git a/libcxx/include/tuple b/libcxx/include/tuple
index 7bc77f9cc..1e4635e65 100644
--- a/libcxx/include/tuple
+++ b/libcxx/include/tuple
@@ -1119,23 +1119,24 @@ swap(const tuple<_Tp...>& __lhs,
 // get
 
 template <size_t _Ip, class... _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp...[_Ip]& get(tuple<_Tp...>& __t) _NOEXCEPT {
-  return static_cast<__tuple_leaf<_Ip, _Tp...[_Ip]>&>(__t.__base_).get();
-}
-
-template <size_t _Ip, class... _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp...[_Ip]& get(const tuple<_Tp...>& __t) _NOEXCEPT {
-  return static_cast<const __tuple_leaf<_Ip, _Tp...[_Ip]>&>(__t.__base_).get();
-}
-
-template <size_t _Ip, class... _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp...[_Ip]&& get(tuple<_Tp...>&& __t) _NOEXCEPT {
+        _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp... [_Ip] &
+        get(tuple<_Tp...>& __t) _NOEXCEPT { return static_cast<__tuple_leaf<_Ip, _Tp...[_Ip]>&>(__t.__base_).get(); }
+
+        template <size_t _Ip, class... _Tp>
+        _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp... [_Ip] &
+        get(const tuple<_Tp...>& __t) _NOEXCEPT {
+          return static_cast<const __tuple_leaf<_Ip, _Tp...[_Ip]>&>(__t.__base_).get();
+        }
+
+        template <size_t _Ip, class... _Tp>
+        _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp...[_Ip] &&
+    get(tuple<_Tp...>&& __t) _NOEXCEPT {
   using type _LIBCPP_NODEBUG = _Tp...[_Ip];
   return static_cast<type&&>(static_cast<__tuple_leaf<_Ip, type>&&>(__t.__base_).get());
 }
 
 template <size_t _Ip, class... _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp...[_Ip]&& get(const tuple<_Tp...>&& __t) _NOEXCEPT {
+    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp...[_Ip] && get(const tuple<_Tp...>&& __t) _NOEXCEPT {
   using type _LIBCPP_NODEBUG = _Tp...[_Ip];
   return static_cast<const type&&>(static_cast<const __tuple_leaf<_Ip, type>&&>(__t.__base_).get());
 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant