Understanding range.dropBackOne

2021-09-28 Thread Tim via Digitalmars-d-learn
I'm doing the following: ```D int[25] window = 0; // Later in a loop window = someInteger ~ window[].dropBackOne; ``` But I'm struggling to understand why the following doesn't work ```D window = someInteger ~ window.dropBackOne; ``` What does the `[]` do exactly? Is an array not a bidirection

Re: Understanding range.dropBackOne

2021-09-28 Thread Tim via Digitalmars-d-learn
On Tuesday, 28 September 2021 at 23:12:14 UTC, Adam Ruppe wrote: On Tuesday, 28 September 2021 at 22:56:17 UTC, Tim wrote: [...] Note that this array has a fixed size. [...] Here the window[] takes a variable-length slice of it. Turning it from int[25] into plain int[]. Then you can drop

Re: Understanding range.dropBackOne

2021-09-28 Thread Adam Ruppe via Digitalmars-d-learn
On Tuesday, 28 September 2021 at 22:56:17 UTC, Tim wrote: I'm doing the following: int[25] window = 0; Note that this array has a fixed size. window = someInteger ~ window[].dropBackOne; Here the window[] takes a variable-length slice of it. Turning it from int[25] into plain int[]. Then