[llvm] r248447 - Add iterator_range::end() predicate.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 17:21:47 PDT 2015


On Wed, Sep 23, 2015 at 5:19 PM, David Blaikie <dblaikie at gmail.com> wrote:

>
>
> On Wed, Sep 23, 2015 at 5:10 PM, Aaron Ballman via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>> On Wed, Sep 23, 2015 at 7:58 PM, Rui Ueyama via llvm-commits
>> <llvm-commits at lists.llvm.org> wrote:
>> > Author: ruiu
>> > Date: Wed Sep 23 18:58:29 2015
>> > New Revision: 248447
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=248447&view=rev
>> > Log:
>> > Add iterator_range::end() predicate.
>>
>> Why is this required? I only ask because I was under the impression we
>> wanted to keep this interface as similar to what may be standardized
>> as possible, and I don't recall this as part of the current ranges
>> proposal. However, I could be wrong as I've not checked the proposal
>> in a while.
>>
>
> +1, I'd rather avoid adding such members to range abstractions - instead,
> we should just have a non-member llvm::empty function (if we don't have one
> already) that takes a range (and uses std::begin/end on it) and returns a
> bool, etc.
>

I was not really aware that this was trying to mimic the proposal, so I
just thought that that's useful in general. Now that I know that, I'm
rolling this back.


>> ~Aaron
>>
>> >
>> > Modified:
>> >     llvm/trunk/include/llvm/ADT/iterator_range.h
>> >
>> > Modified: llvm/trunk/include/llvm/ADT/iterator_range.h
>> > URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/iterator_range.h?rev=248447&r1=248446&r2=248447&view=diff
>> >
>> ==============================================================================
>> > --- llvm/trunk/include/llvm/ADT/iterator_range.h (original)
>> > +++ llvm/trunk/include/llvm/ADT/iterator_range.h Wed Sep 23 18:58:29
>> 2015
>> > @@ -45,6 +45,7 @@ public:
>> >
>> >    IteratorT begin() const { return begin_iterator; }
>> >    IteratorT end() const { return end_iterator; }
>> > +  bool empty() const { return begin_iterator == end_iterator; }
>> >  };
>> >
>> >  /// \brief Convenience function for iterating over sub-ranges.
>> >
>> >
>> > _______________________________________________
>> > llvm-commits mailing list
>> > llvm-commits at lists.llvm.org
>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150923/f4506732/attachment.html>


More information about the llvm-commits mailing list