<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Yep, that's what I meant, but it needs a comment to explain why it's safe.</div><div class=""><br class=""></div><div class="">The assertion I wanted was</div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><br class=""></div><div class="">if (Base && Base == Other.Base)</div><div class=""> assert(Base->CurrentEntry == Other->CurrentEntry && "appropriate message here");</div></blockquote><div class=""><br class=""></div><div class="">That'll get trivially compiled out in Release builds, but in Debug builds it will catch any changes to the YAML parser in the future that might break the assumption.</div><div class=""><br class=""></div>Jordan<br class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 18, 2015, at 13:11, Alex Denisov <<a href="mailto:1101.debian@gmail.com" class="">1101.debian@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">So I changed iterator tag to input_iterator and re-implemented equality operators.<br class=""><br class="">Now it looks trivial:<br class=""><br class="">bool operator==(const basic_collection_iterator &Other) const {<br class=""> return Base == Other.Base;<br class="">}<br class=""><br class="">See the whole patch:<br class=""><br class=""><span id="cid:F7B0AF37-1078-4649-9C8C-651463F3FD54@apple.com"><basic_collection_iterator_operator_equals.patch></span><br class="">--<br class="">AlexDenisov<br class="">Software Engineer, <a href="http://lowlevelbits.org" class="">http://lowlevelbits.org</a><br class=""><br class=""><blockquote type="cite" class="">On 18 Dec 2015, at 21:05, Alex Denisov <<a href="mailto:1101.debian@gmail.com" class="">1101.debian@gmail.com</a>> wrote:<br class=""><br class=""><blockquote type="cite" class="">It really shouldn't be defining itself as a forward iterator. I think we should just make it an input iterator<br class=""></blockquote><br class="">Makes sense. I also looked at specification (§24.2.3, §24.2.5): the iterator doesn’t conform some requirements described there (e.g. multi-pass guarantee).<br class=""><br class=""><blockquote type="cite" class="">and assert that the entries are the same if the bases are the same.<br class=""></blockquote><br class="">How do you want express the assertion? Do you mean semantic assertion e.g.: 'X == Y iff X.Base == Y.Base’ or something different?<br class="">--<br class="">AlexDenisov<br class="">Software Engineer, <a href="http://lowlevelbits.org" class="">http://lowlevelbits.org</a><br class=""><br class=""><blockquote type="cite" class="">On 18 Dec 2015, at 19:22, Jordan Rose <<a href="mailto:jordan_rose@apple.com" class="">jordan_rose@apple.com</a>> wrote:<br class=""><br class=""><br class=""><blockquote type="cite" class="">On Dec 18, 2015, at 5:49 , Alexey Denisov <<a href="mailto:1101.debian@gmail.com" class="">1101.debian@gmail.com</a>> wrote:<br class=""><br class=""><blockquote type="cite" class="">Ha, I was still thinking something simpler.<br class=""></blockquote><br class="">I came up with the same solution when I woke up next morning :-D<br class=""><br class=""><blockquote type="cite" class="">EXPECT_FALSE(Begin == std::next(Begin));<br class="">EXPECT_FALSE(std::next(Begin) == Begin);<br class=""></blockquote><br class="">I have faced an issue with such tests. std::next in the case of SequenceNode mutates value in-place, so that iterators are equal.<br class="">But it could be tested using some other BaseT, not a SequenceNode. I also realised it afterwards.<br class=""><br class=""><blockquote type="cite" class="">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.<br class=""></blockquote></blockquote><br class="">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.<br class=""><br class="">Jordan<br class=""></blockquote><br class=""></blockquote><br class=""></div></div></blockquote></div><br class=""></body></html>