Boost logo

Boost Users :

Subject: Re: [Boost-users] [Graph] undefined trait functions
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2013-05-03 17:21:04


On Fri, 3 May 2013, Miklós Tóth wrote:

> Hi!
>
> I've a problem, with Boost Graph Library and gcc 4.7.
> I have a legacy graph representation that i like to wrap with a graph adaptor to access boost graph algorythms.
>
> 1: I've created a graph adaptor, that contains my legacy graph. This is a simple struct:
>
> struct legacy_graph_adaptor {
>     legacy_graph_adaptor(const legacy_graph& g)
>         : graph(const_cast<legacy_graph&>(g)) { }
>     legacy_graph& graph;
> };
>
> 2: Next step was a vertex_iterator and an edge_itreator, where I redefined the equal, dereference, increment, etc members. (If it's not necessary i'm not
> going to copy the code here.)
>
> 3: Created traits for adapted graph. I've redefined source, target, out_edge, etc.
> template <>
>
> struct graph_traits<legacy_graph_adaptor> : public detail::traits_base {
>     struct out_edge_iterator :
>         public detail::traits_base::edge_iter_base<out_edge_iterator>
>     {
>         typedef detail::traits_base::edge_iter_base<out_edge_iterator> Base;
>
>         out_edge_iterator(int legacy_vertex = 0, int* base_to = 0,
>             const legacy_graph* g = 0) : Base(legacy_vertex, base_to, g) { }
>     private:
>         void increment() {
>             advance();
>         }
>         friend class iterator_core_access;
>     };
> };
>
> Originally it was created as a part of a msvc project. Now I try to port it to gcc, and i got the next message (for example):
>   
>     <path_to>\boost\boost_1_53_0\boost\graph\graph_concepts.hpp:94: error: 'out_edges' was not declared in this scope, and no declarations were found by
> argument-dependent lookup at the point of instantiation [-fpermissive]
>
> When I change to gcc 4.6 it compiles well.
> So my question is: Is this a known bug or I missing something?
> Thanks for the help.

I can't tell from the code snippet. Could you please try including
<boost/graph/adjacency_list.hpp> before any other Boost.Graph files and
see if that changes anything? If so, that is probably a bug in
Boost.Graph; if not, we will need to look more at how your declarations of
functions are ordered relative to their uses.

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