Boost logo

Boost Users :

From: Michael W Daniels (daniels_at_[hidden])
Date: 2004-08-16 17:32:54


boost 1.31.0, msvc 7.1

I'm trying to understand how to use the BGL and the strong_components
algorithm in particular. From the example in the documentation, it seems
like this minimal file should compile:

==test.cpp==
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/strong_components.hpp>
#include <string>

using namespace std;
using namespace boost;

typedef adjacency_list<setS, setS, bidirectionalS, property<vertex_name_t,
string> > Graph;

int testcomps() {
   Graph gramgraph;
   vector<int> component(num_vertices(gramgraph));
   return strong_components(gramgraph, &component[0]);
}
==end==

Instead, I get the error below. It seems as though it doesn't like the
component map type, but I don't know what I should use instead.

Any help anyone could provide would be appreciated.

==error==
Compiling...
test.cpp
e:\boost-msvc\include\boost-1_31\boost\property_map.hpp(159) : error C2664:
'const T &get<std::allocator<_Ty>::value_type>(const T *,ptrdiff_t)' :
cannot convert parameter 2 from 'Vertex ' to 'ptrdiff_t'
         with
         [
             T=std::allocator<int>::value_type,
             _Ty=int
         ]
         This conversion requires a reinterpret_cast, a C-style cast or
function-style cast
         e:\boost-msvc\include\boost-1_31\boost\property_map.hpp(156) :
while compiling class-template member function 'void
boost::ReadablePropertyMapConcept<PMap,Key>::constraints(void)'
         with
         [
             PMap=int *__w64 ,
             Key=Vertex
         ]
         e:\boost-msvc\include\boost-1_31\boost\concept_check.hpp(49) : see
reference to class template instantiation
'boost::ReadablePropertyMapConcept<PMap,Key>' being compiled
         with
         [
             PMap=int *__w64 ,
             Key=Vertex
         ]
         e:\boost-msvc\include\boost-1_31\boost\property_map.hpp(215) : see
reference to function template instantiation 'void
boost::function_requires<boost::ReadablePropertyMapConcept<PMap,Key>>(boost::mpl::identity<T>
*)' being compiled
         with
         [
             PMap=int *__w64 ,
             Key=Vertex ,
             T=boost::ReadablePropertyMapConcept<int *__w64 ,Vertex >
         ]
         e:\boost-msvc\include\boost-1_31\boost\property_map.hpp(214) :
while compiling class-template member function 'void
boost::ReadWritePropertyMapConcept<PMap,Key>::constraints(void)'
         with
         [
             PMap=int *__w64 ,
             Key=Vertex
         ]
         e:\boost-msvc\include\boost-1_31\boost\concept_check.hpp(49) : see
reference to class template instantiation
'boost::ReadWritePropertyMapConcept<PMap,Key>' being compiled
         with
         [
             PMap=int *__w64 ,
             Key=Vertex
         ]
         e:\boost-msvc\include\boost-1_31\boost\graph\strong_components.hpp(111)
: see reference to function template instantiation 'void
boost::function_requires<boost::ReadWritePropertyMapConcept<PMap,Key>>(boost::mpl::identity<T>
*)' being compiled
         with
         [
             PMap=int *__w64 ,
             Key=Vertex,
             T=boost::ReadWritePropertyMapConcept<int *__w64 ,Vertex>
         ]
         e:\boost-msvc\include\boost-1_31\boost\graph\strong_components.hpp(166)
