C++ operator new

2009-01-25 Thread BLS

Hi,

I wonder if this is doable in D ?

class Cpp
{
public:
void* operator new(size_t n);
void* operator new(size_t n, void* p)
{ return p; }

}

Just guessing that operator new means this in D
class D
{
new(uint n);
new(uint n,void* p)
{ return p; }

}

Am I wrong ?
TIA, Bjoern



Re: C++ operator new

2009-01-25 Thread Daniel Keep

This might also be of interest, as it has an example of overriding
allocation/deallocation to use malloc:

http://digitalmars.com/d/1.0/memory.html#newdelete