Difference between range `save` and copy constructor

uranuz neuranuz at gmail.com
Sun Feb 16 10:41:31 UTC 2020


I have reread presentation:
http://dconf.org/2015/talks/davis.pdf
We declare that `pure` input range cannot be `unpoped` and we 
can't return to the previous position of it later at the time. So 
logically there is no sence of copying input range at all. So 
every Phobos algorithm that declares that it's is working with 
InputRange must be tested for working with range with disabled 
copy constructor and postblit. And if it is not it means that 
this algroithm actually requires a forward range and there we 
missing `save` calls?
Because as it was written in this presentation a range copy is 
undefined (without call to save). So it's illegal to create copy 
of range in Phobos algorithms without `save`?
So we need a test for every algorithm that it is working with 
range with disabled copy constructor and postblit if we declare 
that we only use `save` for range copy?


More information about the Digitalmars-d-learn mailing list