Alexandre Isoard via llvm-dev
2017-Dec-12 00:29 UTC
[llvm-dev] Extending llvm::iterator_range
Hello, Our llvm::iterator_range is quite minimalist in design, it does not even have an "empty" method. Is that because we want it to work on all iterators (including those dirty OutputIterator)? Maybe we can add a little bit to it? I recently needed: - bool empty() - value_type& font() - value_type& back() - void advance_begin(difference_type n) - void advance_end(difference_type n) Would you be open to those? -- *Alexandre Isoard* -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171211/962ff1d2/attachment.html>
David Blaikie via llvm-dev
2017-Dec-12 18:33 UTC
[llvm-dev] Extending llvm::iterator_range
I'd prefer not to add these to iterator_range itself, but as free functions so they work on any range, including arrays, etc. the advance_* ones, (is that the canonical/common name for those? I'd have guessed 'slice') could be free functions over arbitrary ranges that return iterator ranges, perhaps (though that gets into tricky territory, admittedly - lifetime expectations, views versus concrete/value ranges, etc) On Mon, Dec 11, 2017 at 4:30 PM Alexandre Isoard via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hello, > > Our llvm::iterator_range is quite minimalist in design, it does not even > have an "empty" method. > Is that because we want it to work on all iterators (including those dirty > OutputIterator)? > > Maybe we can add a little bit to it? > > I recently needed: > - bool empty() > - value_type& font() > - value_type& back() > - void advance_begin(difference_type n) > - void advance_end(difference_type n) > > Would you be open to those? > > -- > *Alexandre Isoard* > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171212/ed5184a0/attachment.html>
Alexandre Isoard via llvm-dev
2017-Dec-12 18:39 UTC
[llvm-dev] Extending llvm::iterator_range
I'm taking inspiration from those: http://www.boost.org/doc/libs/1_53_0/libs/range/doc/html/ range/reference/utilities/iterator_range.html To me, "slice" would cut the range (intuitively). But I'm not an English native. On Tue, Dec 12, 2017 at 10:33 AM, David Blaikie <dblaikie at gmail.com> wrote:> I'd prefer not to add these to iterator_range itself, but as free > functions so they work on any range, including arrays, etc. > > the advance_* ones, (is that the canonical/common name for those? I'd have > guessed 'slice') could be free functions over arbitrary ranges that return > iterator ranges, perhaps (though that gets into tricky territory, > admittedly - lifetime expectations, views versus concrete/value ranges, etc) > > On Mon, Dec 11, 2017 at 4:30 PM Alexandre Isoard via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> Hello, >> >> Our llvm::iterator_range is quite minimalist in design, it does not even >> have an "empty" method. >> Is that because we want it to work on all iterators (including those >> dirty OutputIterator)? >> >> Maybe we can add a little bit to it? >> >> I recently needed: >> - bool empty() >> - value_type& font() >> - value_type& back() >> - void advance_begin(difference_type n) >> - void advance_end(difference_type n) >> >> Would you be open to those? >> >> -- >> *Alexandre Isoard* >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> >-- *Alexandre Isoard* -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171212/4cdb1b08/attachment.html>