On 12/21/2013 05:39 PM, aldanor wrote:
> On Saturday, 21 December 2013 at 21:49:01 UTC, MrSmith wrote:
>> just use foreach_reverse
>
> Wow, I never knew it is a keyword, thank you!
I feel guilty for omitting in knowingly but we've been hearing that it
would be deprecated. I don't think it will
On Saturday, 21 December 2013 at 21:49:01 UTC, MrSmith wrote:
On Saturday, 21 December 2013 at 00:47:04 UTC, aldanor wrote:
Is there an efficient method to remove elements with multiple
(compile-time-unknown) indices from an array? I currently do
something like
if (!index.empt
On Saturday, 21 December 2013 at 00:47:04 UTC, aldanor wrote:
Is there an efficient method to remove elements with multiple
(compile-time-unknown) indices from an array? I currently do
something like
if (!index.empty)
foreach (i; index.sort.reverse)
On Saturday, 21 December 2013 at 02:52:00 UTC, bearophile wrote:
Do not forget to add the () after the sort, otherwise you call
the deprecated, buggy and slow built-in sort.
reverse is another deprecated built-in, so use "retro".
The first "if" is not much useful, trying to sort an empty
arra
On Saturday, 21 December 2013 at 03:22:22 UTC, H. S. Teoh wrote:
Unfortunately, while std.algorithm.remove does provide a way to
do this
if the number of indices to remove are known beforehand, it
doesn't seem
to be able to remove a dynamic list of indices. Probably an
enhancement
request shou
On Fri, Dec 20, 2013 at 07:13:59PM -0800, H. S. Teoh wrote:
> On Fri, Dec 20, 2013 at 07:01:17PM -0800, Ali Çehreli wrote:
> > On 12/20/2013 06:17 PM, aldanor wrote:
> > >On Saturday, 21 December 2013 at 01:42:04 UTC, Ali Çehreli wrote:
> > >
> > >>That's probably a bug, right? The indexes would pr
On Fri, Dec 20, 2013 at 07:01:17PM -0800, Ali Çehreli wrote:
> On 12/20/2013 06:17 PM, aldanor wrote:
> >On Saturday, 21 December 2013 at 01:42:04 UTC, Ali Çehreli wrote:
> >
> >>That's probably a bug, right? The indexes would probably become off as
> >>the array gets shorter.
> >
> >Note the .reve
On 12/20/2013 06:17 PM, aldanor wrote:
On Saturday, 21 December 2013 at 01:42:04 UTC, Ali Çehreli wrote:
That's probably a bug, right? The indexes would probably become off as
the array gets shorter.
Note the .reverse there?
Yes, I missed that part. :)
Which makes sure indices don't get o
aldanor:
Is there an efficient method to remove elements with multiple
(compile-time-unknown) indices from an array? I currently do
something like
if (!index.empty)
foreach (i; index.sort.reverse)
a = a.remove(i);
... wh
On Saturday, 21 December 2013 at 01:42:04 UTC, Ali Çehreli wrote:
That's probably a bug, right? The indexes would probably become
off as the array gets shorter.
Note the .reverse there? Which makes sure indices don't get off.
Still, that's probably an inefficient way of doing this...
On 12/20/2013 04:47 PM, aldanor wrote:
> Is there an efficient method to remove elements with multiple
> (compile-time-unknown) indices from an array? I currently do
something like
>
> if (!index.empty)
> foreach (i; index.sort.reverse)
> a = a.remove(i);
11 matches
Mail list logo