I think you are searching for the method release()
of shared_ptr
. Sorry - there is no such method by design.
Here I found a funny way to do what you want - https://stackoverflow.com/a/13701773/233885.
You should think about using shared_ptr
again in you context (ownership).