Can somebody explain what is a borrowed_range?

the text reads

iterators of borrowed ranges can sill be used when the range itself no longer exists


A borrowed range is one whose iterator validity doesn't rely on the lifetime of the parent object. Passing a non-borrowed range to an algorithm as an rvalue means that it will return a ranges::dangling rather than an iterator. A borrowed range can be wrapped in a view object using views::all()

Last edited on
Registered users can post here. Sign in or register to post.