Re: Assoc. Array and struct with immutable member

2018-04-17 Thread Dgame via Digitalmars-d-learn
On Tuesday, 17 April 2018 at 11:38:17 UTC, Jonathan M Davis wrote: On Sunday, April 15, 2018 17:59:01 Dgame via Digitalmars-d-learn wrote: How am I supposed to insert a struct with immutable members into an assoc. array? Reduced example: struct A { immutable string name; } A[string]

Re: Assoc. Array and struct with immutable member

2018-04-17 Thread Alex via Digitalmars-d-learn
On Tuesday, 17 April 2018 at 11:07:55 UTC, bauss wrote: Even though it works in static this, then it still looks like a bug if you ask me, because the associative array itself isn't immutable. Yeah... I'm not sure, if this behavior is wanted, too... If you argue, that an absent field in in

Re: Assoc. Array and struct with immutable member

2018-04-17 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, April 15, 2018 17:59:01 Dgame via Digitalmars-d-learn wrote: > How am I supposed to insert a struct with immutable members into > an assoc. array? > > Reduced example: > > struct A { > immutable string name; > } > > A[string] as; > as["a"] = A("a"); // Does not work > I w

Re: Assoc. Array and struct with immutable member

2018-04-17 Thread bauss via Digitalmars-d-learn
On Sunday, 15 April 2018 at 18:51:52 UTC, Alex wrote: On Sunday, 15 April 2018 at 17:59:01 UTC, Dgame wrote: How am I supposed to insert a struct with immutable members into an assoc. array? Reduced example: struct A { immutable string name; } A[string] as; as["a"] = A("a"); // Does

Re: Assoc. Array and struct with immutable member

2018-04-15 Thread Alex via Digitalmars-d-learn
On Sunday, 15 April 2018 at 17:59:01 UTC, Dgame wrote: How am I supposed to insert a struct with immutable members into an assoc. array? Reduced example: struct A { immutable string name; } A[string] as; as["a"] = A("a"); // Does not work Via a static this() it would work. But