filter!(not!(predicate))(someInputRange) does not compile

Jens Mueller jens.k.mueller at gmx.de
Wed Jan 19 15:53:15 PST 2011


Hi,

I cannot make the following compile.

import std.functional;
import std.array;
import std.algorithm;
import std.stdio;

void main() {
    auto numbers = [0, 1, 2, 3, 4, 5];

    bool alwaysTrue(uint a) { return true; }
    alias not!(alwaysTrue) alwaysFalse;

    numbers = array(filter!(alwaysTrue)(numbers));
    writeln(numbers);
    numbers = array(filter!(alwaysFalse)(numbers)); // does not compile
    writeln(numbers);
}

The line with alwaysFalse fails with:
/path/to/../src/phobos/std/algorithm.d(854): Error: constructor
std.algorithm.Filter!(not,int[]).Filter.this cannot get frame pointer to
not

Any ideas what I'm doing wrong or workarounds?

Jens


More information about the Digitalmars-d mailing list