On 24.01.15 12:50, Peter Alexander wrote: > auto f = unique(); > [1, 5, 5, 2, 1, 5, 6, 6].filter!(f).writeln; // [1, 5, 2, 6] > > Filter needs an alias, and you cannot alias an R-value (it has no symbol).
Yes, I see :) But I think this should be supported by std.algorithm: import std.stdio, std.algorithm; struct Uniq{ bool[int] c; bool opCall(int a){ if (a in c) return false; else{ c[a] = true; return true; } } } void main() { [1, 5, 5, 2, 1, 5, 6, 6].filter!Uniq.writeln; }