<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 29, 2015, at 1:16 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><br class="Apple-interchange-newline"><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: 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;" class=""><div class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: 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 Wed, Jul 29, 2015 at 1:04 PM, Pete Cooper<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:peter_cooper@apple.com" target="_blank" class="">peter_cooper@apple.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><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;" class=""><br class=""><div class=""><span class=""><blockquote type="cite" class=""><div class="">On Jul 28, 2015, at 8:40 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank" class="">dblaikie@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="">Oh, a couple of things - drop the 'inline' from the templates. That's just a hint to "inline harder" & usually isn't (shouldn't be) necessary. The implicit template specializations that come from the template will have the right linkonce_odr linkage & such that they'll be fine as-is.<br class=""></div></div></blockquote></span>Good point. Done.<span class=""><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><br class="">Also: probably not worth using auto/->decltype in make_reverse_iterator, I don't think? Looks like it'd be shorter to just write the return type in the usual/old way?<br class=""></div></div></blockquote></span>Yeah, also done.<span class=""><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><br class="">Oh, and you took the container by const ref in the rbegin/rend case, and non-const ref in the begin/end case - that seems strangely inconsistent?<br class=""></div></div></blockquote></span>Yeah, that was a mistake on my part. Fixed.</div><div class=""><span class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><br class="">I think /maybe/ you can take by rvalue ref and it'll do the right thing for const and non-const (would be good to test that - the current code should break for a const container that only has rbegin/rend, I think?)</div></div></blockquote></span>So i’ve managed to add an rvalue reference to the begin/end case, but I couldn’t add it to both as it turns out the const was contributing to overload resolution.</div></div></blockquote><div class=""><br class=""></div><div class="">This is probably where we need explicit SFINAE to make the begin/end version go away when the rbegin/rend version will kick in. I'll check the test cases & see what's missing/avoided/not working because of this absence.</div></div></div></blockquote>Thanks!</div><div><br class=""></div><div>So i found this in clang. I think we just need something similar, with appropriate enable_if on existence or not. What do you think?</div><div><br class=""></div><div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(144, 45, 208);" class="">/// \brief Metafunction to determine if type T has a member called getDecl.</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class="">template<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> <</span>typename<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> T> </span>struct<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> has_getDecl {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">struct</span> Default { <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">int</span> getDecl; };</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">struct</span> Derived : T, <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Default</span> { };</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span>template<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""><</span>typename<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> C, C> </span>struct<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> CheckT;</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span>// If T::getDecl exists, an ambiguity arises and CheckT will</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span>// not be instantiable. This makes f(...) the only available</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span>// overload.</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span>template<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""><</span>typename<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> C></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">static</span> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">char</span> (&f(CheckT<<span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">int</span> Default::*, &C::getDecl>*))[<span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">1</span>];</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span>template<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""><</span>typename<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> C> </span>static<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span>char<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> (&f(...))[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">2</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">];</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span>static<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span>bool<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span>const<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> value = </span>sizeof<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(f<</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Derived</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">>(</span>nullptr<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">)) == </span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">2</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">;</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">};</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><div style="margin: 0px; line-height: normal; color: rgb(187, 44, 162);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span>template<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> <</span>typename<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> U></span></div><div style="margin: 0px; line-height: normal;" class=""> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">bool</span> matchesSpecialized(</div><div style="margin: 0px; line-height: normal;" class=""> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">const</span> U &Node, <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ASTMatchFinder</span> *Finder, <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">BoundNodesTreeBuilder</span> *Builder,</div><div style="margin: 0px; line-height: normal;" class=""> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">typename</span> <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">std</span>::<span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">enable_if</span><<span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">has_getDecl</span><U>::value, <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">int</span>>::type = <span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0</span>) <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">const</span> {</div><div style="margin: 0px; line-height: normal;" class=""> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">return</span> <span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">matchesDecl</span>(Node.getDecl(), Finder, Builder);</div><div style="margin: 0px; line-height: normal;" class=""> }</div></div><blockquote type="cite" class=""><div class=""><div class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: 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;"><div class=""> </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;" class=""><div class=""> My thinking for what we have now is that we are more likely to try call reverse on something like an iterator_range which only provides begin/end so it makes sense to put a preference on that one for the case where the source is a temporary rvalue.</div><div class=""><br class=""></div><div class="">If you aren’t happy with that choice, please let me know.</div><div class=""><br class=""></div><div class="">Anyway, committed with the LGTM as r243563. Thanks for all the help on this.</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Pete<div class=""><div class="h5"><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Jul 28, 2015 at 8:33 PM, David Blaikie<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:dblaikie@gmail.com" target="_blank" class="">dblaikie@gmail.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><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 dir="ltr" class="">LGTM, please commit.<br class=""><br class="">One question for Richard Smith or someone else standards-y would be:<br class=""><br class="">What's the right way to call non-member begin/end?<br class=""><br class="">Should it be called unqualified, with a "using std::begin/end" like when we call std::swap? In which case, should we have some utility wrappers for this so it's easy to call in arbitrary contexts (llvm::adl_begin/end)?<br class=""></div><div class="gmail_extra"><br class=""><div class="gmail_quote"><div class=""><div class="">On Tue, Jul 28, 2015 at 5:56 PM, Pete Cooper<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:peter_cooper@apple.com" target="_blank" class="">peter_cooper@apple.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""></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 class=""><div class=""><div style="word-wrap: break-word;" class="">New patch attached.<div class=""><br class=""></div><div class="">I added the make_reverse_iterator method which definitely simplifies that version of reverse.</div><div class=""><br class=""></div><div class="">The unit test has also been updated to use the template mechanism (very cool btw!). I had to keep 2 of the vector types i’d defined (to restrict whether they had begin() or begin() or both), but removed the const iterators and push_back. They have a constructor from std::initializer_list so that I can share the test case with all the container types.</div><span class=""><font color="#888888" class=""><div class=""><br class=""></div><div class="">Pete</div><div class=""><br class=""></div><div class=""></div></font></span></div><br class=""></div></div><div class=""><div class=""><div style="word-wrap: break-word;" class=""><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jul 28, 2015, at 5:27 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank" class="">dblaikie@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Jul 28, 2015 at 5:22 PM, Pete Cooper<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:peter_cooper@apple.com" target="_blank" class="">peter_cooper@apple.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><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;" class=""><br class=""><div class=""><span class=""><blockquote type="cite" class=""><div class="">On Jul 28, 2015, at 5:13 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank" class="">dblaikie@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="">I'd probably skip the pointer case and let callers dereference the pointer. I think that keeps the code a bit more obvious - avoids any weirdness/confusion around arrays of collections, etc (did this decay to a pointer then dereference that pointer and iterate the sub-collection, or what?)<br class=""></div></div></blockquote></span>Good point. Will remove it.<span class=""><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><br class="">It might be easier to read the tests if the classes were interleaved with the test cases rather than "class A B C, test A B C”?<br class=""></div></div></blockquote></span>I can do that, depending of course on how much of the simplification you mention merits even keeping the Vector classes at all.<span class=""><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><br class="">The generalized case might be easier to read if we had a make_reverse_iterator to avoid the whole (decltype*2, std::end*2, std::begin*2)*2, etc?<br class=""></div></div></blockquote></span>Good idea. Will give that a try.<span class=""><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><br class="">Could the test classes be made smaller/simpler? They don't need to be real collections - or if they are, perhaps we should just use real collections in those cases. (at least for the easy cases - eg: skip BidirectionalVector and just use std::vector directly, the other two probably at least don't need const/non-const overloads (doesn't seem like you're testing the const case and I'm not sure it would add much value to do so - but could consider it (maybe templated in some way to reduce duplication?)) - and perhaps just expose the vector rather than having push_back, given these are brief utilities (could have these containers constructed from the underlying container directly - so you populate that, then just create a wrapper)). gunit has a fancy test system that allows you to write one test as a template then run it with a set of types to instantiate the template with - that might apply here, but I'm not sure.<br class=""></div></div></blockquote></span>I might need to keep the Bidirectional one just to ensure that we prefer rbegin() over reverse_iterator(begin()). But otherwise i think you’re right about simplifying them.</div><div class=""><br class=""></div><div class="">I took a look at the standard library to see if any of the types there can only be iterated backwards.<span class="Apple-converted-space"> </span></div></div></blockquote><div class=""><br class="">Yeah, I'd be surprised (if anywhere, I'd check std::forward_list - but I guess that only goes forwards, not backwards) - I would imagine anything that had only one iteration order would define that order to be forwards.<br class=""><br class="">So yeah, a thin adapter that just has a member vector, perhaps, and rbegin/rend - or something similarly simple.<br class=""> </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;" class=""><div class=""> Thought perhaps queue or stack would only have rbegin() then i could use them instead of vector. Unfortunately they are only protocols which use list and vector as their default implementations.<div class=""><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><br class=""><br class=""></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Jul 28, 2015 at 3:35 PM, Pete Cooper<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:peter_cooper@apple.com" target="_blank" class="">peter_cooper@apple.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><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;" class="">Once more update. Seems I hadn’t handled pointers. Added a variant which takes a pointer to a container and calls ->rbegin() and ->rend().<div class=""><br class=""></div><div class=""></div></div><br class=""><div style="word-wrap: break-word;" class=""><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jul 28, 2015, at 10:19 AM, Pete Cooper <<a href="mailto:peter_cooper@apple.com" target="_blank" class="">peter_cooper@apple.com</a>> wrote:</div><br class=""><div class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><blockquote type="cite" class=""><div class=""><br class="">On Jul 28, 2015, at 9:59 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank" class="">dblaikie@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="">I'm OK calling it 'reverse' as you have (since it has just the one argument it shouldn't be ambiguous with the iterator versions)<br class=""><br class="">* These functions shouldn't be ‘static’</div></div></blockquote>Good point. Made them inline like the other methods in the same file.<br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class="">* Could you try using non-member begin/end in the second version - that should allow it to work with arrays. Give it a go/add a test?<br class=""></div></div></blockquote>Done. Added a test for this too.<br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class="">* Maybe test the case where a container has rbegin/rend and begin/end to ensure we still favor the rbegin/rend (and that it's not ambiguous?) - presumably they're more efficient, if they're provided?<br class=""></div></div></blockquote>Added a test for this too. I left begin(), end() without method bodies so that if they were called we’d get linker errors.<br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><br class="">& the reason you don't need explicit SFINAE is because you put the interesting expressions in the return type - so they're part of the SFINAE condition already, conveniently.<br class=""></div></div></blockquote>Makes sense. Thanks for the explanation.<br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><br class="">I think Saleem (cc'd) had an existing implementation of something like this that he might be willing to provide some insight from?<br class=""></div></div></blockquote>Cool. Happy to see his implementation too, and to take whichever suits.</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class="">Updated patch included.</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class="">Cheers,</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class="">Pete</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""></div><span class=""><reverse.patch></span><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Jul 28, 2015 at 9:43 AM, Pete Cooper<span class=""> </span><span dir="ltr" class=""><<a href="mailto:peter_cooper@apple.com" target="_blank" class="">peter_cooper@apple.com</a>></span><span class=""> </span>wrote:<br class=""><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;" class="">Hi David<div class=""><br class=""></div><div class="">Please find attached a patch for a reverse range adapter. Its based on feedback you gave in <a href="http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20150720/289410.html" target="_blank" class="">http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20150720/289410.html</a>.</div><div class=""><br class=""></div><div class="">There are 2 versions. The first uses rbegin()/rend(), the second constructs std::reverse_iterators around begin()/end().</div><div class=""><br class=""></div><div class="">I was surprised to find I didn’t need enable_if or any other such tricks.</div><div class=""><br class=""></div><div class="">I’ve updated a single use of the pattern ‘for auto x : make_range(rbegin(), rend())’ to the new reverse method.</div><div class=""><br class=""></div><div class="">I was considering reverse_range instead as a name to avoid confusion with std::reverse. I’d prefer to not do make_reverse_range just to save on characters.</div><div class=""><br class=""></div><div class="">Feedback welcome.</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Pete</div><div class=""><br class=""></div><div class=""></div></div><br class=""><div style="word-wrap: break-word;" class=""><div class=""></div></div><br class=""></blockquote></div><br class=""></div></div></blockquote></div><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; float: none; display: inline !important;" class="">llvm-commits mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class="">llvm-commits@cs.uiuc.edu</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a></div></blockquote></div></div></div></blockquote></div></div></div></blockquote></div></div></div></div></blockquote></div></div></div></div></blockquote></div></div></div></div></div></blockquote></div></div></blockquote></div></div></div></blockquote></div></div></div></div></blockquote></div></div></blockquote></div><br class=""></body></html>