Thread overview |
---|
June 26, 2019 Create empty SList or DList. | ||||
---|---|---|---|---|
| ||||
Is there a way to achieve that instead of something hacky like adding an initialized element and then removing it. Ex. instead of: auto stack = SList!int(0); stack.removeFront(); Then something that just allowed you to do: auto stack = SList!int; // Not allowed. --- I feel like this makes containers like that a big hassle in D because you may not wanna initialize the elements of them right away. |
June 26, 2019 Re: Create empty SList or DList. | ||||
---|---|---|---|---|
| ||||
Posted in reply to bauss | 26.06.2019 20:39, bauss пишет:
> auto stack = SList!int(0);
> stack.removeFront();
>
> Then something that just allowed you to do:
> auto stack = SList!int;
this compiles:
```
auto stack = SList!int();
```
|
June 26, 2019 Re: Create empty SList or DList. | ||||
---|---|---|---|---|
| ||||
Posted in reply to drug | On Wednesday, 26 June 2019 at 19:06:24 UTC, drug wrote:
> 26.06.2019 20:39, bauss пишет:
>> auto stack = SList!int(0);
>> stack.removeFront();
>>
>> Then something that just allowed you to do:
>> auto stack = SList!int;
>
> this compiles:
> ```
> auto stack = SList!int();
> ```
Maybe something else triggered it for me but I kept getting an error message like "not initialized with a value" or something like that .
I can't reproduce it right now though.
|
Copyright © 1999-2021 by the D Language Foundation