Difference between range `save` and copy constructor

Paul Backus snarwin at gmail.com
Sun Feb 16 19:22:01 UTC 2020


On Sunday, 16 February 2020 at 18:11:11 UTC, Jonathan M Davis 
wrote:
> Either way, generic code should never be using a range after 
> it's been copied, and copying is a key part of how idiomatic, 
> range-based code works in D.

"Copy and then never use the original again" is conceptually the 
same thing as "move", right? In which case, generic code can 
accommodate non-copyable ranges *and* more clearly communicate 
its intent by using `move` instead of a naked copy.


More information about the Digitalmars-d-learn mailing list