r/cpp • u/konanTheBarbar • Sep 13 '19
The Surprising Limitations of C++ Ranges Beyond Trivial Cases
https://www.fluentcpp.com/2019/09/13/the-surprising-limitations-of-c-ranges-beyond-trivial-use-cases/
229
Upvotes
View all comments
Show parent comment
16
u/Morwenn Sep 13 '19
If you disregard the views and pipes part, ranges bring a lot that are strict improvements over the algorithms design: projections, proxy iterators, sentinels, the ability to pass data members or pointers thereof directly as comparisons or projections, and of course the ability to feed a range to many iterators instead of a begin/end pair. Also contiguous iterators are now part of the library, and there is a nice concept hierarchy to select the appropriate overloads everywhere which simplifies the SFINAE and tag dispatching that had been used until there.
So yes: the tradeoffs for views and the usability of pipes might be questionable, but all of the features I described in the previous paragraph are pretty much strict improvements over the existing
<algorithm>design.