05.09.2019 15:46, berni пишет:
On Thursday, 5 September 2019 at 12:15:51 UTC, drug wrote:
One solution could be using either pointer to `const(Point)` or class here (to avoid pointer using) https://run.dlang.io/is/rfKKAJ

OK. This are two solutions and although I'll probably not going to use any of those (due to other reasons), I still don't understand, why the original approach does not work. If I've got a book an put it in a box and later I'll get it out again, it's still the same book. So why has a struct changed when I put it into an AA and get it out again? It's not supposed to change...
Because structs are value types so when you put it into an AA you modify old value and because it is const/immutable compiler gives an error.

But if you just want to initialize an AA by immutable members then this can be usefull to read https://dlang.org/spec/hash-map.html#runtime_initialization

Reply via email to