Syntax sugar for {} with structs
Ogi
ogion.art at gmail.com
Wed Jul 6 14:14:09 UTC 2022
On Friday, 1 July 2022 at 11:51:57 UTC, ryuukk_ wrote:
> I had to write this recently
>
>
> ```D
> void reset()
> {
> state.end_index = 0;
> state.buffer_list = SinglyLinkedList!(ubyte[])();
> }
> ```
>
> While not that bad, it's annoying, why can't we do like like:
> `A a = {}`?
>
>
> ```D
> void reset()
> {
> state.end_index = 0;
> state.buffer_list = {};
> }
> ```
Um, what’s wrong with `destroy`? It resets any variable to
initial state (and calls its destructor). Isn’t it what you need?
More information about the Digitalmars-d
mailing list