Skip to content

Commit 5e04a2e

Browse files
committed
Update version
1 parent 97e9af8 commit 5e04a2e

File tree

6 files changed

+69
-99
lines changed

6 files changed

+69
-99
lines changed

libcxx/docs/FeatureTestMacroTable.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,8 @@ Status
488488
---------------------------------------------------------- -----------------
489489
``__cpp_lib_ranges_concat`` *unimplemented*
490490
---------------------------------------------------------- -----------------
491+
``__cpp_lib_ranges_indices`` ``202506L``
492+
---------------------------------------------------------- -----------------
491493
``__cpp_lib_ratio`` ``202306L``
492494
---------------------------------------------------------- -----------------
493495
``__cpp_lib_rcu`` *unimplemented*

libcxx/include/version

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ __cpp_lib_ranges_chunk_by 202202L <ranges>
205205
__cpp_lib_ranges_concat 202403L <ranges>
206206
__cpp_lib_ranges_contains 202207L <algorithm>
207207
__cpp_lib_ranges_find_last 202207L <algorithm>
208+
__cpp_lib_ranges_indices 202506L <ranges>
208209
__cpp_lib_ranges_iota 202202L <numeric>
209210
__cpp_lib_ranges_join_with 202202L <ranges>
210211
__cpp_lib_ranges_repeat 202207L <ranges>
@@ -590,6 +591,7 @@ __cpp_lib_void_t 201411L <type_traits>
590591
# define __cpp_lib_out_ptr 202311L
591592
// # define __cpp_lib_philox_engine 202406L
592593
// # define __cpp_lib_ranges_concat 202403L
594+
# define __cpp_lib_ranges_indices 202506L
593595
# define __cpp_lib_ratio 202306L
594596
// # define __cpp_lib_rcu 202306L
595597
# define __cpp_lib_reference_wrapper 202403L

libcxx/test/std/language.support/support.limits/support.limits.general/ranges.version.compile.pass.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@
4848
# error "__cpp_lib_ranges_concat should not be defined before c++26"
4949
# endif
5050

51+
# ifdef __cpp_lib_ranges_indices
52+
# error "__cpp_lib_ranges_indices should not be defined before c++26"
53+
# endif
54+
5155
# ifdef __cpp_lib_ranges_join_with
5256
# error "__cpp_lib_ranges_join_with should not be defined before c++23"
5357
# endif
@@ -98,6 +102,10 @@
98102
# error "__cpp_lib_ranges_concat should not be defined before c++26"
99103
# endif
100104

105+
# ifdef __cpp_lib_ranges_indices
106+
# error "__cpp_lib_ranges_indices should not be defined before c++26"
107+
# endif
108+
101109
# ifdef __cpp_lib_ranges_join_with
102110
# error "__cpp_lib_ranges_join_with should not be defined before c++23"
103111
# endif
@@ -148,6 +156,10 @@
148156
# error "__cpp_lib_ranges_concat should not be defined before c++26"
149157
# endif
150158

159+
# ifdef __cpp_lib_ranges_indices
160+
# error "__cpp_lib_ranges_indices should not be defined before c++26"
161+
# endif
162+
151163
# ifdef __cpp_lib_ranges_join_with
152164
# error "__cpp_lib_ranges_join_with should not be defined before c++23"
153165
# endif
@@ -201,6 +213,10 @@
201213
# error "__cpp_lib_ranges_concat should not be defined before c++26"
202214
# endif
203215

216+
# ifdef __cpp_lib_ranges_indices
217+
# error "__cpp_lib_ranges_indices should not be defined before c++26"
218+
# endif
219+
204220
# ifdef __cpp_lib_ranges_join_with
205221
# error "__cpp_lib_ranges_join_with should not be defined before c++23"
206222
# endif
@@ -278,6 +294,10 @@
278294
# error "__cpp_lib_ranges_concat should not be defined before c++26"
279295
# endif
280296

297+
# ifdef __cpp_lib_ranges_indices
298+
# error "__cpp_lib_ranges_indices should not be defined before c++26"
299+
# endif
300+
281301
# ifndef __cpp_lib_ranges_join_with
282302
# error "__cpp_lib_ranges_join_with should be defined in c++23"
283303
# endif
@@ -400,6 +420,13 @@
400420
# endif
401421
# endif
402422

423+
# ifndef __cpp_lib_ranges_indices
424+
# error "__cpp_lib_ranges_indices should be defined in c++26"
425+
# endif
426+
# if __cpp_lib_ranges_indices != 202506L
427+
# error "__cpp_lib_ranges_indices should have the value 202506L in c++26"
428+
# endif
429+
403430
# ifndef __cpp_lib_ranges_join_with
404431
# error "__cpp_lib_ranges_join_with should be defined in c++26"
405432
# endif

libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,10 @@
664664
# error "__cpp_lib_ranges_find_last should not be defined before c++23"
665665
# endif
666666

667+
# ifdef __cpp_lib_ranges_indices
668+
# error "__cpp_lib_ranges_indices should not be defined before c++26"
669+
# endif
670+
667671
# ifdef __cpp_lib_ranges_iota
668672
# error "__cpp_lib_ranges_iota should not be defined before c++23"
669673
# endif
@@ -1604,6 +1608,10 @@
16041608
# error "__cpp_lib_ranges_find_last should not be defined before c++23"
16051609
# endif
16061610

1611+
# ifdef __cpp_lib_ranges_indices
1612+
# error "__cpp_lib_ranges_indices should not be defined before c++26"
1613+
# endif
1614+
16071615
# ifdef __cpp_lib_ranges_iota
16081616
# error "__cpp_lib_ranges_iota should not be defined before c++23"
16091617
# endif
@@ -2715,6 +2723,10 @@
27152723
# error "__cpp_lib_ranges_find_last should not be defined before c++23"
27162724
# endif
27172725

2726+
# ifdef __cpp_lib_ranges_indices
2727+
# error "__cpp_lib_ranges_indices should not be defined before c++26"
2728+
# endif
2729+
27182730
# ifdef __cpp_lib_ranges_iota
27192731
# error "__cpp_lib_ranges_iota should not be defined before c++23"
27202732
# endif
@@ -4099,6 +4111,10 @@
40994111
# error "__cpp_lib_ranges_find_last should not be defined before c++23"
41004112
# endif
41014113

4114+
# ifdef __cpp_lib_ranges_indices
4115+
# error "__cpp_lib_ranges_indices should not be defined before c++26"
4116+
# endif
4117+
41024118
# ifdef __cpp_lib_ranges_iota
41034119
# error "__cpp_lib_ranges_iota should not be defined before c++23"
41044120
# endif
@@ -5678,6 +5694,10 @@
56785694
# error "__cpp_lib_ranges_find_last should have the value 202207L in c++23"
56795695
# endif
56805696

5697+
# ifdef __cpp_lib_ranges_indices
5698+
# error "__cpp_lib_ranges_indices should not be defined before c++26"
5699+
# endif
5700+
56815701
# ifndef __cpp_lib_ranges_iota
56825702
# error "__cpp_lib_ranges_iota should be defined in c++23"
56835703
# endif
@@ -7602,6 +7622,13 @@
76027622
# error "__cpp_lib_ranges_find_last should have the value 202207L in c++26"
76037623
# endif
76047624

7625+
# ifndef __cpp_lib_ranges_indices
7626+
# error "__cpp_lib_ranges_indices should be defined in c++26"
7627+
# endif
7628+
# if __cpp_lib_ranges_indices != 202506L
7629+
# error "__cpp_lib_ranges_indices should have the value 202506L in c++26"
7630+
# endif
7631+
76057632
# ifndef __cpp_lib_ranges_iota
76067633
# error "__cpp_lib_ranges_iota should be defined in c++26"
76077634
# endif

libcxx/test/std/ranges/range.factories/range.iota.view/indices.pass.cpp

Lines changed: 6 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -19,97 +19,25 @@
1919

2020
#include "types.h"
2121

22-
// #include <compare>
23-
24-
// class IntegerLike {
25-
// int value;
26-
27-
// public:
28-
// // Constructor
29-
// IntegerLike(int v = 0) : value(v) {}
30-
31-
// // Conversion to int
32-
// operator int() const { return value; }
33-
34-
// // Conversion to std::size_t
35-
// // This is necessary for std::ranges::views::indices to work with IntegerLike
36-
// operator std::size_t() const { return static_cast<std::size_t>(value); }
37-
38-
// // Equality and comparison
39-
// auto operator<=>(const IntegerLike&) const = default;
40-
41-
// // Arithmetic
42-
// IntegerLike operator+(const IntegerLike& other) const { return IntegerLike(value + other.value); }
43-
44-
// IntegerLike operator-(const IntegerLike& other) const { return IntegerLike(value - other.value); }
45-
46-
// IntegerLike operator*(const IntegerLike& other) const { return IntegerLike(value * other.value); }
47-
48-
// IntegerLike operator/(const IntegerLike& other) const { return IntegerLike(value / other.value); }
49-
50-
// // Compound assignment
51-
// IntegerLike& operator+=(const IntegerLike& other) {
52-
// value += other.value;
53-
// return *this;
54-
// }
55-
56-
// IntegerLike& operator-=(const IntegerLike& other) {
57-
// value -= other.value;
58-
// return *this;
59-
// }
60-
61-
// IntegerLike& operator*=(const IntegerLike& other) {
62-
// value *= other.value;
63-
// return *this;
64-
// }
65-
66-
// IntegerLike& operator/=(const IntegerLike& other) {
67-
// value /= other.value;
68-
// return *this;
69-
// }
70-
71-
// // Increment / Decrement
72-
// IntegerLike& operator++() {
73-
// ++value;
74-
// return *this;
75-
// }
76-
77-
// IntegerLike operator++(int) {
78-
// IntegerLike tmp = *this;
79-
// ++(*this);
80-
// return tmp;
81-
// }
82-
83-
// IntegerLike& operator--() {
84-
// --value;
85-
// return *this;
86-
// }
87-
88-
// IntegerLike operator--(int) {
89-
// IntegerLike tmp = *this;
90-
// --(*this);
91-
// return tmp;
92-
// }
93-
// };
94-
9522
// Test SFINAE.
9623

