Subject: Re: [boost] std::map::find() wrapper
From: Olaf van der Spek (ml_at_[hidden])
Date: 2011-05-04 08:49:53
On Wed, May 4, 2011 at 2:37 PM, Rob Riggs <rob_at_[hidden]> wrote:
> On 05/04/2011 04:33 AM, Olaf van der Spek wrote:
>>> It's also a special case, which is best avoided if possible, that doesn't
>>> > seem to offer
>>> > any real benefit.
>> Containers of pointers occur quite frequently. There's even a Ptr
>> Container lib.
> Those containers manage the lifetimes of heap allocated objects just as
> smart pointers manage the lifetimes of theirs.
> One of the hallmarks of modern C++ programming is the absence of bare
> pointers. We have iterators, smart pointers and pointer containers to
> manage and hide pointers for us. We have a healthy distrust of bare
> pointers because they are so easily misused.
I'm not sure what your code looks like, but IMO bare pointers are
perfectly fine in certain situations.
Like this one, where no ownership issues are present.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk