Skip to content

Commit

Permalink
Update ranges_views.cc
Browse files Browse the repository at this point in the history
  • Loading branch information
lackhole committed Jun 28, 2024
1 parent 4cdb25e commit a2dccfb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/ranges_views.cc
Original file line number Diff line number Diff line change
Expand Up @@ -528,8 +528,10 @@ TEST(VERSIONED(RangesViews), take_while_view) {
using namespace std::literals;
using namespace preview::literals;

#if PREVIEW_CXX_VERSION >= 17
for (int year : views::iota(2020)
| views::take_while([](int y){ return y < 2026; })) { (void)year; }
#endif

auto r1 = views::iota(10) | views::take_while([](int x) { return true; });
auto r2 = views::iota(10, 20) | views::take_while([](int x) { return true; });
Expand All @@ -543,9 +545,15 @@ TEST(VERSIONED(RangesViews), take_while_view) {
));

const char note[]{"Today is yesterday's tomorrow!..."};
#if PREVIEW_CXX_VERSION >= 17
for (char x : ranges::take_while_view(note, [](char c){ return c != '.'; })) { (void)x; }
#endif
EXPECT_TRUE(ranges::equal(
#if PREVIEW_CXX_VERSION >= 17
ranges::take_while_view(note, [](char c){ return c != '.'; }),
#else
views::take_while(note, [](char c){ return c != '.'; }),
#endif
"Today is yesterday's tomorrow!"_sv
));
}

0 comments on commit a2dccfb

Please sign in to comment.