What is this sort called?

Stefan Koch uplink.coder at googlemail.com
Fri Aug 27 16:24:15 UTC 2021


On Friday, 27 August 2021 at 15:02:59 UTC, Stefan Koch wrote:
>
> or in psedocode:
>
> ```d
>         foreach(i; ourPlace .. records.length -1)
>         {
>           records[i+1] = records[i];
>         }
> ```

I have been alerted to a rather nasty bug in this transcription.
it only works if you iterate the array in reverse as otherwise,
you'll override all values with `records[ourPlace]`

I guess `foreach_reverse` does have a place in the language after 
all.


More information about the Digitalmars-d mailing list