Boost logo

Boost :

From: jsiek_at_[hidden]
Date: 2000-10-15 13:30:05


Hi Krishna,

I think you just need to explicitly create an object of type LayerPlugin.

 int main ()
 {
    Graph g (LayerPlugin(999));
    cout << num_vertices (g) << endl; // prints 999 instead of zero.
    return 0;
 }

Krishna Padmasola writes:
> Hi Jeremy,
>
> I am defining a graph property which is of type int. I am supplying an
> int argument to the constructor, which is getting interpreted as the
> number of vertices rather than the graph property.
>
> The constructor 2 (see below) is getting called rather than constructor
> 1.
>
> Is there a fix/workaround?
>
> Thanks in advance,
> Krishna.
>
> 1. inline adjacency_list(const GraphProperty& p = GraphProperty())
> : m_property(p) { }
>
> 2. inline adjacency_list(vertices_size_type num_vertices,
> const GraphProperty& p = GraphProperty())
> : Base(num_vertices), m_property(p) { }
>
> the following does not work:
>
> enum vertex_Node_t {vertex_Node = 200};
> enum edge_Edge_t {edge_Edge = 201};
> enum graph_Layer_t {graph_Layer = 202};
> namespace boost {
> BOOST_INSTALL_PROPERTY(vertex, Node);
> BOOST_INSTALL_PROPERTY(edge, Edge);
> BOOST_INSTALL_PROPERTY(graph, Layer);
> }
>
> typedef property<vertex_Node_t, string> VertexPlugin;
> typedef property<edge_Edge_t, string> EdgePlugin;
> typedef property<graph_Layer_t, int> LayerPlugin;
>
>
> typedef adjacency_list <listS, listS, bidirectionalS,
> VertexPlugin, EdgePlugin, LayerPlugin> Graph;
>
> int main ()
> {
> Graph g (999); // does not initialize the graph property with 999.
> cout << num_vertices (g) << endl; // prints 999 instead of zero.
> return 0;
> }
>
>
>
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk