Thread View: comp.std.c++
1 messages
1 total messages
Started by Dietmar Kuehl
Mon, 23 Oct 1995 21:31
allocating memory with 'T::operator new[]'
Author: Dietmar Kuehl
Date: Mon, 23 Oct 1995 21:31
Date: Mon, 23 Oct 1995 21:31
27 lines
2087 bytes
2087 bytes
Hi, is it possible to always allocate memory using 'T::operator new[]' even if this operator is not defined for 'T' (in which case '::operator new[]' is called)? ... and, of cource, the inverse with 'T::operator delete[]'. The problem where this would be handy is the following: An array template class (with template parameter 'T') which does not use built-in arrays to represent the array. The memory has to be allocated somehow with 'operator new[](size)'. But this call would call '::operator new[](size)', even if 'T::operator new[](...)' exists, because there is no way to figure out that the memory used for 'T's. On the other hand it would be logical to use 'T::operator new[](...)' to allocate the memory. However, if it is not possible to allocate memory with 'T::operator new[](size)' even if 'operator new[](size)' is not defined for 'T' (or a base class), there would be no way to write this template class such that always the correct new operator is called. The same argumentation can be applied to 'operator delete[](...)'. -- dietmar.kuehl@uni-konstanz.de http://www.informatik.uni-konstanz.de/~kuehl I am a realistic optimist - that's why I appear to be slightly pessimistic [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu. Contact address: std-c++-request@ncar.ucar.edu. The moderation policy is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads