how to copy const struct with indirections to mutable one (of the same type)

Mathias Lang via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Nov 29 02:49:07 PST 2016


On Tuesday, 29 November 2016 at 10:46:04 UTC, drug wrote:
> I had the following code:
> ```
> import std.algorithm: equal;
>
> [...]

You are not calling the (identity) opAssign here, but postblit.

To call identity opAssign, you need an already constructed 
instance:

```
Data mutable_data;
mutable_data = const_data;
```


More information about the Digitalmars-d-learn mailing list