Ok so I still can't use the randomize property but I've done a workaround.
I created an AbstractGraph class which has a m_Graph adjacency_list type
of graph. And nodes uses the bundled property :
struct City
{
int pos_X;
int pos_Y;
};
My workaround test function uses the property map given to randomly set
the values, but it's still too specific :
template
void AbstractGraph::test(bundle_property_map p_PMap, RandomGenerator& p_ewrg){
AbstractGraph::N_iterator l_NodeStart;
AbstractGraph::N_iterator l_NodeEnd;
AbstractGraph::GetNodes(l_NodeStart,l_NodeEnd);
for (; l_NodeStart != l_NodeEnd; ++l_NodeStart) {
p_PMap[*l_NodeStart] = p_ewrg();
}
}
called this way in the main :
mt19937 l_Gen(1988);
boost::uniform_int<> RandRange(1,10);
boost::variate_generator >
ew2rg(l_Gen, RandRange);
typedef property_map::type t_PMapCity;
t_PMapCity l_PMap=get(&City::pos_X,m_Graph);
test(l_PMap,ew2rg);
I would like to include the two line that generates the property_map from
the main to the test function. I've tried this :
template
void AbstractGraph::test2( ??? p_PropertyTagName,RandomGenerator& p_ewrg){
typedef property_map::type t_PMap;
t_PMap l_PMap=get(PropertyTagName,m_Graph);
AbstractGraph::N_iterator l_NodeStart;
AbstractGraph::N_iterator l_NodeEnd;
AbstractGraph::GetNodes(l_NodeStart,l_NodeEnd);
for (; l_NodeStart != l_NodeEnd; ++l_NodeStart) {
p_PMap[*l_NodeStart] = p_ewrg();
}
}
called this way :
test2(l_Gen, &City::pos_X);
But I can't figure any type for &City::pos_X in order to write the header
for test2 allowing the function to work with float, char ...
Thanks in advance
M.CORBION