Advertisement
bogolt

shared_from_this in destructor

Sep 30th, 2011
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.27 KB | None | 0 0
  1. #include <boost/shared_ptr.hpp>
  2. #include <boost/enable_shared_from_this.hpp>
  3.  
  4. struct test : public boost::enable_shared_from_this<test>
  5. {
  6.     ~test()
  7.     {
  8.         // exception thrown here
  9.         shared_from_this();
  10.     }
  11. };
  12.  
  13. int main()
  14. {
  15.     boost::shared_ptr<test> t(new test());
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement