'std::ranges::take_while_view cannot pipe

auto int_v10 = std::vector{8,7,3};
//fail    auto rng2 = int_v10 | std::ranges::take_while_view([](int x) {return x> 5;} ) | std::ranges::views::common;
auto rng2 = int_v10 | std::ranges::views::take_while([](int x) {return x> 5;} ) | std::ranges::views::common;
auto result4 = std::accumulate(rng2.begin(), rng2.end(),0);

std::cout<<"Result4: "<<result4<<'\n';

https://en.cppreference.com/w/cpp/ranges/take_while_view
Why std::ranges::take_while_view result cannot pipe to next code block. and std::ranges::views::take_while can?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source