Boost logo

Boost Users :

From: Lars Monecke (lars_at_[hidden])
Date: 2006-07-11 08:07:45


Hi,

i have reduced my problem to the following lines. I want to install a own
edge property to a graph. The property as a template argument with then
name "source". Here is my try:

---> code starts here <---
#include <boost/graph/adjacency_list.hpp>

namespace Foo {

  class source
  {
  };

}

namespace Bar {
  template <class Source>
  class Edge
  {
  };
}

typedef Bar::Edge<Foo::source> tMyEdge;

struct edge_impl_t {
  typedef boost::edge_property_tag kind;
};

typedef boost::property <edge_impl_t, tMyEdge> edge_property_t;

typedef boost::adjacency_list < boost::listS,
                                boost::vecS,
                                boost::undirectedS,
                                boost::no_property,
                                edge_property_t> tGraph;

int main(int /* argc */, char* /* argv[] */)
{
  tGraph stGraph1;
  tGraph stGraph2;

  stGraph1 = stGraph2;
}
----> code ends here <---

When compiling the above code with gcc 4.1.1, i get these errors:

main.cpp: In member function 'void boost::vec_adj_list_impl<Graph, Config,
Base>::copy_impl(const boost::vec_adj_list_impl<Graph, Config, Base>&)
[with Graph = boost::adjacency_list<boost::listS, boost::vecS,
boost::undirectedS, boost::no_property, boost::property<edge_impl_t,
Bar::Edge<Foo::source>, boost::no_property>, boost::no_property,
boost::listS>, Config =
boost::detail::adj_list_gen<boost::adjacency_list<boost::listS,
boost::vecS, boost::undirectedS, boost::no_property,
boost::property<edge_impl_t, Bar::Edge<Foo::source>, boost::no_property>,
boost::no_property, boost::listS>, boost::vecS, boost::listS,
boost::undirectedS, boost::no_property, boost::property<edge_impl_t,
Bar::Edge<Foo::source>, boost::no_property>, boost::no_property,
boost::listS>::config, Base =
boost::undirected_graph_helper<boost::detail::adj_list_gen<boost::adjacency_list<boost::listS,
boost::vecS, boost::undirectedS, boost::no_property,
boost::property<edge_impl_t, Bar::Edge<Foo::source>, boost::no_property>,
boost::no_property, boost::listS>, boost::vecS, boost::listS,
boost::undirectedS, boost::no_property, boost::property<edge_impl_t,
Bar::Edge<Foo::source>, boost::no_property>, boost::no_property,
boost::listS>::config>]':
/usr/local/gcc-4.1.1/boost-1.33.1/boost/graph/detail/adjacency_list.hpp:1990:
instantiated from 'boost::vec_adj_list_impl<Graph, Config, Base>&
boost::vec_adj_list_impl<Graph, Config, Base>::operator=(const
boost::vec_adj_list_impl<Graph, Config, Base>&) [with Graph =
boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS,
boost::no_property, boost::property<edge_impl_t, Bar::Edge<Foo::source>,
boost::no_property>, boost::no_property, boost::listS>, Config =
boost::detail::adj_list_gen<boost::adjacency_list<boost::listS,
boost::vecS, boost::undirectedS, boost::no_property,
boost::property<edge_impl_t, Bar::Edge<Foo::source>, boost::no_property>,
boost::no_property, boost::listS>, boost::vecS, boost::listS,
boost::undirectedS, boost::no_property, boost::property<edge_impl_t,
Bar::Edge<Foo::source>, boost::no_property>, boost::no_property,
boost::listS>::config, Base =
boost::undirected_graph_helper<boost::detail::adj_list_gen<boost::adjacency_list<boost::listS,
boost::vecS, boost::undirectedS, boost::no_property,
boost::property<edge_impl_t, Bar::Edge<Foo::source>, boost::no_property>,
boost::no_property, boost::listS>, boost::vecS, boost::listS,
boost::undirectedS, boost::no_property, boost::property<edge_impl_t,
Bar::Edge<Foo::source>, boost::no_property>, boost::no_property,
boost::listS>::config>]'
/usr/local/gcc-4.1.1/boost-1.33.1/boost/graph/adjacency_list.hpp:373:
instantiated from 'boost::adjacency_list<OutEdgeListS, VertexListS,
DirectedS, VertexProperty, EdgeProperty, GraphProperty, EdgeListS>&
boost::adjacency_list<OutEdgeListS, VertexListS, DirectedS, VertexProperty,
EdgeProperty, GraphProperty, EdgeListS>::operator=(const
boost::adjacency_list<OutEdgeListS, VertexListS, DirectedS, VertexProperty,
EdgeProperty, GraphProperty, EdgeListS>&) [with OutEdgeListS =
boost::listS, VertexListS = boost::vecS, DirectedS = boost::undirectedS,
VertexProperty = boost::no_property, EdgeProperty =
boost::property<edge_impl_t, Bar::Edge<Foo::source>, boost::no_property>,
GraphProperty = boost::no_property, EdgeListS = boost::listS]'
main.cpp:42: instantiated from here
main.cpp:7: error: 'class Foo::source' is not a function,
/usr/local/gcc-4.1.1/boost-1.33.1/boost/graph/adjacency_list.hpp:464: error:
conflict with 'template<class Directed, class Vertex, class OutEdgeListS,
class VertexListS, class DirectedS, class VertexProperty, class
EdgeProperty, class GraphProperty, class EdgeListS> Vertex
boost::source(const boost::detail::edge_base<Directed, Vertex>&, const
boost::adjacency_list<OutEdgeListS, VertexListS, DirectedS, VertexProperty,
EdgeProperty, GraphProperty, EdgeListS>&)'
/usr/local/gcc-4.1.1/boost-1.33.1/boost/graph/detail/adjacency_list.hpp:2051:
error: in call to 'source'

I know the easiest way is to rename Foo::source but this class came from
another library. Is there a chance to use this class anyway?

Thanks in advance,

Lars


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