<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Mar 2, 2014 at 10:41 PM, Chris Lattner <span dir="ltr"><<a href="mailto:sabre@nondot.org" target="_blank">sabre@nondot.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div class="h5"><br><div><div>On Mar 2, 2014, at 10:27 PM, Chandler Carruth <<a href="mailto:chandlerc@google.com" target="_blank">chandlerc@google.com</a>> wrote:</div>
<br><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Mar 2, 2014 at 10:13 PM, Saleem Abdulrasool <span dir="ltr"><<a href="mailto:compnerd@compnerd.org" target="_blank">compnerd@compnerd.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>On Sun, Mar 2, 2014 at 9:26 PM, Chris Lattner <span dir="ltr"><<a href="mailto:sabre@nondot.org" target="_blank">sabre@nondot.org</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><br>
On Mar 2, 2014, at 8:53 PM, Renato Golin <<a href="mailto:renato.golin@linaro.org" target="_blank">renato.golin@linaro.org</a>> wrote:<br>
<br>
> On 3 March 2014 12:32, Pete Cooper <<a href="mailto:peter_cooper@apple.com" target="_blank">peter_cooper@apple.com</a>> wrote:<br>
>> Would those work with a foreach construct? Perhaps I forgot to mention that was what I'm trying to work out here.<br>
>><br>
>> In example 3 I was wondering if we could define a method reverse(). We could use sfinae to wrap that around rbegin/rend if people like that style?<br>
><br>
> Sorry, I was too terse... ;)<br>
><br>
> If MF is a reverse_iterator, it'd just work, no? But to get the<br>
> reverse iterator, I think reverse() would be the best general pattern,<br>
> since you can adapt it to each container needs.<br>
<br>
</div>I'm not aware of the prior art or standards are here, but I think that a global reverse() adapter is the way to go. Likewise, we should have a standard "enumerate()" adaptor like python.</blockquote>
<div><br></div></div><div>I definitely prefer the global adaptor pattern. As for prior art, I had played with it a bit, and came up with <a href="https://gist.github.com/compnerd/5694186" target="_blank">https://gist.github.com/compnerd/5694186</a> a while back.</div>
</blockquote></div><br>Yea, there is a pretty strong move toward range adaptors. If possible, I'm going to work on contributing a basic selection of them to LLVM's ADT specifically to address the immediate needs of range-based for loops.</div>
</div>
</blockquote></div><br></div></div><div>Sounds good. We also have to decide what to do with Function::arg_begin() for example (and all the other secondary ranges hanging off IR and other things). IMO, "for (auto &arg : F.getArguments())" makes the most sense.</div>
</div></blockquote><div><br></div><div>I was actually going to check in this, but I can post it for review if folks are worried.</div><div><br></div><div>My plan was to provide an implementation of std::iterator_range<T> and then provide 'F.arguments()' which returns it.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><span class="HOEnZb"><font color="#888888"><div><br></div><div>-Chris</div>
</font></span></div></blockquote></div><br></div></div>