|
Boost Users : |
Subject: Re: [Boost-users] [Graph]questions regarding boost::graph::adjacency_list constructor prototype
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2011-06-30 15:00:13
On Thu, 30 Jun 2011, Tan, Tom (Shanghai) wrote:
>
> While studying boost.graph, I stumbled upon this constructor definition:
>
> Â Â Â Â template <class EdgeIterator>
>
> Â Â Â adjacency_list(EdgeIterator first, EdgeIterator last,
>
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â vertices_size_type n,
>
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â edges_size_type = 0,
>
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â const GraphProperty& p = GraphProperty())
>
> Â Â Â Â Â : Base(n, first, last), m_property(new graph_property_type(p))
>
> { }
>
> I have 2 questions here:
>
> -         What does âedges_size_type = 0,â means here? Assigning a value to a TYPE, instead of a parameter? Can
> anyone please point me to an explanation of this grammar usage?
It's like if the code was "edges_size_type x = 0", but since the parameter
is not used, removing the name avoids compiler warnings.
>
> -         Why the necessary of edges_size_type = 0 parameter, since thereâs a range pair of âEdgeIterator first,
> EdgeIterator lastâ?
It is not necessary, since the value of that parameter is never used. It
is probably there match the interface of some other constructor, either in
adjacency_list or some other graph class.
-- Jeremiah Willcock
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