digitalmars.D.learn - How do you overload new and delete for a class?
- Adrian Mercieca <amercieca gmail.com> Jan 09 2012
- =?UTF-8?B?QWxleCBSw7hubmUgUGV0ZXJzZW4=?= <xtzgzorex gmail.com> Jan 09 2012
- Adrian Mercieca <amercieca gmail.com> Jan 09 2012
Hi, Can someone please provide an example regarding overloading new and delete for a class? Thanks a lot.
Jan 09 2012
On 09-01-2012 20:41, Adrian Mercieca wrote:Hi, Can someone please provide an example regarding overloading new and delete for a class? Thanks a lot.
This is deprecated. What you should be doing is using std.conv.emplace() with whatever allocator (say, malloc()) you wish to use. - Alex
Jan 09 2012
Hi Alex, Thanks for the answer. As for the allocation, you mention malloc: is that malloc from the C runtime library? You also imply alternatives to this allocator; what would these be? As for deletion, does on then invoke delete on the malloc'ed data pointer? Pointing me to some example would be greatly appreciated. Thanks. - Adrian.
Jan 09 2012








Adrian Mercieca <amercieca gmail.com>