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:

struct Foo
{
    static Foo opCall ()
    {
        Foo foo;
        // initialize foo
        return foo;
    }
}

auto foo = Foo();

--
/Jacob Carlborg

Reply via email to