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

Nick Sabalausky a at a.a
Tue Jul 27 17:24:27 PDT 2010


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[])) 




More information about the Digitalmars-d-learn mailing list