On Tue, Oct 2, 2012 at 5:24 PM, Jakob Stoklund Olesen <span dir="ltr"><<a href="mailto:stoklund@2pi.dk" target="_blank" class="cremed">stoklund@2pi.dk</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
On Oct 2, 2012, at 5:03 PM, Chandler Carruth <<a href="mailto:chandlerc@gmail.com" class="cremed">chandlerc@gmail.com</a>> wrote:<br>
<br>
> Switch the SetVector::remove_if implementation to use partition which<br>
> preserves the values of the relocated entries, unlikely remove_if. This<br>
> allows walking them and erasing them.<br>
<br>
</div>This can reorder the elements in an unspecified way, causing the SetVector iteration order to depend on the C++ library implementation.<br></blockquote><div><br></div><div>Oof....</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
And stable_partition calls malloc()…<br>
<br>
I would call find_if() followed by an explicit loop. Or you could do swaps with vector_.back() to avoid moving all the vector elements.<br></blockquote><div><br></div><div>I can go back to my original idea for solving this: make a predicate that calls the set_.erase(). I think that's slightly better than open coding any of these loops.... It's just a wrapper predicate.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
/jakob<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" class="cremed">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank" class="cremed">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>