On 6/15/23 8:31 PM, zjh wrote:

Because disabled `this()`, the behavior of `this(int i)`is inconsistent and cannot achieve similar `RAII` as `C++`. What should I do?


You cannot have parameter-less constructors in D structs. However, destruction works the same.

Instead, you can use factory functions to initialize.

But there is no way in D to have e.g.:

```d
B b; // runs a constructor
```

-Steve

Reply via email to