On 09/06/2011 11:03 PM, Vladimir Panteleev wrote:
What I'm trying to do:

struct S1 { int f; }
struct S2
{
S1 s1;
alias s1.f g;
}

This doesn't work. The declaration compiles, but attempts to access g
result in:

Error: struct test.S2 'f' is not a member
Error: struct test.S2 member f is not accessible
Error: this for f needs to be type S1 not type S2

Yes, that is because alias does not work with expressions, only with symbols.


I could generate @properties with mixins, but that breaks DDoc. Is there
a neater solution?


You mean like this?

struct S1 { int f; }
struct S2 {
    S1 s1;
    @property int g(){return s1.f;}
    @property void g(int x){s1.f=x;}
}

You may be able to remove the effect on Ddoc by using a version(StdDdoc) condition or similar.


Reply via email to