Boost logo

Boost Users :

Subject: Re: [Boost-users] BGL: How to get add_edge work with adjacency_list graph
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2011-09-26 10:11:11


On Mon, 26 Sep 2011, Christoph wrote:

> Dear List,
>
> i just started learning about The Boost Graph Library. Here is my
> Problem in a minimal example:
>
> #include <iostream>
> #include <boost/graph/adjacency_list.hpp>
> typedef boost::adjacency_list < boost::listS,
> boost::listS,
> boost::bidirectionalS>
> Map;
>
> int main()
> {
> Map map;
> std::cout << "number of vertices: "
> << num_vertices(map) << std::endl;
> Map::vertex_descriptor u = boost::add_vertex (map);;
> Map::vertex_descriptor v = boost::add_vertex (map);;
> std::cout << "number of vertices: "
> << num_vertices(map) << std::endl;
>
> Map::add_edge (u, v, map); // <- problem
> return 0;
> }
>
> The compiler tells me that ‘add_edge’ is not a member of ‘Map’. I would
> like to know why and what am i doing wrong by writing
> "Map::add_edge (u, v, map);"

The add_edge() function should be called unqualified; the compiler will
find the correct definition. In particular, it is not a member of any
class (static or non-static).

-- 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