D needs first-class lifetimes before it can get ownership and borrowing

Nick Treleaven nick at geany.org
Sun Aug 11 13:58:06 UTC 2019


On Saturday, 10 August 2019 at 18:11:18 UTC, a11e99z wrote:
>
> should there be an opportunity to transfer ownership?
> SmartPtr {
>   int* transfer() [@forget, @transfer, @orsomethingelse] { 
> return ptr; /*ptr = null;*/ }
> }

It would just use a trusted move constructor (or copy constructor 
if doing ref counting).



More information about the Digitalmars-d mailing list