When should I use SortedRange.release?

Bastiaan Veelo Bastiaan at Veelo.net
Fri Apr 23 17:35:13 UTC 2021


For reference, `SortedRange.release` is 
[documented](https://dlang.org/phobos/std_range.html#.SortedRange) as such:

"Releases the controlled range and returns it."

Wow thanks! I love functions that are named exactly as what they 
do ;-) Seriously though, I still don't know what it is that it 
does, and why and when it should be done, and when not.

What happens when a range is released?
What happens if a range is not released?
What happens if a range is released more than once?

And what does "controlled" imply here? In what way has 
`SortedRange` control over the underlaying data? What can I do 
and what can't I do to the underlying data as long as 
`SortedRange` has control?

My failure to understand this function makes me fear I don't 
understand `SortedRange` at all, and thereby don't understand how 
to use `algorithm.sorting` properly.

Thanks!

-- Bastiaan.


More information about the Digitalmars-d-learn mailing list