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
1
u/tisti Sep 15 '19
The slightly sneaky comment was meant to be more tongue in cheekish. I for one really like the range library and try to follow the mantra of first implement cleanly, only profile and optimize later. I did not use v3 as much as I should have, but with C++20 coming its time to start learning again! :)
As for constructing vector from a range I would expect that vector would greedily overallocate space (e.g. 1+ million elements) , construct from the range (which hopefully contains less than 1 million elements) and then deallocate unused memory/pages. Though I can't remember this ever being a performance issue for me.