Re: Range violation with AAs

2016-10-17 Thread Nordlöw via Digitalmars-d-learn
On Monday, 17 October 2016 at 19:10:54 UTC, Basile B. wrote: Just a question, maybe off topic, does this work: unittest { alias Key = string; alias A = Array!int; A[Key] x; x["a"] = [0]; } ? No, that works. Thanks for your interest.

Re: Range violation with AAs

2016-10-17 Thread Basile B. via Digitalmars-d-learn
On Monday, 17 October 2016 at 17:43:19 UTC, Nordlöw wrote: At https://github.com/nordlow/phobos-next/blob/master/src/array_ex.d I have an array container. Everything works as expected in all unittests except for the line at

Re: Range violation with AAs

2016-10-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/17/16 1:43 PM, Nordlöw wrote: At https://github.com/nordlow/phobos-next/blob/master/src/array_ex.d I have an array container. Everything works as expected in all unittests except for the line at https://github.com/nordlow/phobos-next/blob/master/src/array_ex.d#L1649 that fails as

Re: Range violation with AAs

2016-10-17 Thread Ali Çehreli via Digitalmars-d-learn
On 10/17/2016 11:40 AM, Nordlöw wrote: On Monday, 17 October 2016 at 18:22:53 UTC, Ali Çehreli wrote: It still feels like x["a"] could return a proxy that could later add a new element and then apply ~= on it. (I haven't read the rest of your code to see whether you've already done that.)

Re: Range violation with AAs

2016-10-17 Thread Nordlöw via Digitalmars-d-learn
On Monday, 17 October 2016 at 18:38:30 UTC, Ali Çehreli wrote: As a consolation :) there are two unrelated issues in your code, which a new dmd warns about: Deprecation: Implicit string concatenation is deprecated 1) Probably a missing comma after `mark`: enum nonStateHTMLTags = [`b`, `i`,

Re: Range violation with AAs

2016-10-17 Thread Nordlöw via Digitalmars-d-learn
On Monday, 17 October 2016 at 18:22:53 UTC, Ali Çehreli wrote: It still feels like x["a"] could return a proxy that could later add a new element and then apply ~= on it. (I haven't read the rest of your code to see whether you've already done that.) `Array` is in essence a C++-style array

Re: Range violation with AAs

2016-10-17 Thread Ali Çehreli via Digitalmars-d-learn
On 10/17/2016 11:28 AM, Nordlöw wrote: On Monday, 17 October 2016 at 18:22:53 UTC, Ali Çehreli wrote: Unfortunately, as far as I know, that's a privilege reserved for built-in AAs. But I *am* using a built-in AA. The problem happens when the value is an instance of an `Array!T`-container and

Re: Range violation with AAs

2016-10-17 Thread Nordlöw via Digitalmars-d-learn
On Monday, 17 October 2016 at 18:22:53 UTC, Ali Çehreli wrote: Unfortunately, as far as I know, that's a privilege reserved for built-in AAs. But I *am* using a built-in AA. The problem happens when the value is an instance of an `Array!T`-container and not a slice `T[]`.

Re: Range violation with AAs

2016-10-17 Thread Nordlöw via Digitalmars-d-learn
On Monday, 17 October 2016 at 17:43:19 UTC, Nordlöw wrote: At https://github.com/nordlow/phobos-next/blob/master/src/array_ex.d I have an array container. Everything works as expected in all unittests except for the line at

Re: Range violation with AAs

2016-10-17 Thread Ali Çehreli via Digitalmars-d-learn
On 10/17/2016 10:43 AM, Nordlöw wrote: At https://github.com/nordlow/phobos-next/blob/master/src/array_ex.d I have an array container. Everything works as expected in all unittests except for the line at https://github.com/nordlow/phobos-next/blob/master/src/array_ex.d#L1649 that fails as