9724
template <typename SizeType>
9825
concept HasIndices = requires(SizeType s) { std::ranges::views::indices(s); };
9926

100-
struct NotIntegerLike {};
101-
10227
struct IntegerTypesTest {
10328
template <class T>
10429
constexpr void operator()() {
10530
static_assert(HasIndices<T>);
10631
}
10732
};
10833

34+
struct NotIntegerLike {};
35+
10936
void test_SFIANE() {
11037
static_assert(HasIndices<std::size_t>);
11138
types::for_each(types::integer_types(), IntegerTypesTest{});
11239

40+
// Not integer-like types should not satisfy HasIndices
11341
static_assert(!HasIndices<bool>);
11442
static_assert(!HasIndices<float>);
11543
static_assert(!HasIndices<void>);
@@ -119,48 +47,28 @@ void test_SFIANE() {
11947

12048
constexpr bool test() {
12149
{
122-
// Check that the indices view works as expected
12350
auto indices_view = std::ranges::views::indices(5);
12451
assert(indices_view.size() == 5);
12552

126-
// This should be valid, as indices_view is a range of integers
53+
// Check that the view is a range
54+
static_assert(std::ranges::range<decltype(indices_view)>);
55+
12756
assert(indices_view[0] == 0);
12857
assert(indices_view[1] == 1);
12958
assert(indices_view[2] == 2);
13059
assert(indices_view[3] == 3);
13160
assert(indices_view[4] == 4);
132-
133-
// Check that the view is a range
134-
static_assert(std::ranges::range<decltype(indices_view)>);
13561
}
13662

137-
// {
138-
// // Check that the indices view works as expected
139-
// auto indices_view = std::ranges::views::indices(IntegerLike{5});
140-
// assert(indices_view.size() == 5);
141-
142-
// // Check that the view is a range
143-
// static_assert(std::ranges::range<decltype(indices_view)>);
144-
145-
// // This should be valid, as indices_view is a range of integers
146-
// assert(indices_view[0] == 0);
147-
// assert(indices_view[1] == 1);
148-
// assert(indices_view[2] == 2);
149-
// assert(indices_view[3] == 3);
150-
// assert(indices_view[4] == 4);
151-
// }
152-
15363
{
15464
std::vector v(5, 0);
15565

156-
// Check that the indices view works as expected
15766
auto indices_view = std::ranges::views::indices(std::ranges::size(v));
15867
assert(indices_view.size() == 5);
15968

16069
// Check that the view is a range
16170
static_assert(std::ranges::range<decltype(indices_view)>);
16271

163-
// This should be valid, as indices_view is a range of integers
16472
assert(indices_view[0] == 0);
16573
assert(indices_view[1] == 1);
16674
assert(indices_view[2] == 2);
@@ -178,7 +86,6 @@ constexpr bool test() {
17886
// Check that the view is a range
17987
static_assert(std::ranges::range<decltype(indices_view)>);
18088

181-
// This should be valid, as indices_view is a range of integers
18289
assert(indices_view[0] == 0);
18390
assert(indices_view[1] == 1);
18491
assert(indices_view[2] == 2);

libcxx/utils/generate_feature_test_macro_components.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,6 +1116,11 @@ def add_version_header(tc):
11161116
"values": {"c++23": 202207},
11171117
"headers": ["algorithm"],
11181118
},
1119+
{
1120+
"name": "__cpp_lib_ranges_indices",
1121+
"values": {"c++26": 202506},
1122+
"headers": ["ranges"],
1123+
},
11191124
{
11201125
"name": "__cpp_lib_ranges_iota",
11211126
"values": {"c++23": 202202},

0 commit comments

Comments
 (0)