Simple code sample of Nesting Structures. I'm I doing something illegal here?

2014-11-22 Thread WhatMeWorry via Digitalmars-d-learn
// Two simple value type structures. one embedded in the other. I've stepped through the debugger and I see the embedded structure being set to 2, and dog. import std.stdio; struct NestedBottom { int i; char[3] fixedArray; // this(){} no-argument ctor can only be defined by

Re: Simple code sample of Nesting Structures. I'm I doing something illegal here?

2014-11-22 Thread Chris Nicholson-Sauls via Digitalmars-d-learn
On Saturday, 22 November 2014 at 20:57:07 UTC, WhatMeWorry wrote: auto bottom = NestedBottom(2, ['d','o','g']); That 'auto' is the problem. You want 'this.bottom = ...' instead.

Re: Simple code sample of Nesting Structures. I'm I doing something illegal here?

2014-11-22 Thread ketmar via Digitalmars-d-learn
On Sat, 22 Nov 2014 20:57:05 + WhatMeWorry via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: auto bottom = NestedBottom(2, ['d','o','g']); ah, that good old thingy! there were some debates about locals that shadows fields and how that can introduce some hard-to-catch

Re: Simple code sample of Nesting Structures. I'm I doing something illegal here?

2014-11-22 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Nov 22, 2014 at 11:54:01PM +0200, ketmar via Digitalmars-d-learn wrote: On Sat, 22 Nov 2014 20:57:05 + WhatMeWorry via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: auto bottom = NestedBottom(2, ['d','o','g']); ah, that good old thingy! there were some