Boost logo

Boost Users :

Subject: Re: [Boost-users] shared_ptr vs pass object by reference
From: Patrick Loney (patrick.loney_at_[hidden])
Date: 2010-07-28 09:33:21

> If I can pass the object by reference to a function, then is there a
> need to use shared pointers?

Not if you know the lifetime of your object and it won't be deleted before the function has finished. You may find scoped pointers useful though:

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at