@@ -223,26 +223,66 @@ constexpr bool test_one(Rng&& rng) {
223
223
same_as<sentinel_t <R>> auto i = r.end ();
224
224
static_assert (common_range<R> == common_range<V>);
225
225
if constexpr (bidirectional_range<R> && common_range<R>) {
226
- #if defined(__clang__) || defined(__EDG__) // TRANSITION, VSO-1243263
227
226
assert (*prev (i) == *prev (end (expected_keys)));
228
- #else // ^^^ no workaround / workaround vvv
229
- assert (*ranges::prev (i) == *ranges::prev (end (expected_keys)));
230
- #endif // ^^^ workaround ^^^
231
227
}
232
228
233
229
if constexpr (CanEnd<const R&>) {
234
230
same_as<sentinel_t <const R>> auto i2 = as_const (r).end ();
235
231
static_assert (common_range<const R> == common_range<const V>);
236
232
if constexpr (bidirectional_range<const R> && common_range<const R>) {
237
- #if defined(__clang__) || defined(__EDG__) // TRANSITION, VSO-1243263
238
233
assert (*prev (i2) == *prev (end (expected_keys)));
239
- #else // ^^^ no workaround / workaround vvv
240
- assert (*ranges::prev (i2) == *ranges::prev (end (expected_keys)));
241
- #endif // ^^^ workaround ^^^
242
234
}
243
235
}
244
236
}
245
237
238
+ #if _HAS_CXX23
239
+ using ranges::const_iterator_t , ranges::const_sentinel_t , ranges::cbegin, ranges::cend;
240
+
241
+ // Validate view_interface::cbegin
242
+ STATIC_ASSERT (CanMemberCBegin<R>);
243
+ STATIC_ASSERT (CanMemberCBegin<const R&> == range<const V>);
244
+ if (forward_range<V>) { // intentionally not if constexpr
245
+ const same_as<const_iterator_t <R>> auto i = r.cbegin ();
246
+ if (!is_empty) {
247
+ assert (*i == *cbegin (expected_keys));
248
+ }
249
+
250
+ if constexpr (copyable<V>) {
251
+ auto r2 = r;
252
+ const same_as<const_iterator_t <R>> auto i2 = r2.cbegin ();
253
+ if (!is_empty) {
254
+ assert (*i2 == *i);
255
+ }
256
+ }
257
+
258
+ if constexpr (CanCBegin<const R&>) {
259
+ const same_as<const_iterator_t <const R>> auto i3 = as_const (r).cbegin ();
260
+ if (!is_empty) {
261
+ assert (*i3 == *i);
262
+ }
263
+ }
264
+ }
265
+
266
+ // Validate view_interface::cend
267
+ STATIC_ASSERT (CanMemberCEnd<R>);
268
+ STATIC_ASSERT (CanMemberCEnd<const R&> == range<const V>);
269
+ if (!is_empty) {
270
+ same_as<const_sentinel_t <R>> auto i = r.cend ();
271
+ static_assert (common_range<R> == common_range<V>);
272
+ if constexpr (bidirectional_range<R> && common_range<R>) {
273
+ assert (*prev (i) == *prev (cend (expected_keys)));
274
+ }
275
+
276
+ if constexpr (CanCEnd<const R&>) {
277
+ same_as<const_sentinel_t <const R>> auto i2 = as_const (r).cend ();
278
+ static_assert (common_range<const R> == common_range<const V>);
279
+ if constexpr (bidirectional_range<const R> && common_range<const R>) {
280
+ assert (*prev (i2) == *prev (cend (expected_keys)));
281
+ }
282
+ }
283
+ }
284
+ #endif // _HAS_CXX23
285
+
246
286
// Validate view_interface::data
247
287
STATIC_ASSERT (!CanData<R>);
248
288
STATIC_ASSERT (!CanData<const R>);
@@ -256,11 +296,7 @@ constexpr bool test_one(Rng&& rng) {
256
296
257
297
STATIC_ASSERT (CanMemberBack<R> == (bidirectional_range<V> && common_range<V>) );
258
298
if constexpr (CanMemberBack<R>) {
259
- #if defined(__clang__) || defined(__EDG__) // TRANSITION, VSO-1243263
260
299
assert (r.back () == *prev (end (expected_keys)));
261
- #else // ^^^ no workaround / workaround vvv
262
- assert (r.back () == *ranges::prev (end (expected_keys)));
263
- #endif // ^^^ workaround ^^^
264
300
}
265
301
266
302
STATIC_ASSERT (CanMemberFront<const R> == (forward_range<const V>) );
@@ -270,11 +306,7 @@ constexpr bool test_one(Rng&& rng) {
270
306
271
307
STATIC_ASSERT (CanMemberBack<const R> == (bidirectional_range<const V> && common_range<const V>) );
272
308
if constexpr (CanMemberBack<const R>) {
273
- #if defined(__clang__) || defined(__EDG__) // TRANSITION, VSO-1243263
274
309
assert (as_const (r).back () == *prev (end (expected_keys)));
275
- #else // ^^^ no workaround / workaround vvv
276
- assert (as_const (r).back () == *ranges::prev (end (expected_keys)));
277
- #endif // ^^^ workaround ^^^
278
310
}
279
311
}
280
312
@@ -299,11 +331,7 @@ constexpr bool test_one(Rng&& rng) {
299
331
if (!is_empty) {
300
332
assert ((*b1.begin () == pair{0 , -1 })); // NB: depends on the test data
301
333
if constexpr (bidirectional_range<V> && common_range<V>) {
302
- #if defined(__clang__) || defined(__EDG__) // TRANSITION, VSO-1243263
303
334
assert ((*prev (b1.end ()) == pair{7 , -8 })); // NB: depends on the test data
304
- #else // ^^^ no workaround / workaround vvv
305
- assert ((*ranges::prev (b1.end ()) == pair{7 , -8 })); // NB: depends on the test data
306
- #endif // ^^^ workaround ^^^
307
335
}
308
336
}
309
337
}
@@ -315,11 +343,7 @@ constexpr bool test_one(Rng&& rng) {
315
343
if (!is_empty) {
316
344
assert ((*b2.begin () == pair{0 , -1 })); // NB: depends on the test data
317
345
if constexpr (bidirectional_range<V> && common_range<V>) {
318
- #if defined(__clang__) || defined(__EDG__) // TRANSITION, VSO-1243263
319
346
assert ((*prev (b2.end ()) == pair{7 , -8 })); // NB: depends on the test data
320
- #else // ^^^ no workaround / workaround vvv
321
- assert ((*ranges::prev (b2.end ()) == pair{7 , -8 })); // NB: depends on the test data
322
- #endif // ^^^ workaround ^^^
323
347
}
324
348
}
325
349
}
0 commit comments