On Tuesday, 5 August 2014 at 20:32:08 UTC, Philippe Sigaud wrote:
I'd have thought that this would work:

struct A
{
    int[] i;
    B b;

    struct B
    {
        void foo() { i ~= 1;}
    }
}

void main()
{
    A a;
    a.b.foo();
}

But the compiler tells me 'need this for i of type int[]'.
Is there any way I can gain access on i inside B?

I know I've read this in TDPL, but don't recall enough.

Does this help : http://www.digitalmars.com/d/archives/digitalmars/D/learn/Nested_struct_member_has_no_access_to_the_enclosing_class_data_38294.html ?

Reply via email to