www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - AA.values un- safe?!

reply Per =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
Why is call to `values` in, for instance,

```d
auto _ = string[string].init.values;
```

not ` safe`?
Jul 28 2021
parent reply jfondren <julian.fondren gmail.com> writes:
On Wednesday, 28 July 2021 at 21:04:11 UTC, Per Nordlöw wrote:
 Why is call to `values` in, for instance,

 ```d
 auto _ = string[string].init.values;
 ```

 not ` safe`?
I don't know, but .byValue is safe and returns a forward range, so you could use `.init.byValue.array` instead.
Jul 28 2021
parent Per =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
On Wednesday, 28 July 2021 at 21:39:43 UTC, jfondren wrote:
 I don't know, but .byValue is  safe and returns a forward 
 range, so you could use `.init.byValue.array` instead.
Great point. Thanks.
Jul 28 2021