Would it really be that unhandy?  You would only need to iterate from iter->first to iter->second to get the same effect.<br><br>Granted it wouldn't work with existing algorithms that take predicates or functions with integer arguments, but I wonder if anyone would even notice that limitation.  And when the bits happen to be clustered together , which is not uncommon, it will be vastly more efficient <br><div class="gmail_quote"><div dir="ltr">On Thu, Apr 13, 2017 at 5:44 PM Matthias Braun <<a href="mailto:matze@braunis.de">matze@braunis.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>While more efficient, this seems unhandy to me...</div><div><br></div><div>Using a BitVector as a replacement for a std::set<unsigned> is a common pattern and in this case I would expect the iterator to return all the elements that I put into the set before...</div></div><div style="word-wrap:break-word"><div><br></div><div>- Matthias</div></div><div style="word-wrap:break-word"><br><div><blockquote type="cite"><div>On Apr 13, 2017, at 5:41 PM, Zachary Turner <<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>> wrote:</div><br class="m_-8876891372759186519Apple-interchange-newline"><div>Instead of having the value type be an index, how about having it be a range?  Eg if bits,1,2,3,6,8,9 are set then have it return (1,4), (6,7), and (8,10) on successive iterations.  This should be much more efficient.  For a bits_unset iterator, the above would return (0,1), (4, 6), (7,8), (10, size())<br><div class="gmail_quote"><div dir="ltr">On Thu, Apr 13, 2017 at 5:29 PM Matthias Braun via Phabricator <<a href="mailto:reviews@reviews.llvm.org" target="_blank">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">MatzeB added reviewers: dblaikie, chandlerc, mehdi_amini.<br>
MatzeB added a comment.<br>
<br>
Adding a few reviewers who often have comments on ADT changes.<br>
<br>
<br>
<a href="https://reviews.llvm.org/D32060" rel="noreferrer" target="_blank">https://reviews.llvm.org/D32060</a><br>
<br>
<br>
<br>
</blockquote></div>
</div></blockquote></div><br></div></blockquote></div>