Reference counted containers prototype

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Dec 26 19:00:57 PST 2011


On 12/26/11 7:49 PM, Andrej Mitrovic wrote:
> On 12/27/11, Andrei Alexandrescu<SeeWebsiteForEmail at erdani.org>  wrote:
>> We can easily have opDispatch look at field names. But I think it's poor
>> design to expose bald data anyway.
>
> opDispatch doesn't work with property functions,

It actually does, as per the unittests. Even if it currently does by 
@property being too lax, it should continue to work.

> or opBinary,

Should work, as operators are just translated to regular methods.

> or
> opOpAssign.

Should work.

> And what about the ctor? I can't call the ctor with your
> RefCounted.

Well, construction is a delicate topic. Currently RefCounted handles all 
construction internally, e.g. it doesn't take over a pointer to an 
existing instance (as C++'s shared_ptr does). So construction of objects 
needs to be handled by RefCounted itself - e.g. by forwarding 
constructor parameters.


Andrei


More information about the Digitalmars-d mailing list