$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-users] shared_ptr usage
From: Hicham Mouline (hicham_at_[hidden])
Date: 2010-05-06 16:32:46
Hello,
I have a class that stores a private member a shared_ptr<T> that points to a
dynamically allocated instance of T.
A getter member function returns T&.
I now realise that in a snippet, I would like to store a new shared_ptr<T>
to that returned object.
T& t = myinstance.getT();
I would like to store t in a shared_ptr, ie increment the count of shared
pointers
Do I do:
shared_ptr<T> desiredPointer( &t );
will this increment the count of shared pointers to t?
Regards,