|
Boost Users : |
From: Naomi Fox (fox_at_[hidden])
Date: 2007-03-21 19:15:01
I am trying to use an adjacency list with bundled properties and running
into lots of problems. I'm wondering if bundled properties is mature
enough, or if I should resort to the older style using property maps.
Here's a description of one problem I've run into:
So I define my graph class with bundled properties as so:
struct MyV {
int numStars;
};
struct MyE {
int numStars;
};
typedef adjacency_list<setS, setS, bidirectionalS, MyV, MyE> MyGraph;
I would like to perform dfs on this graph.
So I have a very simple visitor defined:
struct star_visitor : public boost::default_dfs_visitor
{
template <class Vertex, class Graph> void
start_vertex(Vertex v, const Graph &)
{
std::cout << 'start';
}
template <class Vertex, class Graph> void
discover_vertex(Vertex v, const Graph &)
{
std::cout << "*";
}
template <class Vertex, class Graph> void
finish_vertex(Vertex v, const Graph &)
{
std::cout << 'finish';
}
};
Then in my main function, I make a MyGraph object and put in vertices
and edges, and assign property values. That works fine.
MyGraph g;
MyGraph::vertex_descriptor v1 = addVertex(g);
MyGraph::vertex_descriptor v2 = addVertex(g);
MyGraph::edge_descriptor e2 = addEdge(v1, v2, g);
g[*v1].numStars = 100;
g[*v2].numStars = 2;
g[*e1].numStars = 7;
Then I perform dfs on my graph
depth_first_search(g, visitor(star_vis));
And I get the following errors. I don't get these errors and my program
compiles fine if I do a dfs with my star_visitor on a graph with no
properties.
Main.cpp
c:\boost_1_33_1\boost\property_map.hpp(349) : error C2679: binary
'+' : no operator found which takes a right-hand operand of type
'const boost::detail::error_property_not_found' (or there is no
acceptable conversion)
c:\program files\microsoft visual studio
8\vc\include\vector(366): could be
'std::_Vector_iterator<_Ty,_Alloc>
std::_Vector_iterator<_Ty,_Alloc>::operator +(__w64 int) const'
with
[
_Ty=boost::default_color_type,
_Alloc=std::allocator
]
while trying to match the argument list '(const
std::_Vector_iterator<_Ty,_Alloc>, const
boost::detail::error_property_not_found)'
with
[
_Ty=boost::default_color_type,
_Alloc=std::allocator
]
c:\boost_1_33_1\boost\property_map.hpp(349) : while
compiling class template member function 'boost::default_color_type
boost::iterator_property_map::operator [](void *) const'
with
[
RandomAccessIterator=std::_Vector_iterator>,
IndexMap=boost::adj_list_vertex_property_map,
T=boost::default_color_type,
R=boost::default_color_type &
]
c:\documents and
settings\istreinu\desktop\naomi\boost_1_33_1\boost\graph\depth_first_search.hpp(250)
: see reference to class template instantiation
'boost::iterator_property_map' being compiled
with
[
RandomAccessIterator=std::_Vector_iterator>,
IndexMap=boost::adj_list_vertex_property_map,
T=boost::default_color_type,
R=boost::default_color_type &
]
c:\documents and
settings\istreinu\desktop\naomi\boost_1_33_1\boost\graph\depth_first_search.hpp(332)
: see reference to function template instantiation 'void
boost::detail::dfs_dispatch::apply(const VertexListGraph
&,DFSVisitor,Vertex,const boost::bgl_named_params
&,boost::detail::error_property_not_found)' being compiled
with
[
VertexListGraph=MyGraph,
DFSVisitor=Star_visitor,
Vertex=void *,
T=Star_visitor,
Tag=boost::graph_visitor_t,
Base=boost::no_property
]
c:\documents and settings\istreinu\my documents\visual
studio 2005\projects\refactorfirst\refactorfirst\main.cpp(228) : see
reference to function template instantiation 'void
boost::depth_first_search(const VertexListGraph &,const
boost::bgl_named_params &)' being compiled
with
[
VertexListGraph=MyGraph,
T=Star_visitor,
Tag=boost::graph_visitor_t,
Base=boost::no_property
]
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