Re: Create array from range

2021-10-09 Thread Ali Çehreli via Digitalmars-d-learn
On 10/9/21 4:58 PM, Greg Strong wrote: How do I filter some elements of an array into a new array? This doesn't answer your specific question but std.algorithm.remove may be usable in some cases: https://dlang.org/phobos/std_algorithm_mutation.html#remove If it matters, the following sol

Re: Create array from range

2021-10-09 Thread jfondren via Digitalmars-d-learn
On Saturday, 9 October 2021 at 23:58:14 UTC, Greg Strong wrote: This should be a simple question, but I'm having difficult finding an answer. How do I filter some elements of an array into a new array? The filter! function returns a range, but I can't seems to assign it to a new array. I get

Re: Create array from range

2021-10-09 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Oct 09, 2021 at 11:58:14PM +, Greg Strong via Digitalmars-d-learn wrote: > This should be a simple question, but I'm having difficult finding an > answer. How do I filter some elements of an array into a new array? > The filter! function returns a range, but I can't seems to assign it

Create array from range

2021-10-09 Thread Greg Strong via Digitalmars-d-learn
This should be a simple question, but I'm having difficult finding an answer. How do I filter some elements of an array into a new array? The filter! function returns a range, but I can't seems to assign it to a new array. I get: Cannot implicitly convert expression of type FilterResult!(_