Struct that destroys its original handle on copy-by-value

Dicebot via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Aug 1 18:38:44 PDT 2015


On Saturday, 1 August 2015 at 17:50:28 UTC, John Colvin wrote:
> I'm not sure how good an idea it is to totally enforce a range 
> to be non-copyable, even if you could deal with the function 
> call chain problem. Even in totally save-aware code, there can 
> still be valid assignment of a range type. I'm pretty sure a 
> lot of phobos ranges/algorithms would be unusable.

This is exactly why I proposed to Joe design with destructive 
copy originally - that would work with any algorithms expecting 
implicit pass by value but prevent from actual double usage.

Sadly, this does not seem to be implementable in D in any 
reasonable way.


More information about the Digitalmars-d-learn mailing list