Hi,
Does anyone know if there is possible to decide in runtime either to call:
delete someptr;
or
delete [] someptr;
What about smart pointers? How do they know which one to call?
Kjetil Haga
Printable View
Hi,
Does anyone know if there is possible to decide in runtime either to call:
delete someptr;
or
delete [] someptr;
What about smart pointers? How do they know which one to call?
Kjetil Haga
Hi again...
I've taken a look at boost and they have a separate smart pointer for arrays (shared_array). Since the boosters have made a separate class for handling dynamic arrays, I guess this is not possible. Please correct me if I'm wrong....
Thanks.
Kjetil
the solution is never to use arrays and then you need never use delete []
use std::vector instead of arrays.
The best things come to those who rate