[libc++] Avoid including <tuple> in compressed_pair.h

compressed_pair is widely used in the library, but most of the uses don't use the tuple parts. To avoid including <tuple> everywhere, use the forward declaration instead in compressed_pair.h

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D133331
This commit is contained in:
Nikolas Klauser 2022-09-17 14:30:29 +02:00
parent 762962174e
commit 7afa1598a3
39 changed files with 39 additions and 46 deletions

View File

@ -11,10 +11,13 @@
#define _LIBCPP___MEMORY_COMPRESSED_PAIR_H
#include <__config>
#include <__fwd/get.h>
#include <__fwd/tuple.h>
#include <__tuple/tuple_indices.h>
#include <__type_traits/dependent_type.h>
#include <__utility/forward.h>
#include <__utility/move.h>
#include <tuple> // needed in c++03 for some constructors
#include <__utility/piecewise_construct.h>
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)

View File

@ -14,15 +14,15 @@
#include <__algorithm/find_end.h>
#include <__algorithm/find_first_of.h>
#include <__algorithm/min.h>
#include <__compare/ordering.h>
#include <__config>
#include <__functional/hash.h>
#include <__iterator/iterator_traits.h>
#include <compare>
#include <__type_traits/is_constant_evaluated.h>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <iosfwd>
#include <type_traits>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
# include <cwchar> // for wmemcpy

View File

@ -534,7 +534,6 @@ POLICY: For non-variadic implementations, the number of arguments is limited
#include <concepts>
#include <exception>
#include <memory> // TODO: find out why removing this breaks the modules build
#include <tuple>
#include <type_traits>
#include <typeinfo>
#include <version>
@ -544,6 +543,7 @@ POLICY: For non-variadic implementations, the number of arguments is limited
#endif
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <tuple>
# include <utility>
#endif

View File

@ -1,7 +1,5 @@
bit
climits
cmath
compare
concepts
cstddef
cstdint
@ -12,6 +10,5 @@ initializer_list
iosfwd
limits
new
tuple
type_traits
version

View File

@ -1,7 +1,5 @@
atomic
climits
cmath
compare
concepts
cstddef
cstdint
@ -15,7 +13,6 @@ limits
new
ratio
stdexcept
tuple
type_traits
typeinfo
version

View File

@ -1,7 +1,5 @@
atomic
climits
cmath
compare
cstddef
cstdint
cstdlib
@ -12,6 +10,5 @@ iosfwd
limits
new
ratio
tuple
type_traits
version

View File

@ -18,6 +18,5 @@ new
stdexcept
string
string_view
tuple
type_traits
version

View File

@ -23,7 +23,6 @@ stdexcept
string
string_view
system_error
tuple
type_traits
typeinfo
version

View File

@ -15,7 +15,6 @@ limits
new
ratio
stdexcept
tuple
type_traits
typeinfo
version

View File

@ -1,8 +1,6 @@
algorithm
bit
climits
cmath
compare
concepts
cstddef
cstdint
@ -13,6 +11,5 @@ initializer_list
iosfwd
limits
new
tuple
type_traits
version

View File

@ -15,7 +15,6 @@ limits
new
ratio
stdexcept
tuple
type_traits
typeinfo
version

View File

@ -15,7 +15,6 @@ limits
new
ratio
stdexcept
tuple
type_traits
typeinfo
version

View File

@ -15,7 +15,6 @@ limits
new
ratio
stdexcept
tuple
type_traits
typeinfo
version

View File

@ -16,7 +16,6 @@ limits
new
ratio
stdexcept
tuple
type_traits
typeinfo
vector

View File

@ -23,7 +23,6 @@ ratio
stdexcept
string
string_view
tuple
type_traits
typeinfo
vector

View File

@ -12,6 +12,5 @@ limits
new
optional
stdexcept
tuple
type_traits
version

View File

@ -22,6 +22,5 @@ stdexcept
string
string_view
system_error
tuple
type_traits
version

View File

@ -16,7 +16,6 @@ limits
new
ratio
stdexcept
tuple
type_traits
typeinfo
version

View File

@ -17,6 +17,5 @@ limits
new
stdexcept
string_view
tuple
type_traits
version

