Re: Accessing members of an array of a class with map.

2016-09-30 Thread Ave via Digitalmars-d-learn
On Friday, 30 September 2016 at 19:31:55 UTC, Jonathan M Davis wrote: On Friday, September 30, 2016 19:04:11 Ave via Digitalmars-d-learn wrote: [...] The first example is segfaulting, because you never gave the variable, test, a value. It's null when you try and access its arrB member. -

Re: Accessing members of an array of a class with map.

2016-09-30 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, September 30, 2016 19:04:11 Ave via Digitalmars-d-learn wrote: > An example of what I'm trying to do: > > import std.stdio; > import std.container; > import std.algorithm; > class Aa > { > Array!B arrB; > } > > class Bb > { > string name; > > } > void main() > { > Aa

Accessing members of an array of a class with map.

2016-09-30 Thread Ave via Digitalmars-d-learn
An example of what I'm trying to do: import std.stdio; import std.container; import std.algorithm; class Aa { Array!B arrB; } class Bb { string name; } void main() { Aa test; auto c=new Bb; c.name="asdf"; test.arrB.insert(c); auto d=new Bb; d.name="1234";