[libcxx-commits] [libcxx] [libc++] Remove pair dependency (PR #85621)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Mar 18 02:50:22 PDT 2024
https://github.com/philnik777 created https://github.com/llvm/llvm-project/pull/85621
This moves the definition of a `pair` constructor for `<tuple>` to `<__utility/pair.h>` and uses the forward declaration of `pair` in `<tuple>` instead of including the definiton.
>From ee2d77be4bca5f970f0f5970b2e327bb57d9a4c2 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Mon, 18 Mar 2024 10:49:05 +0100
Subject: [PATCH] [libc++] Remove pair dependency
---
libcxx/include/__utility/pair.h | 4 +++-
libcxx/include/tuple | 13 +------------
2 files changed, 4 insertions(+), 13 deletions(-)
diff --git a/libcxx/include/__utility/pair.h b/libcxx/include/__utility/pair.h
index 0056806877e13c..bcb0397b374772 100644
--- a/libcxx/include/__utility/pair.h
+++ b/libcxx/include/__utility/pair.h
@@ -440,7 +440,9 @@ struct _LIBCPP_TEMPLATE_VIS pair
tuple<_Args1...>& __first_args,
tuple<_Args2...>& __second_args,
__tuple_indices<_I1...>,
- __tuple_indices<_I2...>);
+ __tuple_indices<_I2...>)
+ : first(std::forward<_Args1>(std::get<_I1>(__first_args))...),
+ second(std::forward<_Args2>(std::get<_I2>(__second_args))...) {}
#endif
};
diff --git a/libcxx/include/tuple b/libcxx/include/tuple
index f78db061b844b0..b6df25663909f9 100644
--- a/libcxx/include/tuple
+++ b/libcxx/include/tuple
@@ -210,6 +210,7 @@ template <class... Types>
#include <__config>
#include <__functional/invoke.h>
#include <__fwd/array.h>
+#include <__fwd/pair.h>
#include <__fwd/tuple.h>
#include <__memory/allocator_arg_t.h>
#include <__memory/uses_allocator.h>
@@ -250,7 +251,6 @@ template <class... Types>
#include <__utility/forward.h>
#include <__utility/integer_sequence.h>
#include <__utility/move.h>
-#include <__utility/pair.h>
#include <__utility/piecewise_construct.h>
#include <__utility/swap.h>
#include <cstddef>
@@ -1348,17 +1348,6 @@ tuple_cat(_Tuple0&& __t0, _Tuples&&... __tpls) {
template <class... _Tp, class _Alloc>
struct _LIBCPP_TEMPLATE_VIS uses_allocator<tuple<_Tp...>, _Alloc> : true_type {};
-template <class _T1, class _T2>
-template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_T1, _T2>::pair(
- piecewise_construct_t,
- tuple<_Args1...>& __first_args,
- tuple<_Args2...>& __second_args,
- __tuple_indices<_I1...>,
- __tuple_indices<_I2...>)
- : first(std::forward<_Args1>(std::get<_I1>(__first_args))...),
- second(std::forward<_Args2>(std::get<_I2>(__second_args))...) {}
-
# if _LIBCPP_STD_VER >= 17
# define _LIBCPP_NOEXCEPT_RETURN(...) \
noexcept(noexcept(__VA_ARGS__)) { return __VA_ARGS__; }
More information about the libcxx-commits
mailing list