How do I get an array from filter's result?

Jonathan M Davis jmdavisprog at gmail.com
Tue Jul 27 17:35:33 PDT 2010


On Tuesday, July 27, 2010 17:24:27 Nick Sabalausky wrote:
> On 2.047, this:
> 
> import std.algorithm;
> import std.array;
> void main()
> {
>     string[] result =
>         array(
>             filter!( (string a) { return a != "b"; } )
>             (["a", "b", "c"])
>         );
> }
> 
> Gives me this:
> 
> testfilter.d(6): Error: template std.array.array(Range) if
> (isForwardRange!(Range)) does not match any function template declaration
> testfilter.d(6): Error: template std.array.array(Range) if
> (isForwardRange!(Range)) cannot deduce template function from argument
> types !()(Filter!(__dgliteral1,string[]))

The forward range stuff is broken in 2.047. save() was added to the definition for 
isForwardRange(), but a bunch of forward ranges didn't get it added. It's been 
fixed in svn.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list