Subject: Re: [boost] std::map::find() wrapper
From: Rob Riggs (rob_at_[hidden])
Date: 2011-05-04 08:37:10
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.
boost::optional solves the problem without introducing bare pointers.
In fact, optional solves the problem specifically so we can avoid using
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk