GenericList(of Class) から一定条件の要素を取り除く
- http://blogs.wankuma.com/esten/archive/2010/05/26/189409.aspx
- http://blogs.wankuma.com/episteme/archive/2010/05/26/189421.aspx
- http://blogs.wankuma.com/masaru/archive/2010/05/26/189423.aspx
- http://d.hatena.ne.jp/masa-k/20100526/1274883396
コレクションがないのでこんな感じで.filterの返り値がなぁ…
import std.algorithm, std.stdio; class Cat { private: string name_, type_; public: this(string name, string type) { name_ = name; type_ = type; } @safe @property nothrow { string name() { return name_; } void name(string name) { name_ = name; } } @safe @property nothrow { string type() { return type_; } void type(string type) { type_ = type; } } } void main() { Cat[] nyans = [ new Cat("しゅうたん", "アメショ" ), new Cat("ろり", "アメショ"), new Cat("みずきちゃん", "スコティ"), new Cat("マグさん", "ほげ") ]; foreach (nyan; filter!q{a.type != "ほげ"}(nyans)) writeln(nyan.name, "は", nyan.type); }