When D feels unfinished: union initialization and NRVO
Jacob Carlborg
doob at me.com
Fri Mar 20 18:44:32 UTC 2020
On 2020-03-20 13:27, Mathias Lang wrote:
> But you can't deal with user-provided types. You'll have to blindly cast
> away to mutable to make it work.
Yes.
> And from my experience, ignoring the
> type system always comes back to bite you at one point or another.
Possibly, but I think in this case it's fine.
Static initialization cannot be used if the struct has a constructor
defined.
In my serialization library, Orange [1], I'm both casting away
immutable/const and bypass any constructors.
[1] https://github.com/jacob-carlborg/orange
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list