2006-12-09から1日間の記事一覧
import std.stdio,std.typetuple; struct A{ int a,b; static A opCall(int v, int w){ A a; a.a = v; a.b = w; return a; } } void main(){ A* a = &cast(A)TypeTuple!(0,0); writefln("%s:%s", a.a, a.b); }頼むから一般化してくれ…。 a(1,2);がエラーだっ…
JSについたらしいけど最初必要性が良く分からなかった…けどようは段階的なのを一つの関数にまとめられると。 bool test(char[] t){ t~="t"; yield true; t~="e"; yield true; t~="s"; yield true; t~="t"; yield true; while(true) yield false; assert(0); …
!inの対応要望はずいぶん前からある>unofficial D wish list。 A !in Bは!(A in B)、A !!in Bは!!(A in B)でcast(bool)(A in B)と等価になってほしい。 ついでに一般化して!+とか!&&とかも対応できると思った。 !!+ってA==-Bと等価で!!-って==と等価だよねと…