首先,d里面都是reference,和java一样 用系统new出来的都是gc管理的 如果不想用gc管理,重载这个类的new和delete class也可以用auto修饰 auto class Foo{ this(){...} ~this(){...} } void test() { if(..){ auto Foo f= new Foo }//.~this() will be auto called at closing brack }
D语言的gc,非gc还有autoptr
最新推荐文章于 2025-05-28 08:53:03 发布