
8 May
2007
8 May
'07
1:39 p.m.
-----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 9:32 AM To: boost-users@lists.boost.org Subject: [Boost-users] Pointer in function parameter?
vector< boost::shared_ptr<A> > aVector;
aFunc(aVector[0]) ; // just call a
My question is should I change the function parameter of aFuncion from this:
void aFunc(A* aPtr) { // access aPtr }
to this:
void aFunc(shared_ptr<A> aPtr) { // access aPtr }
[Nat] Looks reasonable to me... I believe the docs say that it's conventional to pass shared_ptr by value rather than (e.g.) const reference so that the ref count will be adjusted properly.