Meryl Silverburgh wrote:
On 5/8/07, Nat Goodspeed
wrote: -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of Meryl Silverburgh Sent: Tuesday, May 08, 2007 10:41 AM To: boost-users@lists.boost.org Subject: Re: [Boost-users] Pointer in function parameter?
But what if I have
void aFunc(const A* aPtr) { // access aPtr }
should I change it to
void aFunc(const shared_ptr<A> aPtr) { // access aPtr }
[Nat] 'const A*' is "pointer to const A".
'const shared_ptr<A>' is "const shared_ptr to non-const A".
You probably want 'shared_ptr<const A>'.
Thanks for all the help. So is it safe to say I can replace all 'A*' in my program to shared_ptr<A>?
I don't need to worry about scoped_ptr or other smart pointers in boost?
Yes, you can. Make sure, you delete the delete(A)s! Manuel Jung