Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions tests/std/tests/P2474R2_views_repeat/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,16 +360,6 @@ constexpr bool test() {
test_iterator_arithmetic<wchar_t>();
test_iterator_arithmetic<_Signed128>();

// GH-4507: LWG-4053 Unary call to std::views::repeat does not decay the argument
{
using RPV = ranges::repeat_view<const char*>;

static_assert(same_as<decltype(views::repeat("foo", unreachable_sentinel)), RPV>);
static_assert(same_as<decltype(views::repeat(+"foo", unreachable_sentinel)), RPV>);
static_assert(same_as<decltype(views::repeat("foo")), RPV>);
static_assert(same_as<decltype(views::repeat(+"foo")), RPV>);
}

return true;
}

Expand All @@ -380,6 +370,11 @@ static_assert(CanViewRepeat<string, _Signed128>);
static_assert(
!CanViewRepeat<string, _Unsigned128>); // _Unsigned128 does not satisfy 'integer-like-with-usable-difference-type'

// Check LWG-4053 "Unary call to std::views::repeat does not decay the argument" (affects CTAD only due to LWG-4054)
static_assert(is_same_v<decltype(ranges::repeat_view(ranges::repeat_view(42))), ranges::repeat_view<int>>);
static_assert(is_same_v<decltype(ranges::repeat_view("Hello world!")), ranges::repeat_view<const char*>>);
static_assert(is_same_v<decltype(ranges::repeat_view(test)), ranges::repeat_view<bool (*)()>>);

// Check LWG-4054 "Repeating a repeat_view should repeat the view"
static_assert(is_same_v<decltype(views::repeat(views::repeat(42))), ranges::repeat_view<ranges::repeat_view<int>>>);
static_assert(is_same_v<decltype(views::repeat("Hello world!")), ranges::repeat_view<const char*>>);
Expand Down