When you allocate an array using new []
, why can\'t you find out the size of that array from the pointer? It must be known at run time, otherwise delete []
You most likely can access it, but it would require intimate knowledge of your allocator and would not be portable. The C++ standard doesn't specify how implementations store this data, so there's no consistent method for obtaining it. I believe it's left unspecified because different allocators may wish to store it in different ways for efficiency purposes.