<div class="gmail_extra"><div class="gmail_quote">On Fri, Aug 3, 2012 at 11:33 AM, Chris Lattner <span dir="ltr"><<a href="mailto:clattner@apple.com" target="_blank" class="cremed">clattner@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 Aug 3, 2012, at 2:46 AM, Chandler Carruth <<a href="mailto:chandlerc@gmail.com" class="cremed">chandlerc@gmail.com</a>> wrote:<br>
<br>
> Hello!<br>
><br>
> This adds a handy little iterator wrapper I ended up wanting when writing several algorithms that build up and transform data stored in a SmallVector (or any vector-like container). I'm still writing a basic test of the functionality, but wanted to get any feedback on the idea and rough patch.<br>

><br>
> More details about the semantics and use case are in the comments in the patch.<br>
<br>
</div></div>I don't really see what this is doing, can you give an example use-case?<br></blockquote><div><br></div><div>Yea, I'll try to distill my real world code that is using this into a test case for the iterator itself and post an updated patch.</div>
<div><br></div><div>The gist of it is this:</div><div><br></div><div>Imagine you have a sorted vector, and are processing each element. One step of the processing has the option of producing new values that should be inserted into the vector. Because they are already processed, they don't need to be visited again, and so you simple push_back everything new, and sort the vector again at the end.</div>
<div><br></div><div>Each push_back invalidates all of the vector iterators, and so now all of the code involved in "processing" the elements has to be written in terms of indexes instead of iterators. =/ This iterator wrapper allows you to use slightly heavier weight iterators (the same weight as an index), and get all of the stability of an index -- push_back doesn't invalidate or change any of the iterators valid before the push_back occurs.</div>
<div><br></div><div>Anyways, not sure if English is the right way to explain this. ;] An updated patch when I can swap this change back in...</div></div></div>