View File

@ -19,6 +19,5 @@ new
stdexcept
string
string_view
tuple
type_traits
version

View File

@ -12,6 +12,5 @@ limits
new
optional
stdexcept
tuple
type_traits
version

View File

@ -15,7 +15,6 @@ limits
new
ratio
stdexcept
tuple
type_traits
typeinfo
version

View File

@ -14,8 +14,9 @@
// minmax(const T& a, const T& b, Compare comp);
#include <algorithm>
#include <functional>
#include <cassert>
#include <functional>
#include <utility>
#include "test_macros.h"

View File

@ -21,6 +21,7 @@
#include <cassert>
#include <cstddef>
#include <memory>
#include <utility>
#include "test_macros.h"

View File

@ -19,9 +19,10 @@
// only SFINAE away when too few arguments are provided. Otherwise they should
// be well formed and should ignore any additional arguments.
#include <cassert>
#include <functional>
#include <type_traits>
#include <cassert>
#include <utility>
#include "test_macros.h"

View File

@ -16,9 +16,10 @@
// be treated as a subexpression in a bind call.
// https://llvm.org/PR51753
#include <functional>
#include <cassert>
#include <functional>
#include <type_traits>
#include <utility>
struct MyBind {
int operator()(int x, int y) const { return 10*x + y; }

View File

@ -16,9 +16,10 @@
// to indicate that T should be treated as a placeholder type.
// https://llvm.org/PR51753
#include <functional>
#include <cassert>
#include <functional>
#include <type_traits>
#include <utility>
struct My2 {};
template<> struct std::is_placeholder<My2> : std::integral_constant<int, 2> {};

View File

@ -14,6 +14,7 @@
#include <cassert>
#include <concepts>
#include <utility>
#include "MoveOnly.h"

View File

@ -16,9 +16,10 @@
//
// This signature was removed in C++17
#include <cassert>
#include <functional>
#include <memory>
#include <cassert>
#include <utility>
#include "test_macros.h"

View File

@ -15,8 +15,9 @@
// This test runs in C++03, but we have deprecated using std::function in C++03.
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
#include <functional>
#include <cassert>
#include <functional>
#include <utility>
#include "test_macros.h"
#include "count_new.h"

View File

@ -24,6 +24,7 @@
#include <memory>
#include <cstdlib>
#include <cassert>
#include <utility>
#include "test_macros.h"
#include "count_new.h"

View File

@ -12,9 +12,10 @@
// ranges::equal_to
#include <cassert>
#include <functional>
#include <type_traits>
#include <cassert>
#include <utility>
#include "test_macros.h"
#include "compare_types.h"

View File

@ -12,9 +12,10 @@
// ranges::greater
#include <cassert>
#include <functional>
#include <type_traits>
#include <cassert>
#include <utility>
#include "test_macros.h"
#include "compare_types.h"

View File

@ -12,9 +12,10 @@
// ranges::greater_equal
#include <cassert>
#include <functional>
#include <type_traits>
#include <cassert>
#include <utility>
#include "test_macros.h"
#include "compare_types.h"

View File

@ -12,9 +12,10 @@
// ranges::less
#include <cassert>
#include <functional>
#include <type_traits>
#include <cassert>
#include <utility>
#include "test_macros.h"
#include "compare_types.h"

View File

@ -12,9 +12,10 @@
// ranges::less_equal
#include <cassert>
#include <functional>
#include <type_traits>
#include <cassert>
#include <utility>
#include "test_macros.h"
#include "compare_types.h"

View File

@ -12,9 +12,10 @@
// ranges::not_equal_to
#include <cassert>
#include <functional>
#include <type_traits>
#include <cassert>
#include <utility>
#include "test_macros.h"
#include "compare_types.h"

View File

@ -11,9 +11,10 @@
// raw_storage_iterator
#include <cassert>
#include <memory>
#include <type_traits>
#include <cassert>
#include <utility>
#include "test_macros.h"
#include <MoveOnly.h>

View File

@ -84,9 +84,10 @@
*
*/
#include <functional>
#include <cassert>
#include <functional>
#include <new>
#include <utility>
#include "test_macros.h"