Boost logo

Boost Users :

From: S (sa3h1n_at_[hidden])
Date: 2005-03-18 01:53:45


> Douglas Gregor <doug.gregor <at> gmail.com> writes:
> <snip>
> It is not possible to access this information in an adjacency_list
> right now, although we can easily add the typedefs. However, the
> element types of these containers are implementation details, so I'm
> not quite sure how much useful information you'll actually get from the
> typedefs.
>
> Doug
>

Here is a situation where typedefs for EdgeList etc can prove to be very useful.

template < class graph_type >
void foo( graph_type& g )
{
    // I would like to create another graph type which depends
    // on the value of the template parameter graph_type
    // e.g.
    
    typedef adjacency_list< graph_type::EdgeList,
                            graph_type::VertexList,
                            undirectedS
> another_graph_type;
    // note that graph_type could have been directedS or bidirectionalS
    // but I would like to ignore that when creating another_graph_type

    another_graph_type ag;
    copy_graph( g, ag );
    // and so we have an undirected version of the input graph - g
}

What do you think?

S


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