Reputation: 3495
How can a this pointer be passed to a method that expects intrusive_ptr (such as the one from boost)? For shared_ptrs there is enable_shared_from_this
.
Upvotes: 0
Views: 273
Reputation: 54345
When using intrusive_ptr
the class itself is responsible for handling its reference counts. So passing a pointer to itself is easy!
All it has to do is increment its own reference counter and pass this
. Done.
Upvotes: 2