I don't understand why the following code does not compile while the commented out version does work.
#include <range/v3/all.hpp>
#include <iostream>
namespace rv = ranges::views;
int main() {
//std::vector<int> fives = {5,5,5,5,5,5,5,5,5,5};
//auto rng = fives | rv::sliding(2);
auto lazy_fives = rv::generate( [](){ return 5;});
auto rng = lazy_fives | rv::sliding(2);
for (auto pair : rng | rv::take(10)) {
for (auto val : pair) {
std::cout << val << " ";
}
std::cout << "\n";
}
}