How about some __initialize magic?
Stanislav Blinov
stanislav.blinov at gmail.com
Sun Nov 28 08:54:39 UTC 2021
On Sunday, 28 November 2021 at 03:19:49 UTC, russhy wrote:
> I would love to be able to do:
This is orthogonal to this discussion. Even if concise
initializer syntax that you suggest was allowed...
> ```D
>
> T* t = alloc();
>
> (*t) = .{};
> ```
...that's an assignment. I.e. that would lower down to
`uninitializedGarbage.opAssign(T.init);`. Destructing garbage
and/or calling operators on garbage isn't exactly the way to
success :)
Which is the crux of the problem in question, and why things like
`emplace` exist in the first place.
More information about the Digitalmars-d
mailing list