Associative array and ranges

bearophile bearophileHUGS at lycos.com
Thu Feb 3 13:48:09 PST 2011


Stanislav Blinov:

> Nrgyzer:
> > Ah, okay... I already tried some things with [0..i] ~ [i + 1..$] but
> > there was always an error and I thought, it must be done more simply.
> 
> There is no possible simplier way of removing an arbitrary element from 
> an array than doing that. Well, maybe there is: if your data is POD you 
> could use a memmove with subsequent slice-shrink, but I see we're 
> talking about storing references in this case.

~ performs a memory allocation, while generally moving items inside an array doesn't require it.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list