Let\'s say I have a class.
class BigData {...};
typedef boost::shared_ptr BigDataPtr;
Then I do:
BigDataPt
It is safe if BigData constructor and destructor do not throw exceptions and bigDataPtr is not shared between threads and no pointers or references exist to dynamically allocated members of BigData (if any).
If the destructor throws an exception you may end up with a partially destroyed object (throwing destructors are not generally recommended and standard containers require that destructors of elements do not throw).
If the constructor throws you may end up destroying the object but not constructing a new one.
If bigDataPtr is shared between threads that may also lead to a race condition unless a locking discipline is used.
If code elsewhere takes references or pointers to dynamically allocated members of BigData, when it creates a new BigData its dynamically allocated members may be allocated at other addresses, so existing pointers and references to the members become invalid.
If you are concerned with dubious dereference in new (&*bigDataPtr) BigData; statement use a plain pointer instead:
BigData* p = bigDataPtr.get();
p->~BigData();
new (p) BigData;