Boost logo

Boost :

From: Doug Gregor (dgregor_at_[hidden])
Date: 2005-02-08 11:00:22


On Feb 6, 2005, at 11:36 PM, Eelis van der Weegen wrote:

> Analysis:
>
> vec_adj_list_impl's operator= calls this->clear() followed by
> copy_impl(x), where x is the vec_adj_list_impl that is being assigned
> from. copy_impl(x) _adds_ x's vertices and edges to this->m_vertices
> and this->m_edges. Therefore, it would seem that clear() should clear
> both of those. While clear() does immediately do m_vertices.clear(),
> it doesn't clear m_edges directly, but instead calls
> clear_dispatch(edge_property_type()). There are two overloads for
> clear_dispatch(): one function template parameterized by the property
> type, and a non-template overload that accepts a reference to const
> no_property. While the former immediately calls m_edges.clear(), the
> latter does nothing (empty function body). Consequently, in graphs
> whose edge_property_type is no_property, the edges from 'x' mentioned
> above are added to the currently existing edges, while they should
> replace them.

Thanks for the analysis!

> Since I don't know the purpose of the clear_dispatch() overload for
> no_property, I have no idea what the solution should be.

Once upon a time, there was an optimization in adjacency_list to handle
the no_property case. It didn't work, so it was pulled out.
Unfortunately, it seems that it wasn't completely removed :(

I've checked in a fix.

        Doug


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