N
Nick Keighley
Hi,
I've checked out various documentation for multimap but can't
find anywhere it explicitly stated that insert() invalidates multimap
iterators.
consider this pseudo code:-
int DataItem::genDerived ()
{
DataItem::MultiMap::const_iterator iter =
dataItems.lower_bound(parameterReference);
DataItem::MultiMap::const_iterator end =
dataItems.upper_bound(parameterReference);
while (iter != end)
{
newItem = calcNewItem (iter);
dataItems.insert (newItem);
}
}
It selects a particular value in the mm and finds the lower and
upper bounds on their location. It then loops on all of them
calculating a derived value for each. This is inserted into the
same mm. A bad idea?
I've checked out various documentation for multimap but can't
find anywhere it explicitly stated that insert() invalidates multimap
iterators.
consider this pseudo code:-
int DataItem::genDerived ()
{
DataItem::MultiMap::const_iterator iter =
dataItems.lower_bound(parameterReference);
DataItem::MultiMap::const_iterator end =
dataItems.upper_bound(parameterReference);
while (iter != end)
{
newItem = calcNewItem (iter);
dataItems.insert (newItem);
}
}
It selects a particular value in the mm and finds the lower and
upper bounds on their location. It then loops on all of them
calculating a derived value for each. This is inserted into the
same mm. A bad idea?