Boost logo

Boost Users :

From: Dmitry Bufistov (dmitry_at_[hidden])
Date: 2006-04-20 15:56:59


Fred Labrosse wrote:
> All,
>
> I have:
>
> typedef boost::adjacency_list<boost::listS, boost::listS,
> boost::undirectedS, place, link> mapType;
>
> place* newPlace = new place("here-and-there");
> mapType::vertex_descriptor newPlaceDesc = add_vertex(*newPlace, theMap);
>
> where the destructor of place is:
>
> place::~place()
> {
> // Just to make sure...
> std::cout << "Deleting place " << name << std::endl;
> // ...
> }
>
> When I run that, I do get:
>
> Deleting place here-and-there
>
> just after adding the vertex. In other words, a property is being deleted,
> probably a copy of the one I gave. I even tried (to make it explicitly like
> the documentation says):
>
> mapType::vertex_descriptor newPlaceDesc =
> add_vertex(static_cast<const place&>(*newPlace), theMap);
>
> and the same happens.
>
> Is that suppose to happen?
>
> Cheers,
>
> Fred
Hola Fred,
I'm pretty sure that add_vertex() takes a copy of property class and
believe that it is by design. There is the assumption that your property
class is "easy" for copy.
Pleas correct me if I'm wrong.
--dima


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