Opened 11 years ago

Closed 11 years ago

#6647 closed Bugs (fixed)

BGL strong_components do not compile on MSVC 8

Reported by: bbias@… Owned by: Jeremiah Willcock
Milestone: To Be Determined Component: graph
Version: Boost 1.49.0 Severity: Problem
Keywords: Cc:

Description

Since boost 1.49.0 the following code does not compile anymore on MSVC 8.

#include <boost/config.hpp>
#include <vector>
#include <boost/graph/strong_components.hpp>
#include <boost/graph/adjacency_list.hpp>

int main(int, char*[])
{
  using namespace boost;

  adjacency_list<> G;
    
  std::vector<int> component(num_vertices(G));
  int num = strong_components(G, &component[0]);
    
  return 0;
}

I get the following error:

c:\boost_1_49_0\boost\graph\strong_components.hpp(60) : error C2784: 'E boost::detail::get(boost::detail::underlying_edge_desc_map_type<E>,const boost::detail::reverse_graph_edge_descriptor<EdgeDesc> &)' : could not deduce template argument for 'boost::detail::underlying_edge_desc_map_type<E>' from 'int *'
1>        c:\boost_1_49_0\boost\graph\reverse_graph.hpp(437) : see declaration of 'boost::detail::get'
1>        c:\boost_1_49_0\boost\graph\depth_first_search.hpp(43) : see reference to function template instantiation 'void boost::detail::tarjan_scc_visitor<ComponentMap,RootMap,DiscoverTime,Stack>::finish_vertex<Graph>(unsigned int,const Graph &)' being compiled
1>        with
1>        [
1>            ComponentMap=int *,
1>            RootMap=boost::iterator_property_map<std::_Vector_iterator<Vertex,std::allocator<Vertex>>,boost::vec_adj_list_vertex_id_map<boost::no_property,unsigned int>,unsigned int,unsigned int &>,
1>            DiscoverTime=boost::iterator_property_map<std::_Vector_iterator<Vertex,std::allocator<Vertex>>,boost::vec_adj_list_vertex_id_map<boost::no_property,unsigned int>,unsigned int,unsigned int &>,
1>            Stack=std::stack<Vertex>,
1>            Graph=boost::adjacency_list<>
1>        ]
1>        c:\boost_1_49_0\boost\graph\depth_first_search.hpp(34) : while compiling class template member function 'void boost::DFSVisitorConcept<Visitor,Graph>::constraints(void)'
1>        with
1>        [
1>            Visitor=boost::detail::tarjan_scc_visitor<int *,boost::iterator_property_map<std::_Vector_iterator<Vertex,std::allocator<Vertex>>,boost::vec_adj_list_vertex_id_map<boost::no_property,unsigned int>,unsigned int,unsigned int &>,boost::iterator_property_map<std::_Vector_iterator<Vertex,std::allocator<Vertex>>,boost::vec_adj_list_vertex_id_map<boost::no_property,unsigned int>,unsigned int,unsigned int &>,std::stack<Vertex>>,
1>            Graph=boost::adjacency_list<>
1>        ]
1>        c:\boost_1_49_0\boost\concept\detail\has_constraints.hpp(42) : see reference to class template instantiation 'boost::DFSVisitorConcept<Visitor,Graph>' being compiled
1>        with
1>        [
1>            Visitor=boost::detail::tarjan_scc_visitor<int *,boost::iterator_property_map<std::_Vector_iterator<Vertex,std::allocator<Vertex>>,boost::vec_adj_list_vertex_id_map<boost::no_property,unsigned int>,unsigned int,unsigned int &>,boost::iterator_property_map<std::_Vector_iterator<Vertex,std::allocator<Vertex>>,boost::vec_adj_list_vertex_id_map<boost::no_property,unsigned int>,unsigned int,unsigned int &>,std::stack<Vertex>>,
1>            Graph=boost::adjacency_list<>
1>        ]
1>        c:\boost_1_49_0\boost\concept\detail\msvc.hpp(53) : see reference to class template instantiation 'boost::concepts::not_satisfied<Model>' being compiled
1>        with
1>        [
1>            Model=boost::DFSVisitorConcept<boost::detail::tarjan_scc_visitor<int *,boost::iterator_property_map<std::_Vector_iterator<Vertex,std::allocator<Vertex>>,boost::vec_adj_list_vertex_id_map<boost::no_property,unsigned int>,unsigned int,unsigned int &>,boost::iterator_property_map<std::_Vector_iterator<Vertex,std::allocator<Vertex>>,boost::vec_adj_list_vertex_id_map<boost::no_property,unsigned int>,unsigned int,unsigned int &>,std::stack<Vertex>>,boost::adjacency_list<>>
1>        ]
1>        c:\boost_1_49_0\boost\graph\depth_first_search.hpp(191) : see reference to class template instantiation 'boost::concepts::require<Model>' being compiled
1>        with
1>        [
1>            Model=boost::DFSVisitorConcept<boost::detail::tarjan_scc_visitor<int *,boost::iterator_property_map<std::_Vector_iterator<Vertex,std::allocator<Vertex>>,boost::vec_adj_list_vertex_id_map<boost::no_property,unsigned int>,unsigned int,unsigned int &>,boost::iterator_property_map<std::_Vector_iterator<Vertex,std::allocator<Vertex>>,boost::vec_adj_list_vertex_id_map<boost::no_property,unsigned int>,unsigned int,unsigned int &>,std::stack<Vertex>>,boost::adjacency_list<>>
1>        ]
1>        c:\boost_1_49_0\boost\graph\depth_first_search.hpp(303) : see reference to function template instantiation 'void boost::depth_first_search<VertexListGraph,const Arg,boost::shared_array_property_map<T,IndexMap>>(const VertexListGraph &,DFSVisitor,ColorMap,unsigned int)' being compiled
1>        with
1>        [
1>            VertexListGraph=boost::adjacency_list<>,
1>            Arg=const boost::detail::tarjan_scc_visitor<int *,boost::iterator_property_map<std::_Vector_iterator<Vertex,std::allocator<Vertex>>,boost::vec_adj_list_vertex_id_map<boost::no_property,unsigned int>,unsigned int,unsigned int &>,boost::iterator_property_map<std::_Vector_iterator<Vertex,std::allocator<Vertex>>,boost::vec_adj_list_vertex_id_map<boost::no_property,unsigned int>,unsigned int,unsigned int &>,std::stack<Vertex>>,
1>            T=boost::default_color_type,
1>            IndexMap=boost::vec_adj_list_vertex_id_map<boost::no_property,unsigned int>,
1>            DFSVisitor=const boost::detail::tarjan_scc_visitor<int *,boost::iterator_property_map<std::_Vector_iterator<Vertex,std::allocator<Vertex>>,boost::vec_adj_list_vertex_id_map<boost::no_property,unsigned int>,unsigned int,unsigned int &>,boost::iterator_property_map<std::_Vector_iterator<Vertex,std::allocator<Vertex>>,boost::vec_adj_list_vertex_id_map<boost::no_property,unsigned int>,unsigned int,unsigned int &>,std::stack<Vertex>>,
1>            ColorMap=boost::shared_array_property_map<boost::default_color_type,boost::vec_adj_list_vertex_id_map<boost::no_property,unsigned int>>
1>        ]
1>        c:\boost_1_49_0\boost\graph\strong_components.hpp(109) : see reference to function template instantiation 'void boost::depth_first_search<Graph,boost::detail::tarjan_scc_visitor<ComponentMap,RootMap,DiscoverTime,Stack>,boost::graph_visitor_t,boost::bgl_named_params<T,Tag>>(const VertexListGraph &,const boost::bgl_named_params<boost::detail::tarjan_scc_visitor<ComponentMap,RootMap,DiscoverTime,Stack>,boost::graph_visitor_t,Base> &)' being compiled
1>        with
1>        [
1>            Graph=boost::adjacency_list<>,
1>            ComponentMap=int *,
1>            RootMap=boost::iterator_property_map<std::_Vector_iterator<Vertex,std::allocator<Vertex>>,boost::vec_adj_list_vertex_id_map<boost::no_property,unsigned int>,unsigned int,unsigned int &>,
1>            DiscoverTime=boost::iterator_property_map<std::_Vector_iterator<Vertex,std::allocator<Vertex>>,boost::vec_adj_list_vertex_id_map<boost::no_property,unsigned int>,unsigned int,unsigned int &>,
1>            Stack=std::stack<Vertex>,
1>            T=int,
1>            Tag=int,
1>            VertexListGraph=boost::adjacency_list<>,
1>            Base=boost::bgl_named_params<int,int>
1>        ]
1>        c:\boost_1_49_0\boost\graph\strong_components.hpp(152) : see reference to function template instantiation 'int boost::detail::strong_components_impl<Graph,ComponentMap,RootMap,boost::iterator_property_map<RandomAccessIterator,IndexMap,T,R>,int,int,boost::no_property>(const Graph &,ComponentMap,RootMap,DiscoverTime,const boost::bgl_named_params<int,Tag> &)' being compiled
1>        with
1>        [
1>            Graph=boost::adjacency_list<>,
1>            ComponentMap=int *,
1>            RootMap=boost::iterator_property_map<std::_Vector_iterator<Vertex,std::allocator<Vertex>>,boost::vec_adj_list_vertex_id_map<boost::no_property,unsigned int>,unsigned int,unsigned int &>,
1>            RandomAccessIterator=std::_Vector_iterator<Vertex,std::allocator<Vertex>>,
1>            IndexMap=boost::vec_adj_list_vertex_id_map<boost::no_property,unsigned int>,
1>            T=unsigned int,
1>            R=unsigned int &,
1>            DiscoverTime=boost::iterator_property_map<std::_Vector_iterator<Vertex,std::allocator<Vertex>>,boost::vec_adj_list_vertex_id_map<boost::no_property,unsigned int>,unsigned int,unsigned int &>,
1>            Tag=int
1>        ]
1>        c:\boost_1_49_0\boost\graph\strong_components.hpp(165) : see reference to function template instantiation 'int boost::detail::strong_comp_dispatch2<boost::detail::error_property_not_found>::apply<Graph,ComponentMap,RootMap,int,int,boost::no_property>(const Graph &,ComponentMap,RootMap,const boost::bgl_named_params<T,Tag> &,boost::detail::error_property_not_found)' being compiled
1>        with
1>        [
1>            Graph=boost::adjacency_list<>,
1>            ComponentMap=int *,
1>            RootMap=boost::iterator_property_map<std::_Vector_iterator<Vertex,std::allocator<Vertex>>,boost::vec_adj_list_vertex_id_map<boost::no_property,unsigned int>,unsigned int,unsigned int &>,
1>            T=int,
1>            Tag=int
1>        ]
1>        c:\boost_1_49_0\boost\graph\strong_components.hpp(202) : see reference to function template instantiation 'int boost::detail::scc_helper2<Graph,ComponentMap,boost::iterator_property_map<RandomAccessIterator,IndexMap,T,R>,int,int,boost::no_property,boost::detail::error_property_not_found>(const Graph &,ComponentMap,RootMap,const boost::bgl_named_params<int,Tag> &,DiscoverTimeMap)' being compiled
1>        with
1>        [
1>            Graph=boost::adjacency_list<>,
1>            ComponentMap=int *,
1>            RandomAccessIterator=std::_Vector_iterator<Vertex,std::allocator<Vertex>>,
1>            IndexMap=boost::vec_adj_list_vertex_id_map<boost::no_property,unsigned int>,
1>            T=unsigned int,
1>            R=unsigned int &,
1>            RootMap=boost::iterator_property_map<std::_Vector_iterator<Vertex,std::allocator<Vertex>>,boost::vec_adj_list_vertex_id_map<boost::no_property,unsigned int>,unsigned int,unsigned int &>,
1>            Tag=int,
1>            DiscoverTimeMap=boost::detail::error_property_not_found
1>        ]
1>        c:\boost_1_49_0\boost\graph\strong_components.hpp(215) : see reference to function template instantiation 'int boost::detail::strong_comp_dispatch1<boost::detail::error_property_not_found>::apply<Graph,ComponentMap,int,int,boost::no_property>(const Graph &,ComponentMap,const boost::bgl_named_params<T,Tag> &,boost::detail::error_property_not_found)' being compiled
1>        with
1>        [
1>            Graph=boost::adjacency_list<>,
1>            ComponentMap=int *,
1>            T=int,
1>            Tag=int
1>        ]
1>        c:\boost_1_49_0\boost\graph\strong_components.hpp(230) : see reference to function template instantiation 'int boost::detail::scc_helper1<Graph,ComponentMap,boost::detail::error_property_not_found,int,int,boost::no_property>(const Graph &,ComponentMap,const boost::bgl_named_params<T,Tag> &,RootMap)' being compiled
1>        with
1>        [
1>            Graph=boost::adjacency_list<>,
1>            ComponentMap=int *,
1>            T=int,
1>            Tag=int,
1>            RootMap=boost::detail::error_property_not_found
1>        ]
1>        c:\boost_1_49_0\boost\graph\strong_components.hpp(241) : see reference to function template instantiation 'int boost::strong_components<Graph,ComponentMap,int,int,boost::no_property>(const Graph &,ComponentMap,const boost::bgl_named_params<T,Tag> &,boost::graph::detail::no_parameter)' being compiled
1>        with
1>        [
1>            Graph=boost::adjacency_list<>,
1>            ComponentMap=int *,
1>            T=int,
1>            Tag=int
1>        ]
1>        c:\boost_graph_test\test\test.cpp(13) : see reference to function template instantiation 'int boost::strong_components<boost::adjacency_list<>,int*>(const Graph &,ComponentMap,boost::graph::detail::no_parameter)' being compiled
1>        with
1>        [
1>            Graph=boost::adjacency_list<>,
1>            ComponentMap=int *
1>        ]

Change History (4)

comment:1 by Jeremiah Willcock, 11 years ago

This looks like a compiler bug; your test case works for me with GCC 4.6.2. I'm not sure there's much I can do about it since that get function should not be at all similar to the property map that the code is trying to access. Could you please try using iterator_property_map instead of passing a raw pointer as the component map?

comment:2 by anonymous, 11 years ago

i was you wondering about the fact that this code worked with boost 1.48 and VC8. passing an iterator_property_map fixed the problem. thank you for this advice. maybe it is a good idea to change the example code in graph/example/strong_components.cpp ?

comment:3 by anonymous, 11 years ago

The same issue is for Visual Studio 2010. Passing iterator_property_map fixed the problem as well

int num = strong_components(G, make_iterator_property_map(component.begin(), get(vertex_index, G), c[0]));

comment:4 by Jeremiah Willcock, 11 years ago

Resolution: fixed
Status: newclosed

(In [78022]) Fixed SCC example and added it to Jamfile; fixes #6647

Note: See TracTickets for help on using tickets.