How to use structs for RAII?
doob at me.com
Sun Jan 23 06:43:29 PST 2011
On 2011-01-23 00:03, Sean Eskapp wrote:
> It was recommended to me to use structs for RAII instead of scope classes,
> since scope is being removed (?). However, since default-constructors for
> structs can't exist, how does one do this?
You can use a static opCall, like this:
static Foo opCall ()
// initialize foo
auto foo = Foo();
More information about the Digitalmars-d-learn