TartanLlama / ranges

Ranges that didn't make C++20
Creative Commons Zero v1.0 Universal
83 stars 5 forks source link

Compatibility issue between std::views::iota and tl::views::enumerate #2

Closed naddu77 closed 3 years ago

naddu77 commented 3 years ago

In the unit test below, a compilation error occurs.

TEST_CASE("std::ranges::iota_view") {
    for (auto&& [i, j] : (std::views::iota(0) | tl::views::enumerate | std::views::take(10))) {
        REQUIRE(i == j);
    }
}

Error message:

error C2678: binary '|': no operator found which takes a left-hand operand of type 'tl::enumerate_view<std::ranges::iota_view<_Ty,std::unreachable_sentinel_t>>' (or there is no acceptable conversion) with [ _Ty=int ]

TartanLlama commented 3 years ago

Fixed in c68f93781f2394dafc104fd97a8a2b93bb20fff7