: see reference to function template instantiation
'boost::property_traits<PA>::value_type
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
         with
         [
             PA=std::allocator<int>::value_type *__w64 ,
             Graph=Graph,
             ComponentMap=std::allocator<int>::value_type *__w64 ,
             RootMap=boost::iterator_property_map<std::vector<Vertex>::iterator,boost::detail::choose_pmap_helper<boost::property_value<boost::bgl_named_params<int,int>,boost::vertex_index_t>::type,Graph,boost::vertex_index_t>::const_result_type,std::allocator<boost::detail::adj_list_gen<boost::adjacency_list<boost::setS,boost::setS,boost::bidirectionalS,boost::property<boost::vertex_name_t,std::string>>,boost::setS,boost::setS,boost::bidirectionalS,boost::property<boost::vertex_name_t,std::string>,boost::no_property,boost::no_property,boost::listS>::config::vertex_ptr
RootMap=boost::iterator_property_map<std::vector<Vertex>::iterator,boost::detail::choose_pmap_helper<boost::property_value<boost::bgl_named_params<int,int>,boost::vertex_index_t>::type,Graph,boost::vertex_index_t>::const_result_type,std::allocator<boost::detail::adj_list_gen<boost::adjacency_list<boost::setS,boost::setS,boost::bidirectionalS,boost::property<boost::vertex_name_t,std::string>>,boost::setS,boost::setS,boost::bidirectionalS,boost::property<boost::vertex_name_t,std::string>,boost::no_property,boost::no_property,boost::listS>::config::vertex_ptr
>::value_type,std::allocator<boost::detail::adj_list_gen<boost::adjacency_list<boost::setS,boost::setS,boost::bidirectionalS,boost::property<boost::vertex_name_t,std::string>>,boost::setS,boost::setS,boost::bidirectionalS,boost::property<boost::vertex_name_t,std::string>,boost::no_property,boost::no_property,boost::listS>::config::vertex_ptr
>::value_type & >,
             RandomAccessIterator=std::vector<size_type>::iterator,
             IndexMap=boost::detail::choose_pmap_helper<boost::property_value<boost::bgl_named_params<int,int>,boost::vertex_index_t>::type,Graph,boost::vertex_index_t>::const_result_type,
             T=std::allocator<size_type>::value_type,
             R=std::allocator<size_type>::value_type &,
             DiscoverTime=boost::iterator_property_map<std::vector<size_type>::iterator,boost::detail::choose_pmap_helper<boost::property_value<
boost::bgl_named_params<int,int>,boost::vertex_index_t>::type,Graph,boost::vertex_index_t>::const_result_type,std::allocator<size_type>::value_type,std::allocator<size_type>::value_type
&>,
             Tag=int
         ]
         e:\boost-msvc\include\boost-1_31\boost\graph\strong_components.hpp(179)
: see reference to function template instantiation
'boost::property_traits<PA>::value_type
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
         with
         [
             PA=std::allocator<int>::value_type *__w64 ,
             Graph=Graph,
             ComponentMap=std::allocator<int>::value_type *__w64 ,
             RootMap=boost::iterator_property_map<std::vector<Vertex>::iterator,boost::detail::choose_pmap_helper<boost::property_value<boost::bgl_named_params<int,int>,boost::vertex_index_t>::type,Graph,boost::vertex_index_t>::const_result_type,std::allocator<boost::detail::adj_list_gen<boost::adjacency_list<boost::setS,boost::setS,boost::bidirectionalS,boost::property<boost::vertex_name_t,std::string>>,boost::setS,boost::setS,boost::bidirectionalS,boost::property<boost::vertex_name_t,std::string>,boost::no_property,boost::no_property,boost::listS>::config::vertex_ptr
RootMap=boost::iterator_property_map<std::vector<Vertex>::iterator,boost::detail::choose_pmap_helper<boost::property_value<boost::bgl_named_params<int,int>,boost::vertex_index_t>::type,Graph,boost::vertex_index_t>::const_result_type,std::allocator<boost::detail::adj_list_gen<boost::adjacency_list<boost::setS,boost::setS,boost::bidirectionalS,boost::property<boost::vertex_name_t,std::string>>,boost::setS,boost::setS,boost::bidirectionalS,boost::property<boost::vertex_name_t,std::string>,boost::no_property,boost::no_property,boost::listS>::config::vertex_ptr
>::value_type,std::allocator<boost::detail::adj_list_gen<boost::adjacency_list<boost::setS,boost::setS,boost::bidirectionalS,boost::property<boost::vertex_name_t,std::string>>,boost::setS,boost::setS,boost::bidirectionalS,boost::property<boost::vertex_name_t,std::string>,boost::no_property,boost::no_property,boost::listS>::config::vertex_ptr
>::value_type & >,
             T=int,
             Tag=int
         ]
         e:\boost-msvc\include\boost-1_31\boost\graph\strong_components.hpp(216)
