www.digitalmars.com         C & C++   DMDScript  

D - deleting array element

reply "Pavel Minayev" <evilone omen.ru> writes:
It'd be great to have some operator, or method, or something
to delete an element of the dynamic array quickly. Currently
this is done like that:

    array = array[0 .. index] ~ array[index + 1 .. array.length];

But it's quite a lot of typing... something like this
is shorter, and just looks better:

    array.remove(index);

    -- or --

   delete[index] array;
Feb 01 2002
parent "Carlos Santander B." <carlos8294 msn.com> writes:
"Pavel Minayev" <evilone omen.ru> escribiσ en el mensaje
news:a3em3k$24um$1 digitaldaemon.com...
| It'd be great to have some operator, or method, or something
| to delete an element of the dynamic array quickly. Currently
| this is done like that:
|
|     array = array[0 .. index] ~ array[index + 1 .. array.length];
|
| But it's quite a lot of typing... something like this
| is shorter, and just looks better:
|
|     array.remove(index);
|
|     -- or --
|
|    delete[index] array;
|
|

This is a great idea!

—————————————————————————
Carlos Santander


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.463 / Virus Database: 262 - Release Date: 2003-03-17
Mar 23 2003