|
Boost : |
From: Rob Smallshire (robert_at_[hidden])
Date: 2001-07-25 04:21:26
Hi Jeremy,
> > Q1:
> >
> > Compiling the following two lines:
> >
> > std::vector<int> component(boost::num_vertices(G));
> > int num = boost::connected_components(G, &component[0]);
>
> Could you show my what type G is. A small compilable program example
> demonstrating the problem would be best.
Here you are - this program gives an identical error on MSVC6.0sp5,
C:/users/rob/dev/utils/boost/boost_1_22_0\boost/property_map.hpp
(185) : error C2664: 'void __cdecl boost::put(int *,int,
const int &)' : cannot convert parameter 2 from 'void *' to 'int'
This conversion requires a reinterpret_cast, a C-style cast or
function-style cast C:/users/rob/dev/utils/boost/boost_1_22_0
\boost/property_map.hpp(183) : while compiling class-template member
function 'void __thiscall boost::WritablePropertyMapConcept<int
*,void *>::constraints(void)'
Program :
#include <iostream>
#include <vector>
#include <boost/smart_ptr.hpp>
#include <boost/property_map.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/connected_components.hpp>
class baseT
{
// In my full code baseT is a class template parameter and
// everything else below is wrapped up in a class
};
typedef unsigned int setID;
struct object_t
{
enum { num = 4562 }; /*< Unique id for this tag */
typedef boost::vertex_property_tag kind;
};
struct set_t
{
enum { num = 4563 }; /*< Unique id for this tag */
typedef boost::vertex_property_tag kind;
};
struct component_t
{
enum { num = 4564 };
typedef boost::vertex_property_tag kind;
};
typedef boost::property<object_t, const baseT *> VertexObjectProperty;
typedef boost::property<set_t, setID, VertexObjectProperty>
VertexSetProperty;
typedef boost::property<component_t, int, VertexSetProperty>
VertexComponentProperty;
typedef boost::property<boost::edge_weight_t, int> EdgeWeightProperty;
typedef boost::adjacency_list<boost::listS, boost::setS,
boost::undirectedS, VertexSetProperty ,EdgeWeightProperty> Graph;
typedef boost::property_map<Graph, component_t>::type
ComponentPropertyMap;
int main(int argc, char* argv[])
{
Graph G;
std::vector<int> component(boost::num_vertices(G));
int num = boost::connected_components(G, &component[0]);
return 0;
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk