<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 22, 2014 at 6:05 PM, Marshall Clow <span dir="ltr"><<a href="mailto:mclow.lists@gmail.com" target="_blank">mclow.lists@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span class=""><div>On Sep 16, 2014, at 2:13 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:</div><br><blockquote type="cite"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 16, 2014 at 1:38 PM, Marshall Clow <span dir="ltr"><<a href="mailto:mclow.lists@gmail.com" target="_blank">mclow.lists@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Author: marshall<br>
Date: Tue Sep 16 15:38:11 2014<br>
New Revision: 217902<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=217902&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=217902&view=rev</a><br>
Log:<br>
Create a 'comma_iterator' class that overloads operator, and asserts when it's called. Add tests to mismatch to make sure it can't be blindsided by such an evil iterator. More tests for other algorithms forthcoming. Thanks to STL for pointing this out at CppCon and Yakov Galka for opening LWG issue #2133<br></blockquote><div><br></div><div>Could it use "= delete" to make this test fail at compile-time?</div></div></div></div></blockquote><div><br></div></span>Sorry I didn’t respond before.</div><div><br></div><div>The point here is not that this should fail to compile, but rather that such evil iterators should work with the standard algorithms.</div></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div>See  <a href="http://llvm.org/viewvc/llvm-project?rev=217903&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=217903&view=rev</a> for a change to std::mismatch to work correctly.</div></div></blockquote><div><br></div><div><div>Right - but what I mean is if the definition was "= deleted" you'd get compilation errors from the tests for std::mismatch before the (void) casts were added, right? I figured it just might be a lower-cost way to test (not needing to execute code) and give possibly easier to track down errors to fix algorithms that weren't comma overload safe.<br><br>- David</div><div> </div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><span class=""><font color="#888888"><div><br></div><div>— Marshall</div><div><br></div><div><br></div><div><br></div></font></span></div></blockquote></div><br></div></div>