[llvm-dev] Extending llvm::iterator_range

David Blaikie via llvm-dev llvm-dev at lists.llvm.org
Tue Dec 12 10:33:57 PST 2017


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>


More information about the llvm-dev mailing list