Are stack+heap classes possible in D?

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jun 17 10:53:10 PDT 2015


On Wed, 17 Jun 2015 06:02:46 +0000, WhatMeWorry wrote:

> I guess the question would be why would one want a struct on the heap
> and a class on the stack?  Performance reasons?

struct on the heap: some containers, for example, doing their own memory 
management.

class on the stack: guaranteed destruction when leaving a scope.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150617/65459999/attachment.sig>


More information about the Digitalmars-d-learn mailing list