Using std.stdio.File in a class

Adam D. Ruppe destructionator at gmail.com
Tue Apr 8 07:53:55 PDT 2014


On Tuesday, 8 April 2014 at 14:52:02 UTC, Spacen Jasset wrote:
> Are you not supposed to new structs anymore?

Only if they're pointers. new File returns a File*, not a File.

But you shouldn't new a File because then the file won't be 
automatically closed when it goes out of scope (RAII indeed).

Your code should work if you just take out the new keyword.


More information about the Digitalmars-d-learn mailing list