Skip to content

Commit 53406fb

Browse files
committed
[libc++] Guard much of std::ranges under _LIBCPP_HAS_NO_INCOMPLETE_RANGES.
The logic here is that we are disabling *only* things in `std::ranges::`. Everything in `std::` is permitted, including `default_sentinel`, `contiguous_iterator`, `common_iterator`, `projected`, `swappable`, and so on. Then, we include anything from `std::ranges::` that is required in order to make those things work: `ranges::swap`, `ranges::swap_ranges`, `input_range`, `ranges::begin`, `ranges::iter_move`, and so on. But then that's all. Everything else (including notably all of the "views" and the `std::views` namespace itself) is still locked up behind `_LIBCPP_HAS_NO_INCOMPLETE_RANGES`. Differential Revision: https://reviews.llvm.org/D118736
1 parent 149ad3d commit 53406fb

File tree

88 files changed

+189
-136
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+189
-136
lines changed

libcxx/include/__algorithm/in_in_out_result.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
_LIBCPP_BEGIN_NAMESPACE_STD
2222

23-
#if !defined(_LIBCPP_HAS_NO_CONCEPTS)
23+
#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
2424

2525
namespace ranges {
2626

@@ -47,7 +47,7 @@ struct in_in_out_result {
4747

4848
} // namespace ranges
4949

50-
#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS)
50+
#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
5151

5252
_LIBCPP_END_NAMESPACE_STD
5353

libcxx/include/__algorithm/in_out_result.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
_LIBCPP_BEGIN_NAMESPACE_STD
2222

23-
#if !defined(_LIBCPP_HAS_NO_CONCEPTS)
23+
#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
2424

2525
namespace ranges {
2626

@@ -47,7 +47,7 @@ struct in_out_result {
4747

4848
} // namespace ranges
4949

50-
#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS)
50+
#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
5151

5252
_LIBCPP_END_NAMESPACE_STD
5353

libcxx/include/__algorithm/ranges_min_element.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
# pragma GCC system_header
2525
#endif
2626

27-
#ifndef _LIBCPP_HAS_NO_CONCEPTS
27+
#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
2828

2929
_LIBCPP_BEGIN_NAMESPACE_STD
3030

@@ -67,6 +67,6 @@ inline namespace __cpo {
6767

6868
_LIBCPP_END_NAMESPACE_STD
6969

70-
#endif // _LIBCPP_HAS_NO_RANGES
70+
#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
7171

7272
#endif // _LIBCPP___ALGORITHM_RANGES_MIN_ELEMENT_H

libcxx/include/__filesystem/directory_iterator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ template <>
147147
_LIBCPP_AVAILABILITY_FILESYSTEM
148148
inline constexpr bool _VSTD::ranges::enable_view<_VSTD_FS::directory_iterator> = true;
149149

150-
#endif
150+
#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS)
151151

152152
#endif // _LIBCPP_CXX03_LANG
153153

libcxx/include/__filesystem/recursive_directory_iterator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ template <>
178178
_LIBCPP_AVAILABILITY_FILESYSTEM
179179
inline constexpr bool _VSTD::ranges::enable_view<_VSTD_FS::recursive_directory_iterator> = true;
180180

181-
#endif
181+
#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS)
182182

183183
#endif // _LIBCPP_CXX03_LANG
184184

libcxx/include/__functional/ranges_operations.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020

2121
_LIBCPP_BEGIN_NAMESPACE_STD
2222

23-
#if !defined(_LIBCPP_HAS_NO_CONCEPTS)
23+
#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
24+
2425
namespace ranges {
2526

2627
struct equal_to {
@@ -90,7 +91,7 @@ struct greater_equal {
9091
};
9192

9293
} // namespace ranges
93-
#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS)
94+
#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
9495

9596
_LIBCPP_END_NAMESPACE_STD
9697

libcxx/include/__iterator/advance.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void advance(_InputIter& __i, _Distance __orig_n) {
6565
_VSTD::__advance(__i, __n, typename iterator_traits<_InputIter>::iterator_category());
6666
}
6767

68-
#if !defined(_LIBCPP_HAS_NO_CONCEPTS)
68+
#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
6969

7070
// [range.iter.op.advance]
7171

@@ -193,7 +193,7 @@ inline namespace __cpo {
193193
} // namespace __cpo
194194
} // namespace ranges
195195

196-
#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS)
196+
#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
197197

198198
_LIBCPP_END_NAMESPACE_STD
199199

libcxx/include/__iterator/distance.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ distance(_InputIter __first, _InputIter __last)
5252
return _VSTD::__distance(__first, __last, typename iterator_traits<_InputIter>::iterator_category());
5353
}
5454

55-
#if !defined(_LIBCPP_HAS_NO_CONCEPTS)
55+
#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
5656

5757
// [range.iter.op.distance]
5858

@@ -100,7 +100,7 @@ inline namespace __cpo {
100100
} // namespace __cpo
101101
} // namespace ranges
102102

103-
#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS)
103+
#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
104104

105105
_LIBCPP_END_NAMESPACE_STD
106106

libcxx/include/__iterator/insert_iterator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
_LIBCPP_BEGIN_NAMESPACE_STD
2626

27-
#if !defined(_LIBCPP_HAS_NO_CONCEPTS)
27+
#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
2828
template <class _Container>
2929
using __insert_iterator_iter_t = ranges::iterator_t<_Container>;
3030
#else

libcxx/include/__iterator/iter_move.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ template<__dereferenceable _Tp>
8686
requires requires(_Tp& __t) { { ranges::iter_move(__t) } -> __can_reference; }
8787
using iter_rvalue_reference_t = decltype(ranges::iter_move(declval<_Tp&>()));
8888

89-
#endif // !_LIBCPP_HAS_NO_CONCEPTS
89+
#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS)
9090

9191
_LIBCPP_END_NAMESPACE_STD
9292

0 commit comments

Comments
 (0)