
Renaud Detry skrev:
Hi,
I have a question related to Boost.Graph bundle properties when there are two distinct vertex/edge types.
1b.- Instead of boost::shared_ptr, boost::ptr_array
could be used. The property instances are cloned when the ptr_array is copied. 2.- VertexProperties is a simple class that contains a type enum (VA or VB), and an index that identifies a data element in an external container. There would be two external containers, one containing VA data, the other for VB data.
The advantage of (1b) is automatic memory management -- when a vertex is deleted, its properties also die. With (2), properties have to be manually deleted when an vertex is removed. On the other hand, (2) is a bit more simple to serialize, since there's no dynamic allocation (i.e. not on the user side) and no polymorphism (no BOOST_CLASS_EXPORT_GUID...).
My questions are:
- In (1b), will boost::ptr_array
provide the expected behavior, i.e. that of a clone_ptr?
Depends on what the behavior of clone_ptr is. But, ptr_array