Boost logo

Boost Users :

From: Oleg Smolsky (oleg.smolsky_at_[hidden])
Date: 2005-10-25 17:10:31


Hello Thorsten,

Thorsten Ottosen wrote on 26/10/2005 at 4:04 a.m.:
>> I've just started looking at ptr_vector<> and got stuck on the
>> following issue:
>> std::map<std::string, boost::ptr_vector<Simple> > map;
>> map["key"].push_back(new Simple);
> The problem is that no pointer container is copyable.
> Do
> std::map<std::string, boost::shared_ptr< boost::ptr_vector<Simple> > > map;
Right, so, this is to ensure that the user understands that there is
an issue copying "a vector full of pointers". IE are the pointers
copied or are the objects they point to cloned? This kinda makes
sense.

> boost::ptr_map<std::string, boost::ptr_vector<Simple> > map;
So, I'm guessing the second parameter is stored by pointer in this
case? And the key is handled "by value", right?

Thanks,
Oleg.


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