Fastest way to "ignore" elements from array without removal
Paul Backus
snarwin at gmail.com
Tue Feb 16 14:34:40 UTC 2021
On Tuesday, 16 February 2021 at 09:08:33 UTC, z wrote:
> Does filter support multiple arguments for the predicate?(i.e.
> using a function that has a "bool function(T1 a, T2 b)"
> prototype)
I am not sure exactly what you are asking here, but you can
probably accomplish what you want by combining filter with
std.range.chunks or std.range.slide.
http://phobos.dpldocs.info/std.range.chunks.html
http://phobos.dpldocs.info/std.range.slide.html
> If not could still implement the function inside the loop but
> that would be unwieldy.
> And does it create copies every call? this is important because
> if i end up using .filter it will be called a 6 to 8 digit
> number of times.
filter does not create any copies of the original array. The same
is true for pretty much everything in std.range and std.algorithm.
More information about the Digitalmars-d-learn
mailing list