Reference counted containers prototype

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Dec 26 17:29:36 PST 2011


On 12/26/11 7:25 PM, Peter Alexander wrote:
> Following up to this, how do I access non-function members of the held
> object? e.g.
>
> struct Foo
> {
> int x = 1;
> }
>
> void main()
> {
> RefCounted!Foo f;
> writeln(f.x); // Doesn't work
> }

We can easily have opDispatch look at field names. But I think it's poor 
design to expose bald data anyway.

> Also, what about template member functions of the held object?
>
> struct Foo
> {
> int get(int X)() { return X; }
> }
>
> void main()
> {
> RefCounted!Foo f;
> writeln(f.get!123()); // Doesn't work either
> }

This is a problem.


Andrei


More information about the Digitalmars-d mailing list