Thread overview | |||||
---|---|---|---|---|---|
|
January 09, 2012 How do you overload new and delete for a class? | ||||
---|---|---|---|---|
| ||||
Hi, Can someone please provide an example regarding overloading new and delete for a class? Thanks a lot. |
January 09, 2012 Re: How do you overload new and delete for a class? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adrian Mercieca | 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
|
January 10, 2012 Re: How do you overload new and delete for a class? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alex Rønne Petersen | 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. |
Copyright © 1999-2021 by the D Language Foundation