Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Standard {
- module Algorithms {
- Filter(this, comp) {
- comptype := Expression(Utility.Forward(comp)).Type;
- thistype := Expression(Utility.Forward(this)).Type;
- if ((Utility.IsMovable(comptype) && comptype.IsRRef()) || Utility.IsCopyable(comptype)
- && (Utility.IsMovable(thistype) && thistype.IsRRef()) || Utility.IsCopyable(thistype)) {
- it_type := type {
- };
- resulttype := type {
- func := Utility.Forward(comp);
- src := Utility.Forward(this);
- };
- return resulttype();
- }
- // Not suitable for lazy evalutation, eagerly evaluate.
- result := Containers.Vector(Compiler.Expression(*this.Begin).Type)();
- while(this) {
- x := *this.Begin;
- if (comp(x)) result.Insert(result.Back(), x);
- ++this.Begin;
- }
- return result;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement