<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Apr 10, 2014, at 3:10 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">On Thu, Apr 10, 2014 at 2:49 PM, Jim Grosbach <<a href="mailto:grosbach@apple.com">grosbach@apple.com</a>> wrote:<br><blockquote type="cite">Author: grosbach<br>Date: Thu Apr 10 16:49:22 2014<br>New Revision: 205987<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=205987&view=rev">http://llvm.org/viewvc/llvm-project?rev=205987&view=rev</a><br>Log:<br>iterator_range: Add an llvm::make_range() helper method.<br><br>Convenience wrapper to make dealing with sub-ranges easier. Like the<br>iterator_range<> itself, if/when this sort of thing gets standards<br>blessing, it will be replaced by the official version.<br><br>Modified:<br>   llvm/trunk/include/llvm/ADT/iterator_range.h<br><br>Modified: llvm/trunk/include/llvm/ADT/iterator_range.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/iterator_range.h?rev=205987&r1=205986&r2=205987&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/iterator_range.h?rev=205987&r1=205986&r2=205987&view=diff</a><br>==============================================================================<br>--- llvm/trunk/include/llvm/ADT/iterator_range.h (original)<br>+++ llvm/trunk/include/llvm/ADT/iterator_range.h Thu Apr 10 16:49:22 2014<br>@@ -40,6 +40,14 @@ public:<br>  IteratorT begin() const { return begin_iterator; }<br>  IteratorT end() const { return end_iterator; }<br>};<br>+<br>+/// \brief Convenience function for iterating over sub-ranges.<br>+///<br>+/// This provides a bit of syntactic sugar to make using sub-ranges<br>+/// in for loops a bit easier. Analogous to std::make_pair().<br>+template<class T> iterator_range<T> make_range(const T &x, const T &y) {<br>+  return (iterator_range<T>(x, y));<br></blockquote><br>The extra parens seem a bit... excessive?<br></div></blockquote><div><br></div><div>Fair. No idea why I put those there.</div><br><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">That was all I was going to say... but then I got bored/pedantic/something:<br><br>You could pass x and y by value and use std::move inside, since<br>iterator_range is going to take these things by value and do the same<br>thing in its actor.<br></div></blockquote><div><br></div>Sure, no real preference here. I just used const& per a quick water-cooler conversation w/ John. std::move() should give us the same optimization opportunities anywhere it matters, I think, though.</div><div><br><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">So I did that in r205993.<br></div></blockquote><div><br></div><div>Excellent, thanks!</div><br><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote type="cite">+}<br>}<br><br>#endif<br><br><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a></blockquote></div></blockquote></div><br></body></html>