Stephan Diederich writes:
Are you saying initialize the property-pointer in the class GA's
constructor?
I just wanted to get a working example ;)
I tried this, I am on windows vc2003.net, but that still doesnot compile.
I've
switched to using local variable instead(although more local definitions,
but
easier to get it work anyway)
Maybe we can get Doug (the one who made the Bundled Properties) to
comment on this...
Cheers,
Stephan
Simplified sample as follows, produced the error.
#include
#include <iostream> // for std::cout
#include <fstream> // for std::cout
#include <utility> // for std::pair
#include <algorithm> // for std::for_each
#include // for boost::tie
#include // for boost::graph_traits
#include
#include
using namespace boost;
struct Node
{
int count;//pixel number for this region
double mode[3];//region mode (RGB)
};
struct Edge
{
double eWeight;//normalized number of common boundary
points
};
//For accessing mode[3]:
//pointer to Node-Mode
//new specialization of property_map for bundles with arrays
namespace boost{
template
struct property_map
{
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::value),
typename traits::vertex_descriptor,
typename traits::edge_descriptor>::type
descriptor;
typedef typename mpl::if_c<(detail::is_vertex_bundle::value),
vertex_bundled,
edge_bundled>::type
actual_bundle;
public:
typedef bundle_property_map type;
typedef bundle_property_map
const_type;
};
};
typedef boost::adjacency_list<
boost::listS, boost::listS, boost::bidirectionalS,
boost::property, Edge> Graph;
class GA {
//data members
//Number of points
int nRowPnt;
int nColPnt;
//Graph variables
Graph *rowGraph;
Graph *colGraph;
boost::property_map::type L_vertex_id,
R_vertex_id;
boost::property_map::type nmt;
//methods members
public:
//default constructor
GA():
nRowPnt (0),
nColPnt (0),
rowGraph(NULL),
colGraph(NULL)
{
rowGraph = new Graph();
colGraph = new Graph();
nmt = get(&Node::count, *rowGraph);
}
~GA()
{
delete rowGraph;
delete colGraph;
}
};
int main()
{
GA ga;
return 0;
}
///////////////////////////////////////////////////////////////////////////////
error:
xxxx...error C2512: 'boost::bundle_property_map' :
no appropriate default constructor available
with
[
Graph=Graph,
Descriptor=boost::property_map::descriptor,
Bundle=Node,
T=int
]
xxxxxxxxxxx............................
try1 - 1 error(s), 0 warning(s)
Thanks,
Shufei