Subject: Re: [Boost-bugs] [Boost C++ Libraries] #3078: Assert failure caused by property_map with BGL bundled properties if compiled in Debug mode in VS2008 SP1
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-05-25 21:33:25
#3078: Assert failure caused by property_map with BGL bundled properties if
compiled in Debug mode in VS2008 SP1
-------------------------------------------------------+--------------------
Reporter: Artyom Arabadji <sneg.vx_at_[hidden]> | Owner: dgregor
Type: Bugs | Status: closed
Milestone: | Component: property_map
Version: Boost 1.38.0 | Severity: Problem
Resolution: invalid | Keywords: bgl, property_map, vs2008
-------------------------------------------------------+--------------------
Changes (by jewillco):
* status: new => closed
* resolution: => invalid
Comment:
There are two issues with your code. The first one, that I think is
causing your problem, is that you define a copy constructor that is empty
and thus does not copy anything. Therefore, your graph and edge list are
not copied when your visitor is passed into depth_first_visit (which is
done by copy), leading to the edge list being empty and thus the iterator
in your property map being invalid. The second issue is that you are
storing the graph by copy in your visitor. This wastes memory, and also
(although this may not show up with your graph type) some graph types have
vertex descriptors that are tied to a particular graph. For example,
using vertices from one graph to access edges or properties in a copy of
that graph is invalid (and fails in subtle ways) for some instantiations
of adjacency_list. I actually noticed the copy constructor issue when I
went to store the graph by reference and the compiler complained about the
copy constructor.
You should fix your problem in two ways:
1. Change PathRecorder to store "const Graph&" rather than "const Graph".
2. Remove the copy constructor and let the compiler-generated one (which
works) be used, or add an explicit copy or reference of the edge data.
Note that you may not want to do the default deep copy of that data; you
might want to build the property map externally and only store it (and not
its underlying data) in your visitor since property maps are copied
shallowly.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/3078#comment:5> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:00 UTC