: see reference to function template instantiation
'boost::property_traits<PA>::value_type
boost::detail::scc_helper2<Graph,ComponentMap,boost::iterator_property_map<RandomAccessIterator,IndexMap,T,R>,int,int,boost::no_property,boost::property_value<PropertyList,Tag>::type>(const
Graph &,ComponentMap,RootMap,const boost::bgl_named_params<int,int>
&,DiscoverTimeMap)' being compiled
         with
         [
             PA=std::allocator<int>::value_type *__w64 ,
             Graph=Graph,
             ComponentMap=std::allocator<int>::value_type *__w64 ,
             RandomAccessIterator=std::vector<Vertex>::iterator,
             IndexMap=boost::detail::choose_pmap_helper<boost::property_value<boost::bgl_named_params<int,int>,boost::vertex_index_t>::type,Graph,boost::vertex_index_t>::const_result_type,
             T=std::allocator<boost::detail::adj_list_gen<boost::adjacency_list<boost::setS,boost::setS,boost::bidirectionalS,boost::property<boost::vertex_name_t,std::string>>,boost::setS,boost::setS,boost::bidirectionalS,boost::property<boost::vertex_name_t,std::string>,boost::no_property,boost::no_property,boost::listS>::config::vertex_ptr
T=std::allocator<boost::detail::adj_list_gen<boost::adjacency_list<boost::setS,boost::setS,boost::bidirectionalS,boost::property<boost::vertex_name_t,std::string>>,boost::setS,boost::setS,boost::bidirectionalS,boost::property<boost::vertex_name_t,std::string>,boost::no_property,boost::no_property,boost::listS>::config::vertex_ptr
>::value_type,
             R=std::allocator<boost::detail::adj_list_gen<boost::adjacency_list<boost::setS,boost::setS,boost::bidirectionalS,boost::property<boost::vertex_name_t,std::string>>,boost::setS,boost::setS,boost::bidirectionalS,boost::property<boost::vertex_name_t,std::string>,boost::no_property,boost::no_property,boost::listS>::config::vertex_ptr
R=std::allocator<boost::detail::adj_list_gen<boost::adjacency_list<boost::setS,boost::setS,boost::bidirectionalS,boost::property<boost::vertex_name_t,std::string>>,boost::setS,boost::setS,boost::bidirectionalS,boost::property<boost::vertex_name_t,std::string>,boost::no_property,boost::no_property,boost::listS>::config::vertex_ptr
>::value_type & ,
             PropertyList=boost::bgl_named_params<int,int>,
             Tag=boost::vertex_discover_time_t,
             RootMap=boost::iterator_property_map<std::vector<Vertex>::iterator,boost::detail::choose_pmap_helper<boost::property_value<boost::bgl_named_params<int,int>,boost::vertex_index_t>::type,Graph,boost::vertex_index_t>::const_result_type,std::allocator<boost::detail::adj_list_gen<boost::adjacency_list<boost::setS,boost::setS,b
oost::bidirectionalS,boost::property<boost::vertex_name_t,std::string>>,boost::setS,boost::setS,boost::bidirectionalS,boost::property<boost::vertex_name_t,std::string>,boost::no_property,boost::no_property,boost::listS>::config::vertex_ptr
>::value_type,std::allocator<boost::detail::adj_list_gen<boost::adjacency_list<boost::setS,boost::setS,boost::bidirectionalS,boost::property<boost::vertex_name_t,std::string>>,boost::setS,boost::setS,boost::bidirectionalS,boost::property<boost::vertex_name_t,std::string>,boost::no_property,boost::no_property,boost::listS>::config::vertex_ptr
>::value_type & >,
             DiscoverTimeMap=boost::property_value<boost::bgl_named_params<int,int>,boost::vertex_discover_time_t>::type
         ]
         e:\boost-msvc\include\boost-1_31\boost\graph\strong_components.hpp(229)
: see reference to function template instantiation
'boost::property_traits<PA>::value_type
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
         with
         [
             PA=std::allocator<int>::value_type *__w64 ,
             Graph=Graph,
             ComponentMap=std::allocator<int>::value_type *__w64 ,
             T=int,
             Tag=int
         ]
         e:\boost-msvc\include\boost-1_31\boost\graph\strong_components.hpp(243)
: see reference to function template instantiation
'boost::property_traits<PA>::value_type
boost::detail::scc_helper1<Graph,ComponentMap,boost::property_value<PropertyList,Tag>::type,int,int,boost::no_property>(const
Graph &,ComponentMap,const boost::bgl_named_params<T,int> &,RootMap)' being
compiled
         with
         [
             PA=std::allocator<int>::value_type *__w64 ,
             Graph=Graph,
             ComponentMap=std::allocator<int>::value_type *__w64 ,
             PropertyList=boost::bgl_named_params<int,int>,
             Tag=boost::vertex_root_t,
             T=int,
             RootMap=boost::property_value<boost::bgl_named_params<int,int>,boost::vertex_root_t>::type
         ]
         e:\boost-msvc\include\boost-1_31\boost\graph\strong_components.hpp(253)
: see reference to function template instantiation
'boost::property_traits<PA>::value_type
boost::strong_components<Graph,ComponentMap,int,int,boost::no_property>(const
Graph &,ComponentMap,const boost::bgl_named_params<T,Tag> &)' being compiled
         with
         [
             PA=std::allocator<int>::value_type *__w64 ,
             Graph=Graph,
             ComponentMap=std::allocator<int>::value_type *__w64 ,
             T=int,
             Tag=int
         ]
         e:\Projects\gidlp\parser\test.cpp(13) : see reference to function
template instantiation 'boost::property_traits<PA>::value_type
boost::strong_components<Graph,std::allocator<_Ty>::value_type*__w64 >(const
  Graph &,ComponentMap)' being compiled
         with
         [
             PA=std::allocator<int>::value_type *__w64 ,
             _Ty=int,
             Graph=Graph,
             ComponentMap=std::allocator<int>::value_type *__w64
         ]
==end==


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