12.07.2015 Views

dangling pointer

dangling pointer

dangling pointer

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Reassigning a shared_ptrboost::shared_ptr sp(new X);// use sp, perhaps pass it around// Put sp in charge of a new X object, delete old X unless// there are other copiessp.reset(new X);// The two resets are more efficient and concise versions// of:sp = boost::shared_ptr();sp = boost::shared_ptr(new X);

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!