Skip to content

Commit f9d6d6f

Browse files
authored
[libc++] Move the contents of __fwd/get.h into the forward declaration headers they actually belong to (#81368)
This brings us closer to one forward declaring header per public header.
1 parent 373d9d7 commit f9d6d6f

File tree

22 files changed

+79
-109
lines changed

22 files changed

+79
-109
lines changed

libcxx/include/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,6 @@ set(files
427427
__fwd/array.h
428428
__fwd/bit_reference.h
429429
__fwd/fstream.h
430-
__fwd/get.h
431430
__fwd/hash.h
432431
__fwd/ios.h
433432
__fwd/istream.h

libcxx/include/__fwd/array.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,20 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2121
template <class _Tp, size_t _Size>
2222
struct _LIBCPP_TEMPLATE_VIS array;
2323

24+
template <size_t _Ip, class _Tp, size_t _Size>
25+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp& get(array<_Tp, _Size>&) _NOEXCEPT;
26+
27+
template <size_t _Ip, class _Tp, size_t _Size>
28+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp& get(const array<_Tp, _Size>&) _NOEXCEPT;
29+
30+
#ifndef _LIBCPP_CXX03_LANG
31+
template <size_t _Ip, class _Tp, size_t _Size>
32+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp&& get(array<_Tp, _Size>&&) _NOEXCEPT;
33+
34+
template <size_t _Ip, class _Tp, size_t _Size>
35+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp&& get(const array<_Tp, _Size>&&) _NOEXCEPT;
36+
#endif
37+
2438
_LIBCPP_END_NAMESPACE_STD
2539

2640
#endif // _LIBCPP___FWD_ARRAY_H

libcxx/include/__fwd/get.h

Lines changed: 0 additions & 99 deletions
This file was deleted.

libcxx/include/__fwd/pair.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#define _LIBCPP___FWD_PAIR_H
1111

1212
#include <__config>
13+
#include <__fwd/tuple.h>
14+
#include <cstddef>
1315

1416
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1517
# pragma GCC system_header
@@ -20,6 +22,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2022
template <class, class>
2123
struct _LIBCPP_TEMPLATE_VIS pair;
2224

25+
template <size_t _Ip, class _T1, class _T2>
26+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type&
27+
get(pair<_T1, _T2>&) _NOEXCEPT;
28+
29+
template <size_t _Ip, class _T1, class _T2>
30+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
31+
get(const pair<_T1, _T2>&) _NOEXCEPT;
32+
33+
#ifndef _LIBCPP_CXX03_LANG
34+
template <size_t _Ip, class _T1, class _T2>
35+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
36+
get(pair<_T1, _T2>&&) _NOEXCEPT;
37+
38+
template <size_t _Ip, class _T1, class _T2>
39+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
40+
get(const pair<_T1, _T2>&&) _NOEXCEPT;
41+
#endif
42+
2343
_LIBCPP_END_NAMESPACE_STD
2444

2545
#endif // _LIBCPP___FWD_PAIR_H

libcxx/include/__fwd/subrange.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,17 @@
99
#ifndef _LIBCPP___FWD_SUBRANGE_H
1010
#define _LIBCPP___FWD_SUBRANGE_H
1111

12+
#include <__concepts/copyable.h>
1213
#include <__config>
14+
#include <__iterator/concepts.h>
15+
#include <cstddef>
1316

1417
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1518
# pragma GCC system_header
1619
#endif
1720

1821
#if _LIBCPP_STD_VER >= 20
1922

20-
# include <__iterator/concepts.h>
21-
2223
_LIBCPP_BEGIN_NAMESPACE_STD
2324

2425
namespace ranges {
@@ -29,8 +30,18 @@ template <input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent, subrange_ki
2930
requires(_Kind == subrange_kind::sized || !sized_sentinel_for<_Sent, _Iter>)
3031
class _LIBCPP_TEMPLATE_VIS subrange;
3132

33+
template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind>
34+
requires((_Index == 0 && copyable<_Iter>) || _Index == 1)
35+
_LIBCPP_HIDE_FROM_ABI constexpr auto get(const subrange<_Iter, _Sent, _Kind>&);
36+
37+
template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind>
38+
requires(_Index < 2)
39+
_LIBCPP_HIDE_FROM_ABI constexpr auto get(subrange<_Iter, _Sent, _Kind>&&);
40+
3241
} // namespace ranges
3342

43+
using ranges::get;
44+
3445
_LIBCPP_END_NAMESPACE_STD
3546

3647
#endif // _LIBCPP_STD_VER >= 20

libcxx/include/__fwd/tuple.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,41 @@
1010
#define _LIBCPP___FWD_TUPLE_H
1111

1212
#include <__config>
13+
#include <cstddef>
1314

1415
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1516
# pragma GCC system_header
1617
#endif
1718

1819
_LIBCPP_BEGIN_NAMESPACE_STD
1920

21+
template <size_t, class>
22+
struct _LIBCPP_TEMPLATE_VIS tuple_element;
23+
2024
#ifndef _LIBCPP_CXX03_LANG
2125

2226
template <class...>
2327
class _LIBCPP_TEMPLATE_VIS tuple;
2428

29+
template <class>
30+
struct _LIBCPP_TEMPLATE_VIS tuple_size;
31+
32+
template <size_t _Ip, class... _Tp>
33+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, tuple<_Tp...> >::type&
34+
get(tuple<_Tp...>&) _NOEXCEPT;
35+
36+
template <size_t _Ip, class... _Tp>
37+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type&
38+
get(const tuple<_Tp...>&) _NOEXCEPT;
39+
40+
template <size_t _Ip, class... _Tp>
41+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, tuple<_Tp...> >::type&&
42+
get(tuple<_Tp...>&&) _NOEXCEPT;
43+
44+
template <size_t _Ip, class... _Tp>
45+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type&&
46+
get(const tuple<_Tp...>&&) _NOEXCEPT;
47+
2548
#endif // _LIBCPP_CXX03_LANG
2649

2750
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__memory/compressed_pair.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#define _LIBCPP___MEMORY_COMPRESSED_PAIR_H
1212

1313
#include <__config>
14-
#include <__fwd/get.h>
1514
#include <__fwd/tuple.h>
1615
#include <__tuple/tuple_indices.h>
1716
#include <__type_traits/decay.h>

libcxx/include/__ranges/elements_view.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <__concepts/derived_from.h>
1717
#include <__concepts/equality_comparable.h>
1818
#include <__config>
19-
#include <__fwd/get.h>
2019
#include <__iterator/concepts.h>
2120
#include <__iterator/iterator_traits.h>
2221
#include <__ranges/access.h>

libcxx/include/__ranges/subrange.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <__concepts/derived_from.h>
1818
#include <__concepts/different_from.h>
1919
#include <__config>
20-
#include <__fwd/get.h>
2120
#include <__fwd/subrange.h>
2221
#include <__iterator/advance.h>
2322
#include <__iterator/concepts.h>

libcxx/include/__tuple/tuple_like.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <__fwd/tuple.h>
1717
#include <__type_traits/integral_constant.h>
1818
#include <__type_traits/remove_cvref.h>
19-
#include <cstddef>
2019

2120
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2221
# pragma GCC system_header

libcxx/include/__utility/pair.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <__concepts/different_from.h>
1515
#include <__config>
1616
#include <__fwd/array.h>
17-
#include <__fwd/get.h>
1817
#include <__fwd/pair.h>
1918
#include <__fwd/subrange.h>
2019
#include <__fwd/tuple.h>

libcxx/include/istream

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ template <class Stream, class T>
167167
#include <__type_traits/is_base_of.h>
168168
#include <__utility/declval.h>
169169
#include <__utility/forward.h>
170+
#include <bitset>
170171
#include <ostream>
171172
#include <version>
172173

libcxx/include/module.modulemap.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1790,7 +1790,6 @@ module std_private_thread_thread [system] {
17901790
}
17911791
module std_private_thread_timed_backoff_policy [system] { header "__thread/timed_backoff_policy.h" }
17921792

1793-
module std_private_tuple_get_fwd [system] { header "__fwd/get.h" }
17941793
module std_private_tuple_make_tuple_types [system] { header "__tuple/make_tuple_types.h" }
17951794
module std_private_tuple_pair_like [system] {
17961795
header "__tuple/pair_like.h"

libcxx/include/streambuf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ protected:
110110
#include <__assert> // all public C++ headers provide the assertion handler
111111
#include <__config>
112112
#include <__fwd/streambuf.h>
113+
#include <__type_traits/is_same.h>
113114
#include <climits>
114115
#include <ios>
115116
#include <iosfwd>

libcxx/include/tuple

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ template <class... Types>
211211
#include <__config>
212212
#include <__functional/invoke.h>
213213
#include <__fwd/array.h>
214-
#include <__fwd/get.h>
215214
#include <__fwd/tuple.h>
216215
#include <__memory/allocator_arg_t.h>
217216
#include <__memory/uses_allocator.h>

libcxx/test/libcxx/transitive_includes/cxx03.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ iostream istream
393393
iostream ostream
394394
iostream streambuf
395395
iostream version
396+
istream bitset
396397
istream concepts
397398
istream cstddef
398399
istream iosfwd

libcxx/test/libcxx/transitive_includes/cxx11.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ iostream istream
396396
iostream ostream
397397
iostream streambuf
398398
iostream version
399+
istream bitset
399400
istream concepts
400401
istream cstddef
401402
istream iosfwd

libcxx/test/libcxx/transitive_includes/cxx14.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ iostream istream
398398
iostream ostream
399399
iostream streambuf
400400
iostream version
401+
istream bitset
401402
istream concepts
402403
istream cstddef
403404
istream iosfwd

libcxx/test/libcxx/transitive_includes/cxx17.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ iostream istream
398398
iostream ostream
399399
iostream streambuf
400400
iostream version
401+
istream bitset
401402
istream concepts
402403
istream cstddef
403404
istream iosfwd

libcxx/test/libcxx/transitive_includes/cxx20.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ iostream istream
403403
iostream ostream
404404
iostream streambuf
405405
iostream version
406+
istream bitset
406407
istream concepts
407408
istream cstddef
408409
istream iosfwd

libcxx/test/libcxx/transitive_includes/cxx23.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ iostream istream
282282
iostream ostream
283283
iostream streambuf
284284
iostream version
285+
istream bitset
285286
istream cstddef
286287
istream ostream
287288
istream version

libcxx/test/libcxx/transitive_includes/cxx26.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ iostream istream
282282
iostream ostream
283283
iostream streambuf
284284
iostream version
285+
istream bitset
285286
istream cstddef
286287
istream ostream
287288
istream version

0 commit comments

Comments
 (0)