<div dir="ltr">Can we explicitly delete the erase method or do something else to document the fact that it is unsupported?  It was added incidentally in r211350, even though it was added and removed by Doug back in r175538 / r175449.</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 15, 2014 at 10:54 AM, Duncan P. N. Exon Smith <span dir="ltr"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br>
> On 2014-Jul-15, at 10:05, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
><br>
> On Tue, Jul 15, 2014 at 9:43 AM, Duncan P. N. Exon Smith<br>
> <<a href="mailto:dexonsmith@apple.com">dexonsmith@apple.com</a>> wrote:<br>
>><br>
>>> On 2014-Jul-15, at 09:38, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
>>><br>
>>> On Tue, Jul 15, 2014 at 9:31 AM, Duncan P. N. Exon Smith<br>
>>> <<a href="mailto:dexonsmith@apple.com">dexonsmith@apple.com</a>> wrote:<br>
>>>><br>
>>>>> On 2014-Jul-15, at 08:29, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
>>>>><br>
>>>>> Sounds pretty clearly buggy, and against the original design of the<br>
>>>>> ADT (as pointed out by the documentation quotation). When was erase<br>
>>>>> functionality added to MapVector? Can/should it be removed (and the<br>
>>>>> use case changed to use some other container)<br>
>>>>><br>
>>>>> Making erase linear time sounds... not ideal, but possibly its<br>
>>>>> sufficient for some/current use cases. Or we could consider other<br>
>>>>> solutions to the use cases.<br>
>>>><br>
>>>> Heh -- it's already linear.  It erases from the middle of a vector.<br>
>>>><br>
>>>> At the least, if erasing is kept (and fixed), someone needs to update the<br>
>>>> docs and add a unit test.<br>
>>>><br>
>>>> One way of speeding this up would be to erase a set of values in bulk.  I<br>
>>>> think we could easily add a `remove_if()` function that deleted a set of<br>
>>>> matching items in linear time, using a linear-size auxiliary array of<br>
>>>> indices to keep state.<br>
>>>><br>
>>>> I'd be happy to implement this if there's a need (if you can easily design<br>
>>>> it out, that's better).<br>
>>><br>
>>> Yeah, at a glance it doesn't seem especially painful to design out -<br>
>>> maybe 10 lines of code.<br>
>><br>
>> Great.  The `remove_if()` would probably be about the same (excluding tests), so<br>
>> if this is ever the "right" approach, it might still be worth it.<br>
><br>
> After attempting, this gets a bit more insidious and (perhaps<br>
> unsurprisingly) my estimate turned out to be rather optimistic.<br>
><br>
> (for the record, it gets ugly in EmitGenDwarfAranges which currently<br>
> computes the length ahead of time (so, it does things like take the<br>
> length of the ranges collection - so if we leave dead entries in there<br>
> it'd have to iterate through to count, for example - or just use a<br>
> label difference))<br>
><br>
> If you're happy to fix/test a MapVector::remove_if, that'd be swell.<br>
> It might be a while before I find the time to refactor this whole<br>
> thing into something common (& /maybe/ in the process, avoid this<br>
> particular removal quirk) between DwarfDebug and MCDwarf... :/<br>
><br>
> - David<br>
<br>
</div></div>Here's a patch with the fixes (totally untested).  I'll commit<br>
incrementally as I write unit tests, but you can use this locally if<br>
you want to try out changes to the MC code in the meantime.<br>
<br>
+chandlerc: as code owner of ADT, any problem with me adding this API<br>
to MapVector?<br>
<br>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>