VC++ compiler error with boost graph library

Hi, I tried to do a depth_first_search with the following graph type and visitor: struct CycleDetector : public boost::default_dfs_visitor { CycleDetector( bool& cycle ) : m_hasCycle(cycle) {}; void back_edge( T_Edge, const T_Graph& ) { m_hasCycle = true; } bool& m_hasCycle; }; typedef boost::adjacency_list< boost::setS, boost::listS, boost::bidirectionalS> T_Graph; bool hasCycle(false); CycleDetector cd(hasCycle); boost::depth_first_search(m_graph, visitor(cd)); Compiling this on VC++ 7.1.3 (.NET Framework 1.1) results in the following error message: \boost\boost\property_map.hpp(349): error C2678: binary '+' : no operator found which takes a left-hand operand of type 'const std::vector<_Ty>::iterator' (or there is no acceptable conversion) with [ _Ty=boost::default_color_type ] ---------------------- Changing the graph type definition to: typedef boost::adjacency_list< boost::setS, boost::vecS, boost::bidirectionalS> T_Graph; (i.e. replacing the listS by vecS) works perfectly. Is this a known restriction of the library ? Best regards Alex ___________________________________________________________ Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de

Hello, I'm experiencing the same behavior with following graph: typedef boost::adjacency_list<setS, setS, directedS, ...> graph_t; and then boost::depth_first_search would not take following visitor: template<GraphT> struct cycle_detector { // ... template <typename EdgeT, typename GraphT> void back_edge(EdgeT E, GraphT& G) { /*...*/} }; replacing VertexList param with vecS fixes the compilation error. Could anyone confirm that is a known issue or otherwise what we're doing wrong? --Alex On 9/3/05, Chris Alvers <cab322@yahoo.de> wrote:
Hi,
I tried to do a depth_first_search with the following graph type and visitor:
struct CycleDetector : public boost::default_dfs_visitor {
CycleDetector( bool& cycle ) : m_hasCycle(cycle) {}; void back_edge( T_Edge, const T_Graph& ) { m_hasCycle = true; } bool& m_hasCycle; };
typedef boost::adjacency_list< boost::setS, boost::listS, boost::bidirectionalS> T_Graph;
bool hasCycle(false); CycleDetector cd(hasCycle); boost::depth_first_search(m_graph, visitor(cd));
Compiling this on VC++ 7.1.3 (.NET Framework 1.1) results in the following error message:
\boost\boost\property_map.hpp(349): error C2678: binary '+' : no operator found which takes a left-hand operand of type 'const std::vector<_Ty>::iterator' (or there is no acceptable conversion) with [ _Ty=boost::default_color_type ]
----------------------
Changing the graph type definition to:
typedef boost::adjacency_list< boost::setS, boost::vecS, boost::bidirectionalS> T_Graph;
(i.e. replacing the listS by vecS) works perfectly.
Is this a known restriction of the library ?
Best regards
Alex
___________________________________________________________ Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

On 11/18/05, Alexander Ivanov <amivanov@gmail.com> wrote:
Hello,
I'm experiencing the same behavior with following graph:
typedef boost::adjacency_list<setS, setS, directedS, ...> graph_t; and then boost::depth_first_search would not take following visitor:
template<GraphT> struct cycle_detector { // ... template <typename EdgeT, typename GraphT> void back_edge(EdgeT E, GraphT& G) { /*...*/} };
replacing VertexList param with vecS fixes the compilation error. Could anyone confirm that is a known issue or otherwise what we're doing wrong?
--Alex
<snip> This isn't a bug - if you use the default color map in depth_first_search, you must also supply a vertex index map (property map that maps vertices into the range 0..num_vertices(g) - 1.) If you use a std::vector for your vertex list, the vertex index map is supplied for you. Otherwise, you'll have to create your own. See the BGL FAQ, #5 (http://tinyurl.com/9skck) for more on how to do this. Aaron
participants (3)
-
Aaron Windsor
-
Alexander Ivanov
-
Chris Alvers