Accomplishing boost::shared_from_this() in constructor via boost::shared_from_raw(this)
Posted
by Kyle
on Stack Overflow
See other posts from Stack Overflow
or by Kyle
Published on 2010-05-11T23:49:50Z
Indexed on
2010/05/11
23:54 UTC
Read the original article
Hit count: 316
Googling and poking around the boost code, it appears that it's now possible to construct a shared_ptr to this in a constructor, by inheriting from enable_shared_from_raw and calling shared_from_raw(this)
- Is there any documentation or examples of this? I'm finding nothing with google.
- Why am I not finding any useful buzz on this on google? I would have thought using shared_from_this in a constructor would be a hot/desirable item.
- Should I be inheriting from both enable_shared_from_raw and enable_shared_from_this, and restricting my usage of enable_shared_from_raw when I have to?
- If so, why? Is there a performance hit with shared_from_raw?
© Stack Overflow or respective owner