Boost logo

Boost Users :

From: Manuel Jung (gzahl_at_[hidden])
Date: 2007-05-08 11:40:03


Meryl Silverburgh wrote:

> On 5/8/07, Nat Goodspeed <ngoodspeed_at_[hidden]> wrote:
>> > -----Original Message-----
>> > From: boost-users-bounces_at_[hidden] [mailto:boost-users-
>> > bounces_at_[hidden]] On Behalf Of Meryl Silverburgh
>> > Sent: Tuesday, May 08, 2007 10:41 AM
>> > To: boost-users_at_[hidden]
>> > 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


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