2009-07-28から1日間の記事一覧
const(char*) toMBSz(in wchar[] t) { return toMBSz(to!string(t)); } const(char*) toMBSz(in dchar[] t) { return toMBSz(to!string(t)); } alias std.windows.charset.toMBSz toMBSz; void p(T)(T t) { printf("%s\n", toMBSz(to!string(t))); } しかしW…
import std.stdio; struct shared_ptr(T) if (is(T == class)) { uint n; T p; alias p this; this(T p) { n++; this.p = p; writeln("construct, ", n); } this(this) { n++; writeln("reference copy, ", n); } ~this() { n--; if (n==0) { delete p; writ…