Skip to content

Commit 95c1313

Browse files
authored
[libc++] Remove a few includes from <__functional/hash.h> (#83254)
This also moves `__all` from `sfinae_helpers.h` to `conjunction.h`.
1 parent 8e3c0a2 commit 95c1313

File tree

10 files changed

+18
-17
lines changed

10 files changed

+18
-17
lines changed

libcxx/include/__functional/hash.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,20 @@
1010
#define _LIBCPP___FUNCTIONAL_HASH_H
1111

1212
#include <__config>
13-
#include <__functional/invoke.h>
1413
#include <__functional/unary_function.h>
1514
#include <__fwd/functional.h>
16-
#include <__tuple/sfinae_helpers.h>
15+
#include <__type_traits/conjunction.h>
16+
#include <__type_traits/invoke.h>
1717
#include <__type_traits/is_copy_constructible.h>
1818
#include <__type_traits/is_default_constructible.h>
1919
#include <__type_traits/is_enum.h>
2020
#include <__type_traits/is_move_constructible.h>
2121
#include <__type_traits/underlying_type.h>
22-
#include <__utility/forward.h>
23-
#include <__utility/move.h>
2422
#include <__utility/pair.h>
2523
#include <__utility/swap.h>
2624
#include <cstddef>
2725
#include <cstdint>
2826
#include <cstring>
29-
#include <limits>
3027

3128
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
3229
# pragma GCC system_header

libcxx/include/__tuple/sfinae_helpers.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <__tuple/tuple_like_ext.h>
1717
#include <__tuple/tuple_size.h>
1818
#include <__tuple/tuple_types.h>
19+
#include <__type_traits/conjunction.h>
1920
#include <__type_traits/enable_if.h>
2021
#include <__type_traits/integral_constant.h>
2122
#include <__type_traits/is_constructible.h>
@@ -32,12 +33,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
3233

3334
#ifndef _LIBCPP_CXX03_LANG
3435

35-
template <bool... _Preds>
36-
struct __all_dummy;
37-
38-
template <bool... _Pred>
39-
struct __all : _IsSame<__all_dummy<_Pred...>, __all_dummy<((void)_Pred, true)...>> {};
40-
4136
struct __tuple_sfinae_base {
4237
template <template <class, class...> class _Trait, class... _LArgs, class... _RArgs>
4338
static auto __do_test(__tuple_types<_LArgs...>, __tuple_types<_RArgs...>)

libcxx/include/__type_traits/conjunction.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <__type_traits/conditional.h>
1414
#include <__type_traits/enable_if.h>
1515
#include <__type_traits/integral_constant.h>
16+
#include <__type_traits/is_same.h>
1617

1718
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1819
# pragma GCC system_header
@@ -37,6 +38,12 @@ false_type __and_helper(...);
3738
template <class... _Pred>
3839
using _And _LIBCPP_NODEBUG = decltype(std::__and_helper<_Pred...>(0));
3940

41+
template <bool... _Preds>
42+
struct __all_dummy;
43+
44+
template <bool... _Pred>
45+
struct __all : _IsSame<__all_dummy<_Pred...>, __all_dummy<((void)_Pred, true)...> > {};
46+
4047
#if _LIBCPP_STD_VER >= 17
4148

4249
template <class...>

libcxx/include/array

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce
123123
#include <__iterator/wrap_iter.h>
124124
#include <__tuple/sfinae_helpers.h>
125125
#include <__type_traits/conditional.h>
126+
#include <__type_traits/conjunction.h>
126127
#include <__type_traits/is_array.h>
127128
#include <__type_traits/is_const.h>
128129
#include <__type_traits/is_constructible.h>

libcxx/include/coroutine

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ struct suspend_always;
5656

5757
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
5858
# include <iosfwd>
59+
# include <limits>
5960
# include <type_traits>
6061
#endif
6162

libcxx/include/experimental/memory

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,4 +191,8 @@ _LIBCPP_END_NAMESPACE_STD
191191

192192
#endif // _LIBCPP_ENABLE_EXPERIMENTAL
193193

194+
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
195+
# include <limits>
196+
#endif
197+
194198
#endif /* _LIBCPP_EXPERIMENTAL_MEMORY */

libcxx/include/optional

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,6 +1291,7 @@ _LIBCPP_POP_MACROS
12911291
# include <concepts>
12921292
# include <ctime>
12931293
# include <iterator>
1294+
# include <limits>
12941295
# include <memory>
12951296
# include <ratio>
12961297
# include <stdexcept>

libcxx/include/variant

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ namespace std {
228228
#include <__type_traits/add_pointer.h>
229229
#include <__type_traits/add_volatile.h>
230230
#include <__type_traits/common_type.h>
231+
#include <__type_traits/conjunction.h>
231232
#include <__type_traits/dependent_type.h>
232233
#include <__type_traits/is_array.h>
233234
#include <__type_traits/is_default_constructible.h>

libcxx/test/libcxx/transitive_includes/cxx23.csv

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ coroutine compare
131131
coroutine cstddef
132132
coroutine cstdint
133133
coroutine cstring
134-
coroutine limits
135134
coroutine version
136135
cstddef version
137136
ctgmath ccomplex
@@ -166,7 +165,6 @@ experimental/iterator iterator
166165
experimental/memory cstddef
167166
experimental/memory cstdint
168167
experimental/memory cstring
169-
experimental/memory limits
170168
experimental/propagate_const cstddef
171169
experimental/simd cstddef
172170
experimental/simd cstdint
@@ -396,7 +394,6 @@ optional cstddef
396394
optional cstdint
397395
optional cstring
398396
optional initializer_list
399-
optional limits
400397
optional new
401398
optional version
402399
ostream bitset

libcxx/test/libcxx/transitive_includes/cxx26.csv

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ coroutine compare
131131
coroutine cstddef
132132
coroutine cstdint
133133
coroutine cstring
134-
coroutine limits
135134
coroutine version
136135
cstddef version
137136
ctgmath ccomplex
@@ -166,7 +165,6 @@ experimental/iterator iterator
166165
experimental/memory cstddef
167166
experimental/memory cstdint
168167
experimental/memory cstring
169-
experimental/memory limits
170168
experimental/propagate_const cstddef
171169
experimental/simd cstddef
172170
experimental/simd cstdint
@@ -396,7 +394,6 @@ optional cstddef
396394
optional cstdint
397395
optional cstring
398396
optional initializer_list
399-
optional limits
400397
optional new
401398
optional version
402399
ostream bitset

0 commit comments

Comments
 (0)