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.

oost::weak_ptr Object Access (cont.)Alternatively, you can use a boost::shared_ptr constructor instead of theweak <strong>pointer</strong>’s lock() member.color window::get_parent_bkgr_color(){// We may not have a parent anymoretry{boost::shared_ptr safe_parent(m_parent);return safe_parent->get_bkgr_color();}catch(boost::bad_weak_ptr&) {throw no_parent;}}

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

Saved successfully!

Ooh no, something went wrong!