Add 'operator==' for 'basic_collection_iterator'

Jordan Rose via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 18 10:22:43 PST 2015


> On Dec 18, 2015, at 5:49 , Alexey Denisov <1101.debian at gmail.com> wrote:
> 
>> Ha, I was still thinking something simpler.
> 
> I came up with the same solution when I woke up next morning :-D
> 
>> EXPECT_FALSE(Begin == std::next(Begin));
>> EXPECT_FALSE(std::next(Begin) == Begin);
> 
> I have faced an issue with such tests. std::next in the case of SequenceNode mutates value in-place, so that iterators are equal.
> But it could be tested using some other BaseT, not a SequenceNode. I also realised it afterwards.
> 
>> InputIterators don't actually guarantee that this is valid, so we don't have to implement it, but I think we should do it just so other people don't get bitten. There's not much reason not to.

I looked at basic_collection_iterator again. It really shouldn't be defining itself as a forward iterator. I think we should just make it an input iterator and assert that the entries are the same if the bases are the same.

Jordan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151218/31d19cc4/attachment.html>


More information about the llvm-commits mailing list