DIP1000: Scoped Pointers (Discussion)
Chris Wright via Digitalmars-d
digitalmars-d at puremagic.com
Fri Aug 12 07:02:50 PDT 2016
On Fri, 12 Aug 2016 10:24:22 +0000, 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
In the worst case, you can change the API so you can write:
rcs.update("bar", (x) { x.a = 1337; x.b = 1338; });
More information about the Digitalmars-d
mailing list