C++'s this() equivalent?

zjh fqbqrr at 163.com
Fri Jun 16 00:45:55 UTC 2023


On Friday, 16 June 2023 at 00:35:48 UTC, Steven Schveighoffer 
wrote:
> But there is no way in D to have e.g.:
>
> ```d
> B b; // runs a constructor
> ```
>
> -Steve


As a `C++` user, it is very terrible to simplify `RAII` without 
such a method. Why must `this()` be disabled? Can't there be a 
constructor? In a constructor, you can complete `some work`. 
Without it, how can you simplify `RAII`?.



More information about the Digitalmars-d-learn mailing list