I have tested your code.
Igor Tandetnik wrote:
Note that new (void*[100]) and new void*[100] are different. The former
allocates a single element of type void*[100], which must be deallocated
with delete. The latter allocates 100 elements of type void*, and must
be deallocated with delete[].
Igor, I think you are wrong here, even though I agree with your logic. I
can't exactly explain it, but I had a similar false assumption cleared by a
discussion on comp.lang.c++.moderated. My approach was roughly this:
typedef int array[100];
auto_ptr<array> p(new array);
IOW, I create a type alias for an array which then allows me to use
non-array new and non-array delete (via auto_ptr) to manage objects of that
type. What I was told is that new decides on the complete type whether it
is the array form or not.
I'll try to locate the thread over the weekend and post the update here.
Uli