Boost logo

Boost Users :

Subject: [Boost-users] revisiting casting a boost::shared_ptr to void*
From: Chris Cleeland (chris.cleeland_at_[hidden])
Date: 2014-07-28 23:22:17


I'm resurrecting this topic:

https://groups.google.com/forum/#!searchin/boost-list/shared_ptr$20void*/boost-list/QE_VCTen1YQ/styxqKB2wbQJ

because there is an unaddressed issue in it that I'm about to run into:

"... beware the pointee may be deleted if the last copy of the shared
pointer
goes out of scope, as the raw pointer won't have incremented the reference
count."

I cannot be the first person to run into this--a common issue when crossing
an API boundary. Has anyone come up with a good, safe solution wherein the
reference count gets properly incremented?

-- 
Chris Cleeland


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net