Re: Getting associative array value by reference

2015-03-31 Thread Mark Isaacson via Digitalmars-d-learn
Not quite. You'll note that I am creating the elements in the associative array, not just iterating over them; some of them just happen to be duplicates. FWIW: That foreach happens to be over an input stream.

Re: Getting associative array value by reference

2015-03-31 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 1 April 2015 at 03:11:58 UTC, Mark Isaacson wrote: I'm presently trying to create the value of a key in an associative array if it does not exist, and then maintain a reference/pointer to the value. This is what I came up with, but it seems really crufty and I feel that there must

Getting associative array value by reference

2015-03-31 Thread Mark Isaacson via Digitalmars-d-learn
I'm presently trying to create the value of a key in an associative array if it does not exist, and then maintain a reference/pointer to the value. This is what I came up with, but it seems really crufty and I feel that there must be a cleaner way: Value[string] assocArray; foreach (...) {