Associative array and ranges

Stanislav Blinov stanislav.blinov at gmail.com
Thu Feb 3 14:25:13 PST 2011


On 02/04/2011 01:19 AM, Stanislav Blinov wrote:
> On 02/04/2011 12:48 AM, bearophile wrote:
>> 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.
>>
>
> Certainly. Forgot to mention that, thanks.

Hmm... Come to think of it, is it ever bad to memmove a reference? I 
wouldn't think so. I think I got C++ classes in mind when I wrote that.


More information about the Digitalmars-d-learn mailing list