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.

How to enable shared from thisIf we were to implement enable_shared_from_this manually in our class, itwould look like this:class window {// …boost::weak_ptr m_weak_this;window(){}public:boost::shared_ptr shared_from_this() {return boost::shared_ptr(m_weak_this);}static boost::shared_ptr create() {boost::shared_ptr shared_this(new window);shared_this->m_weak_this = shared_this;return shared_this;}};

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

Saved successfully!

Ooh no, something went wrong!