Boost logo

Boost Users :

From: gavinband_at_[hidden]
Date: 2007-02-18 06:08:09


Dear all,
I have boost 1.33.0. It looks to me like boost::dynamic_properties (in
dynamic_property_map.hpp) does not have a supplied copy-constructor, and
so it has a default copy-constructor. However, since dynamic_properties
allocates dynamic_property_map objects on the heap, and holds them by
pointer, this is not sufficient. This is causing a segfault in the code
pasted below.

Either dynamic_properties should be given a copy constructor and
assignment operator (which seems useful to me) or it should be
noncopyable. Or perhaps it could use shared_ptrs instead of regular
pointers to avoid this problem?

Thanks,
Gavin.

#include <boost/dynamic_property_map.hpp>

int main()
{
  std::map<long,long> my_map;
  boost::associative_property_map<std::map<long,long> > apm(my_map);
  boost::dynamic_properties dp;
  dp.property("property",apm);
  boost::dynamic_properties dp2(dp);
  // crash occurs when dp is destructed.
  return 0;
}

___________________________________________________________

Tiscali Broadband only 9.99 a month for your first 3 months!
http://www.tiscali.co.uk/products/broadband/


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