On Nov 4, 1:23 pm, "Mike Wahler" <mkwah...@mkwahler.netwrote:
Quote:
<PengYu...@gmail.comwrote in messagenews:1162653090.149661.139220@i42g2000cwa.g ooglegroups.com...
>
>
Quote:
In FFTW (
http://www.fftw.org/), it defines the funciton fftw_malloc to
allocate memory properly aligned.
>
Quote:
However, I only want to use new to allocate memory for
std::complex<double>.std::complex<double*p = new std::complex<double>;
/* do stuff with the object */
delete p;
I was asking how to redefine the "new" operator, such that when I call
new std::complex<double>[10]
it will call fftw_malloc function to allocate the memory.
Quote:
>
Quote:
Can some body show me how to redefine the new
operator for an class already defined in the library?You don't need to redefine 'new'.
>
BTW why do you feel you need to dynamically allocate
your object(s) anyway?
For example, the array is defined in an class, and its size is not
fixed.