Sure. Here's the gist:
typedef vector<...>::iterator vec_iter;
typedef graph_traits<Graph>::vertices_size_type size_type;
typedef property_map::const_type VertexID;
boost::iterator_property_map
dist_pmap(dist.begin(), get(vertex_index, g));
Also, in the BGL book there is an example of iterator property map on page
79-80.
And the web pages have a slighly different example:
http://www.boost.org/libs/property_map/iterator_property_map.html
Cheers,
Jeremy
On Thu, 21 Mar 2002, Wintermantel , Marc wrote:
marc.w> Hello Jeremy,
marc.w>
marc.w>
marc.w> Thank you for your quick answer. Unfortunately I'm not so experienced
marc.w> with these property maps. Could you give me a hint how to wrap this
marc.w> iterator_property_map around my vector::iterator?
marc.w>
marc.w>
marc.w>
marc.w> Yours truly,
marc.w>
marc.w>
marc.w>
marc.w> Marc Wintermantel
marc.w>
marc.w>
marc.w>
marc.w> -----Original Message-----
marc.w> From: Jeremy Siek [mailto:jsiek@cs.indiana.edu]
marc.w> Sent: Wednesday, March 20, 2002 2:40 PM
marc.w> To: Boost-Users@yahoogroups.com
marc.w> Subject: Re: [Boost-Users] BFS-visitor with gcc3.0.1
marc.w>
marc.w>
marc.w>
marc.w> Hi Marc,
marc.w>
marc.w> I think your problem is that BGL has get() and put() property map
marc.w> functions defined for pointers, but vector::iterator is not guaranteed
marc.w> to
marc.w> be a pointer.
marc.w>
marc.w> The fix is to wrap vector::iterator using the iterator_property_map
marc.w> class.
marc.w>
marc.w> Cheers,
marc.w> Jeremy
marc.w>
marc.w> On Wed, 20 Mar 2002, Wintermantel , Marc wrote:
marc.w>
marc.w> marc.w> Hello,
marc.w> marc.w>
marc.w> marc.w>
marc.w> marc.w>
marc.w> marc.w> I tried to complile the following code that worked under gcc
marc.w> 2.95.3
marc.w> marc.w> under gcc 3.0.1 and got tons of error messages:
marc.w> marc.w>
marc.w> marc.w>
marc.w> marc.w>
marc.w> marc.w> typedef adjacency_list<
marc.w> marc.w>
marc.w> marc.w> setS,
marc.w> marc.w>
marc.w> marc.w> vecS,
marc.w> marc.w>
marc.w> marc.w> undirectedS,
marc.w> marc.w>
marc.w> marc.w> property<
marc.w> marc.w>
marc.w> marc.w> vertex_color_t,
marc.w> marc.w>
marc.w> marc.w> default_color_type,
marc.w> marc.w>
marc.w> marc.w> property<
marc.w> marc.w>
marc.w> marc.w> vertex_degree_t,
marc.w> marc.w>
marc.w> marc.w> int,
marc.w> marc.w>
marc.w> marc.w> property<
marc.w> marc.w>
marc.w> marc.w> vertex_current_degree_t,
marc.w> marc.w>
marc.w> marc.w> int,
marc.w> marc.w>
marc.w> marc.w> property<
marc.w> marc.w>
marc.w> marc.w> vertex_priority_t,
marc.w> marc.w>
marc.w> marc.w> int > > > > > Graph;
marc.w> marc.w>
marc.w> marc.w>
marc.w> marc.w>
marc.w> marc.w> ...
marc.w> marc.w>
marc.w> marc.w>
marc.w> marc.w>
marc.w> marc.w> std::vector
marc.w> marc.w> dist(num_vertices(G), 0);
marc.w> marc.w>
marc.w> marc.w>
marc.w> marc.w>
marc.w> marc.w> breadth_first_search
marc.w> marc.w>
marc.w> marc.w> (G, e, visitor
marc.w> marc.w>
marc.w> marc.w> (
marc.w> marc.w>
marc.w> marc.w> make_bfs_visitor(record_distances(dist.begin(),
marc.w> marc.w> on_tree_edge() ) )
marc.w> marc.w>
marc.w> marc.w> )
marc.w> marc.w>
marc.w> marc.w> );
marc.w> marc.w>
marc.w> marc.w>
marc.w> marc.w>
marc.w> marc.w> ...
marc.w> marc.w>
marc.w> marc.w>
marc.w> marc.w>
marc.w> marc.w> The errors have something to deal with the visitors, more I
marc.w> could not
marc.w> marc.w> read out of the errors. When I use a simple array in the form
marc.w> int d[n]
marc.w> marc.w> it works.
marc.w> marc.w>
marc.w> marc.w>
marc.w> marc.w>
marc.w> marc.w> Yours truly,
marc.w> marc.w>
marc.w> marc.w>
marc.w> marc.w>
marc.w> marc.w> Marc Wintermantel
marc.w> marc.w>
marc.w> marc.w>
marc.w> marc.w>
marc.w> marc.w>
marc.w> marc.w>
marc.w> marc.w> Marc Wintermantel
marc.w> marc.w>
marc.w> marc.w> IMES - Structures Technology
marc.w> marc.w>
marc.w> marc.w> ETH Zurich, LEO C4
marc.w> marc.w>
marc.w> marc.w> Leonhardstrasse 27
marc.w> marc.w>
marc.w> marc.w> CH- 8092 Zurich
marc.w> marc.w>
marc.w> marc.w> Tel. ++41 1 633 35 32
marc.w> marc.w>
marc.w> marc.w> Fax. ++41 1 632 17 02
marc.w> marc.w>
marc.w> marc.w>
marc.w> marc.w>
marc.w> marc.w>
marc.w> marc.w>
marc.w> marc.w> [Non-text portions of this message have been removed]
marc.w> marc.w>
marc.w> marc.w>
marc.w> marc.w>
marc.w> marc.w>
marc.w> marc.w> Info: http://www.boost.org
marc.w> marc.w> Wiki:
marc.w> http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl
marc.w> marc.w> Unsubscribe: mailto:boost-users-unsubscribe@yahoogroups.com
marc.w> marc.w>
marc.w> marc.w>
marc.w> marc.w> Your use of Yahoo! Groups is subject to
marc.w> http://docs.yahoo.com/info/terms/
marc.w> marc.w>
marc.w> marc.w>
marc.w>
marc.w> ----------------------------------------------------------------------
marc.w> Jeremy Siek http://php.indiana.edu/~jsiek/
marc.w> Ph.D. Student, Indiana Univ. B'ton email: jsiek@osl.iu.edu
marc.w> C++ Booster (http://www.boost.org) office phone: (812) 855-3608
marc.w> ----------------------------------------------------------------------
----------------------------------------------------------------------
Jeremy Siek http://php.indiana.edu/~jsiek/
Ph.D. Student, Indiana Univ. B'ton email: jsiek@osl.iu.edu
C++ Booster (http://www.boost.org) office phone: (812) 855-3608
----------------------------------------------------------------------