Boost logo

Boost Users :

From: Jeffrey Holle (jeff.holle_at_[hidden])
Date: 2004-08-31 13:13:49

I've apparently succeeded in switching from external to internal
properites in my application.

However, I've done things in an OOP way, and would like to know if
somebody can point out potential trouble.

I've a class, called Graph, that inherits from the boost::graph object.

The start of its definition is:

class Graph : public GraphT
   // Graph Data accessor methods
   typedef boost::property_map<GraphT, vertex_Datum_t>::type VertexData;
   typedef boost::property_map<GraphT, edge_Datum_t>::type EdgeData;
   const VertexData& getVertexData(void) const {return vertexData_;}

   VertexData vertexData_;

Note the typedef of VertexData. I initialize vertexData_ in the Graph
constructor like this:
   vertexData_ = boost::get(vertex_Datum, *this);

I've numerous methods like this in Graph:

DataGraph::add_vertex(LayoutVertex *pLayoutVertex)
   Vertex vertex = boost::add_vertex(*this);
   return vertex;

I guess my biggest concern is initializing vertexData_ once, before the
graph has any data, and keeping it around though the life of the graph.
Is this safe?

Also, I expect clients of this class to be able to use the operator[]
method via getVertexData(). Will this work?

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at