Boost logo

Boost Users :

Subject: Re: [Boost-users] [Graph] No known conversion from int to vertex_iterator
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2012-07-05 15:43:05


On Wed, 4 Jul 2012, Martin Magnusson wrote:

> I'm using BGL to store 3D triangle meshes, and I'm also using the ANN lib to
> find nearest neighbours of mesh points. My code used to work, using gcc 4.4
> and BGL 1.40 (in Ubuntu 10.04), but since upgrading to gcc 4.6 and BGL 1.48
> (in Ubuntu 12.04), my code doesn't compile anymore.
>
> I cut down my code to a minimal (I think) example that shows my problem. The
> attached code compiles with the old setup (I just get a warning that
> adjacency_list.hpp uses a deprecated header), but it does not compile in
> Ubuntu 12.04,
>
> The compilation error I get is "no matching function for call to
> 'Mesh::Vertex_Iterator::Vertex_Iterator(const Mesh* const, unsigned int&)'"
>
> The reason for that is that there is "no known conversion for argument 2 from
> 'unsigned int' to 'Mesh::Vertex_Graph_Iterator {aka
> boost::range_detail::integer_iterator<unsigned int>}'"
>
> Could anybody explain why, and what I can do to solve it? Is there any way to
> create a boost::adjacency_list::vertex_iterator using an int in the current
> version of BGL?

That constructor would not have been documented before, so it would not
work reliably. If you need an iterator to the nth vertex (zero-based),
use boost::next(vertices(g).first, n). If you just need the vertex
descriptor, use vertex(n, g).

-- Jeremiah Willcock


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