3 ms·
See my edit. You're probably interested in views, with which you can do stuff similar to lazy functional languages v | std::views::reverse | std::views::drop
by eska 5y ago
See my edit. You're probably interested in views, with which you can do stuff similar to lazy functional languages
v | std::views::reverse | std::views::drop(2);
Here's an intro https://hannes.hauswedell.net/post/2019/11/30/range_intro/ https://hannes.hauswedell.net/post/2019/11/30/range_intro/
- blt 5y agoSadly the C++20 ranges library does not include any facility to create views by writing Python-like generator loops (coroutine loops with "yield"). Creating new views is about as difficult as creating iterators before - i.e. too difficult.
- eska 5y agoThen your complaint is not orthogonality. Orthogonality means that you can use a for each loop, find_if, any_of, ranges::any_of and everything will still compose the same no matter where the data comes from (file, network, a function that advances an iterator). Your complaint seems to be that iterators instead of coroutines are used here.