<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On May 23, 2008, at 4:10 AM, Nicolas Capens wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div lang="EN-US" link="blue" vlink="purple"><div class="Section1"><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">Hi all,<o:p></o:p></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">I updated from 2.2 to the latest SVN head and I now get a debug assert in<span class="Apple-converted-space"> </span><span style="font-size: 10pt; font-family: 'Courier New'; ">BranchFolder::RemoveBlocksWithHash</span>: “vector iterators incompatible”. I’m using Visual C++ 2005. I think this is the culprit code:<o:p></o:p></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10pt; font-family: 'Courier New'; ">    MergePotentials.erase(CurMPIter);<o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10pt; font-family: 'Courier New'; ">   <span class="Apple-converted-space"> </span><span style="color: blue; ">if</span><span class="Apple-converted-space"> </span>(CurMPIter==B)<o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10pt; font-family: 'Courier New'; ">     <span class="Apple-converted-space"> </span><span style="color: blue; ">break</span>;</span><o:p></o:p></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">The erase clears the _Mycont field (i.e. the iterator’s container), while the == expects CurMPIter and B to have the same container. I’m no STL guru but it seems wrong to first erase an element and then try to compare it. I traced it back to revision 50921 made on May 10’th. I rewrote it like following, which I’m not entirely sure is the intended behavior but it ‘works for me’:<o:p></o:p></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10pt; font-family: 'Courier New'; ">    CurMPIter = MergePotentials.erase(CurMPIter);<o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10pt; font-family: 'Courier New'; ">   <span class="Apple-converted-space"> </span><span style="color: blue; ">if</span><span class="Apple-converted-space"> </span>(CurMPIter==B)<o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10pt; font-family: 'Courier New'; ">     <span class="Apple-converted-space"> </span><span style="color: blue; ">break</span>;</span></div></div></div></span></blockquote><br></div><div>Thanks for analyzing the problem.</div><div><br class="webkit-block-placeholder"></div><div>I also am not a STL guru; the standard says erase</div><div><span class="Apple-style-span" style="font-family: Times; font-size: 17px; ">"Invalidates all the iterators and references after the point of the erase"</span></div><div><font class="Apple-style-span" face="Times" size="5"><span class="Apple-style-span" style="font-size: 17px;"><span class="Apple-style-span" style="font-family: Helvetica; font-size: 16px; ">which is not wonderfully worded, but I take it to mean an iterator referring <b>to</b> the point of the erase remains valid....But if it doesn't work that way on VC++, it doesn't.  Now I know.</span></span></font></div><div><br class="webkit-block-placeholder"></div><div>It's clearly better to call erase only once, so I've rewritten it that way.   Please make sure it works for you.</div><div><br></div></body></html>