22.01.2011 23:04, Sean Eskapp пишет:
I'm using the Derelict SDL bindings, and I'm wrapping some parts of SDL in my
own objects. Originally, I was using classes, but this caused a number of
errors when the program exited, since Derelict unloaded itself before the
garbage collector took care of des
Sean Eskapp writes:
> == Quote from Andrej Mitrovic (andrej.mitrov...@gmail.com)'s article
>> You can use scoped!() from std.typecons:
snip
>> You must not escape a reference to the object outside of the foo()
>> scope. Note that you will get a runtime error if you try to do
>> something like t
On 01/22/11 14:53, Sean Eskapp wrote:
> == Quote from Andrej Mitrovic (andrej.mitrov...@gmail.com)'s article
>> You can use scoped!() from std.typecons:
>> import std.stdio;
>> import std.typecons;
>> class A
>> {
>> ~this()
>> {
>> writeln("A destructor");
>> }
>> }
>> void foo
== Quote from Andrej Mitrovic (andrej.mitrov...@gmail.com)'s article
> You can use scoped!() from std.typecons:
> import std.stdio;
> import std.typecons;
> class A
> {
> ~this()
> {
> writeln("A destructor");
> }
> }
> void foo()
> {
> auto a1 = scoped!A();
> }
> void main(
You can use scoped!() from std.typecons:
import std.stdio;
import std.typecons;
class A
{
~this()
{
writeln("A destructor");
}
}
void foo()
{
auto a1 = scoped!A();
}
void main()
{
foo();
writeln("exiting..");
}
You must not escape a reference to the object outs
I'm using the Derelict SDL bindings, and I'm wrapping some parts of SDL in my
own objects. Originally, I was using classes, but this caused a number of
errors when the program exited, since Derelict unloaded itself before the
garbage collector took care of destructing my classes.
So I switched to