// Was: ~this() void close() {//用函数替换析构函数 // ... }//不能在析构函数分配内存 // ... auto gp = new Gnuplot(); scope (exit) { gp.close(); }