Boost logo

Boost :

From: Thomas Witt (witt_at_[hidden])
Date: 2001-10-20 09:46:13


The following applies to 1_25_0.

I am currently evaluating the intel compiler together with stlport-4.5. While
running the boost regression tests for this platform stlport debug mode
complained about usage of an invalidated iterator.

AFAICS the problem is due to the following idiom from

../boost/graph/detail/adjacency_list.hpp:247

typename Config::InEdgeList& in_el = in_edge_list(g, target(e, g));
typename Config::InEdgeList::iterator in_i = in_el.begin();

for (; in_i != in_el.end(); ++in_i)
   if (&(*in_i).get_property() == (PType*)e.get_property()) {
       in_el.erase(in_i);
       break;
    }

In case the underlying representation for Config::InEdgeList& is indeed a
std::list this is a bug as in_i is invalidated when the corresponding element
is erased (23.2.2.3 [lib.list.modifiers]). Assuming validity of an iterator
to an erased element sounds a bit strange to me even if an user define
container is used.

The reason for this not showing up in other configurations is that the usage
of _STLP_DEBUG seems to be inconsistent for regression testing. I checked the
gcc targets and _STLP_DEBUG is not defined there. I propose using _STLP_DEBUG
for all stlport targets.

Thomas

-- 
Dipl.-Ing. Thomas Witt
Institut fuer Verkehrswesen, Eisenbahnbau und -betrieb, Universitaet Hannover
voice: +49(0) 511 762 - 4273, fax: +49(0) 511 762-3001
http://www.ive.uni-hannover.de

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