Boost logo

Boost Users :

From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2008-06-17 10:31:57


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<VirtualVertexProp,1> 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<VirtualVertexProp,1> provide the
> expected behavior, i.e. that of a clone_ptr?

Depends on what the behavior of clone_ptr is. But, ptr_array<T,1> is
cloned when the copy-constructor or assigment operator is called, if
that's what you're asking.

-Thorsten


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