DIP1000: Scoped Pointers (Discussion)
Dicebot via Digitalmars-d
digitalmars-d at puremagic.com
Thu Aug 18 10:00:45 PDT 2016
On 08/12/2016 01:24 PM, Robert burner Schadek wrote:
>> No, the DIP doesn't handle several levels of indirection.
>
> What about:
>
> struct Bar { int a; int b }
> auto rcs = RefCountedTree!(string,Bar)();
>
> fcs["bar"].a = 1337; // log n
> fcs["bar"].b = 1338; // log n
>
> ? I need to pay log n twice to assign two members
Note though that while it won't work with example of `RefCountedSlice`
implementation in DIP (which marks return value as scope reducing
lifetime to expression), it should be possible to instead mark method
itself (== hidden `this` argument) as `return scope` thus saying that
return value has same lifetime as `this`.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20160818/fd358d97/attachment.sig>
More information about the Digitalmars-d
mailing list