shared_ptr to an array : should it be used?

Just a small query regarding shared_ptr.

Is it a good practice to use shared_ptr pointing to an array? For example,

shared_ptr<int> sp(new int[10]);

If not, then why not? One reason I am already aware of is one can not increment/decrement the shared_ptr. Hence it can not be used like a normal pointer to an array.

2 Answers
2

Leave a Comment