Corrected ClearHeap(): iterator "hi" not decrementable if it was the first of the container.
This commit is contained in:
parent
78f25ae2a1
commit
ee1b991e25
|
@ -22,6 +22,9 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
$Log: not supported by cvs2svn $
|
$Log: not supported by cvs2svn $
|
||||||
|
Revision 1.16 2005/11/10 15:38:46 cignoni
|
||||||
|
Added casts to remove warnings
|
||||||
|
|
||||||
Revision 1.15 2005/10/02 23:23:52 cignoni
|
Revision 1.15 2005/10/02 23:23:52 cignoni
|
||||||
Changed the sense of the < operator for heap: it is reversed according to the stl where highest score elements must float in the heap
|
Changed the sense of the < operator for heap: it is reversed according to the stl where highest score elements must float in the heap
|
||||||
Completed TimeBudget Termination condition.
|
Completed TimeBudget Termination condition.
|
||||||
|
@ -290,16 +293,16 @@ void ClearHeap()
|
||||||
{
|
{
|
||||||
typename HeapType::iterator hi;
|
typename HeapType::iterator hi;
|
||||||
//int sz=h.size();
|
//int sz=h.size();
|
||||||
for(hi=h.begin();hi!=h.end();++hi)
|
for(hi=h.begin();hi!=h.end();)
|
||||||
{
|
{
|
||||||
if(!(*hi).locModPtr->IsUpToDate())
|
if(!(*hi).locModPtr->IsUpToDate())
|
||||||
{
|
{
|
||||||
delete (*hi).locModPtr;
|
delete (*hi).locModPtr;
|
||||||
*hi=h.back();
|
*hi=h.back();
|
||||||
h.pop_back();
|
h.pop_back();
|
||||||
if(hi==h.end()) break;
|
continue;
|
||||||
--hi;
|
|
||||||
}
|
}
|
||||||
|
++hi;
|
||||||
}
|
}
|
||||||
//printf("\nReduced heap from %7i to %7i (fn %7i) ",sz,h.size(),m.fn);
|
//printf("\nReduced heap from %7i to %7i (fn %7i) ",sz,h.size(),m.fn);
|
||||||
make_heap(h.begin(),h.end());
|
make_heap(h.begin(),h.end());
|
||||||
|
|
Loading…
Reference in New Issue