struct destructors
John C
johnch_atms at hotmail.com
Fri Mar 7 01:13:29 PST 2008
Janice Caron wrote:
> I see that structs now have destructors, according to the changelog for D2.012.
>
> How does that work? I wasn't even aware that they had /con/structors!
> I've still been using static opCall for that (and hating doing so,
> because it's such a kludge).
We don't, as yet. Walter's announcement says: "Yes, you read that right,
struct destructors but no struct constructors yet."
>
> So do we get to use this() and ~this() now? Can we use new and delete
> with structs? Can we use delete with structs on the stack?
>
> Also, what about assignment and copy construction?
>
> ...and repeatedly returning a struct from a function (as in, e() calls
> f(), which calls g(), which calls h(); h returns a struct, which
> returns it to g, which returns it to f, which returns it to e). Will
> those nested returns invoke a chain of copy constructors and
> destructors? Or will it be optimised to just a single copy?
>
> That's a lot of questions for one post. Sorry about that.
>
> Oh - one more. What's a postblit?
http://www.digitalmars.com/d/2.0/struct.html
More information about the Digitalmars-d
mailing list