Skip to content

Commit 9e9db33

Browse files
committed
Test views::repeat
1 parent 24d4b20 commit 9e9db33

File tree

1 file changed

+10
-0
lines changed
  • tests/std/tests/P2474R2_views_repeat

1 file changed

+10
-0
lines changed

tests/std/tests/P2474R2_views_repeat/test.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,16 @@ constexpr void test_common(T val, B bound = unreachable_sentinel) {
252252
assert(cmp_equal(last - first, rng.size()));
253253
static_assert(noexcept(last - first)); // strengthened
254254
}
255+
256+
const same_as<ranges::const_iterator_t<R>> auto cfirst = rng.cbegin();
257+
assert(cfirst == first);
258+
const same_as<ranges::const_sentinel_t<R>> auto clast = rng.cend();
259+
if constexpr (ranges::common_range<R>) {
260+
assert(clast == last);
261+
assert(cmp_equal(clast - cfirst, rng.size()));
262+
} else {
263+
static_assert(same_as<remove_const_t<decltype(clast)>, unreachable_sentinel_t>);
264+
}
255265
}
256266

257267
struct move_tester {

0 commit comments

Comments
 (0)