|
Boost Users : |
From: Shufei Fan (fansf_at_[hidden])
Date: 2007-04-09 16:50:59
Using the replied method, my initial difficulty was resolved. However, when I
introduce more properties into my vertex bundle, I am baffled again. I figure
some fundamental understanding of bundle property is necessary for me(It is
appreciated, if someone can hint on this)
This time, my graph definition is:
/////////////////////////////////////////////////////////////////////
struct Node
{
int count;
int matched_to;
std::vector<int> absorb;
double mode[3];
double center[2];
int extremes[4];
};
struct Edge
{
double maxBoundaryPoints;
double eWeight;
unsigned short nTh;
};
//the following provided by Stephan
//For accessing Node::mode[3], etc:
//pointer to Node-Mode
//new specialization of property_map for bundles with arrays
namespace boost{
template <typename Graph, typename T, typename Bundle, unsigned int Size>
struct property_map<Graph, T (Bundle::*) [Size]>
{
private:
typedef graph_traits<Graph> traits;
typedef typename Graph::vertex_bundled vertex_bundled;
typedef typename Graph::edge_bundled edge_bundled;
typedef typename mpl::if_c<(detail::is_vertex_bundle<vertex_bundled,
edge_bundled, Bundle>::value),
typename traits::vertex_descriptor,
typename traits::edge_descriptor>::type
descriptor;
typedef typename mpl::if_c<(detail::is_vertex_bundle<vertex_bundled,
edge_bundled, Bundle>::value),
vertex_bundled,
edge_bundled>::type
actual_bundle;
public:
typedef bundle_property_map<Graph, descriptor, actual_bundle, T
[Size]> type;
typedef bundle_property_map<const Graph, descriptor, actual_bundle, const T
[Size]>
const_type;
};
};
typedef boost::adjacency_list<
boost::listS, boost::listS, boost::bidirectionalS,
boost::property<vertex_index_t, int, Node>, Edge> Graph;
////////////////////////////////////////////////////////////////////////////
In my appliication, I defined a class GA, containing pointer of type Graph.
And my compiling error comes from constructor of GA, as detailed follows:
///////////////////////////////////////////////////////////////////
class GA {
....
Graph *rowGraph;
....
GA(){};//compiling error occurs here
GA(*, *, *);
....
}
GA::GA(*, *, *)
{//compiling error occurs here, too
}
///////////////////////////////////////////////////////
And my compiling error comes from constructor of GA, but it is clearly related
from above work-around for accessing bundled array. Any clues?
c:\shufei\VCProjects\edison\segm\GA.h(182) : error
C2512: 'boost::bundle_property_map<Graph,Descriptor,Bundle,T>' : no
appropriate default constructor available
with
[
Graph=Graph,
Descriptor=boost::property_map<Graph,int Node::* >::descriptor,
Bundle=Node,
T=int
]
Thanks
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