|
Boost Users : |
Subject: Re: [Boost-users] for_each on boost::ptr_map
From: Robert Jones (robertgbjones_at_[hidden])
Date: 2008-09-16 10:29:15
On Tue, Sep 16, 2008 at 3:25 PM, Peter Barker <newbarker_at_[hidden]> wrote:
>> At risk of sounding a complete wally, I have completely failed to understand
>> why the second version is any way preferrable to the first.
>>
>> Why would you want to do this?
>>
>> - Rob.
>
> Are you asking why you would you use a boost::ptr_map over a std::map?
> I believe it's so the container takes ownership of the pointed to
> objects. http://www.boost.org/doc/libs/1_35_0/libs/ptr_container/doc/ptr_container.html#motivation
> contains this line:
>
> "For each of the standard containers there is a pointer container
> equivalent that takes ownership of the objects in an exception safe
> manner. In this respect the library is intended to solve the so-called
> polymorphic class problem."
>
> Regards,
>
> Pete
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
Ah I see,.... so the code for ptr_map is intended to be as much like
the code for
std::map as possible! Got it now, thanks.
- Rob.
-- ACCU - Professionalism in programming - http://www.accu.org
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