<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="">Seems the GCC bots don’t like this at all.  They fail in overload resolution even though clang accepts what I did.  The log is <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__lab.llvm.org-3A8011_builders_clang-2Dcmake-2Dthumbv7-2Da15_builds_4582_steps_build-2520stage-25201_logs_stdio&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=SzID_ckfG6-WZ-bPa87v7jTQk-eXwrgt0jxn1IhTV9Y&s=YkjpZ5fu12kDYf3zD7WH1jNRNrGi79khns7ao5UDckA&e=" class="">http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15/builds/4582/steps/build%20stage%201/logs/stdio</a>.<div class=""><br class=""></div><div class="">I’ve reverted in r243567 until we can do something with enable_if.</div><div class=""><br class=""></div><div class="">Pete<br class=""><div><blockquote type="cite" class=""><div class="">On Jul 29, 2015, at 1:22 PM, Pete Cooper <<a href="mailto:peter_cooper@apple.com" class="">peter_cooper@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div 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=""><blockquote type="cite" class=""><div class=""><br class="Apple-interchange-newline">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 class="" 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="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 class="" style="word-wrap: break-word;"><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 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=""><br class=""></div><div 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="">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 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=""><br class=""></div><div 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="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(144, 45, 208);">/// \brief Metafunction to determine if type T has a member called getDecl.</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);">template<span class="" style=""><span class="Apple-converted-space"> </span><</span>typename<span class="" style=""><span class="Apple-converted-space"> </span>T><span class="Apple-converted-space"> </span></span>struct<span class="" style=""><span class="Apple-converted-space"> </span>has_getDecl {</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> <span class="Apple-converted-space"> </span><span class="" style="color: rgb(187, 44, 162);">struct</span><span class="Apple-converted-space"> </span>Default {<span class="Apple-converted-space"> </span><span class="" style="color: rgb(187, 44, 162);">int</span><span class="Apple-converted-space"> </span>getDecl; };</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> <span class="Apple-converted-space"> </span><span class="" style="color: rgb(187, 44, 162);">struct</span><span class="Apple-converted-space"> </span>Derived : T,<span class="Apple-converted-space"> </span><span class="" style="color: rgb(79, 129, 135);">Default</span><span class="Apple-converted-space"> </span>{ };</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"><br class=""></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);"><span class="" style=""> <span class="Apple-converted-space"> </span></span>template<span class="" style=""><</span>typename<span class="" style=""><span class="Apple-converted-space"> </span>C, C><span class="Apple-converted-space"> </span></span>struct<span class="" style=""><span class="Apple-converted-space"> </span>CheckT;</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"><br class=""></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);"><span class="" style=""> <span class="Apple-converted-space"> </span></span>// If T::getDecl exists, an ambiguity arises and CheckT will</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);"><span class="" style=""> <span class="Apple-converted-space"> </span></span>// not be instantiable. This makes f(...) the only available</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);"><span class="" style=""> <span class="Apple-converted-space"> </span></span>// overload.</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);"><span class="" style=""> <span class="Apple-converted-space"> </span></span>template<span class="" style=""><</span>typename<span class="" style=""><span class="Apple-converted-space"> </span>C></span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> <span class="Apple-converted-space"> </span><span class="" style="color: rgb(187, 44, 162);">static</span><span class="Apple-converted-space"> </span><span class="" style="color: rgb(187, 44, 162);">char</span><span class="Apple-converted-space"> </span>(&f(CheckT<<span class="" style="color: rgb(187, 44, 162);">int</span><span class="Apple-converted-space"> </span>Default::*, &C::getDecl>*))[<span class="" style="color: rgb(39, 42, 216);">1</span>];</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);"><span class="" style=""> <span class="Apple-converted-space"> </span></span>template<span class="" style=""><</span>typename<span class="" style=""><span class="Apple-converted-space"> </span>C><span class="Apple-converted-space"> </span></span>static<span class="" style=""><span class="Apple-converted-space"> </span></span>char<span class="" style=""><span class="Apple-converted-space"> </span>(&f(...))[</span><span class="" style="color: rgb(39, 42, 216);">2</span><span class="" style="">];</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"><br class=""></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);"><span class="" style=""> <span class="Apple-converted-space"> </span></span>static<span class="" style=""><span class="Apple-converted-space"> </span></span>bool<span class="" style=""><span class="Apple-converted-space"> </span></span>const<span class="" style=""><span class="Apple-converted-space"> </span>value =<span class="Apple-converted-space"> </span></span>sizeof<span class="" style="">(f<</span><span class="" style="color: rgb(79, 129, 135);">Derived</span><span class="" style="">>(</span>nullptr<span class="" style="">)) ==<span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(39, 42, 216);">2</span><span class="" style="">;</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">};</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><br class=""></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><div class="" style="margin: 0px; line-height: normal; color: rgb(187, 44, 162);"><span class="" style="">  </span>template<span class="" style=""><span class="Apple-converted-space"> </span><</span>typename<span class="" style=""><span class="Apple-converted-space"> </span>U></span></div><div class="" style="margin: 0px; line-height: normal;"> <span class="Apple-converted-space"> </span><span class="" style="color: rgb(187, 44, 162);">bool</span><span class="Apple-converted-space"> </span>matchesSpecialized(</div><div class="" style="margin: 0px; line-height: normal;">     <span class="Apple-converted-space"> </span><span class="" style="color: rgb(187, 44, 162);">const</span><span class="Apple-converted-space"> </span>U &Node,<span class="Apple-converted-space"> </span><span class="" style="color: rgb(79, 129, 135);">ASTMatchFinder</span><span class="Apple-converted-space"> </span>*Finder,<span class="Apple-converted-space"> </span><span class="" style="color: rgb(79, 129, 135);">BoundNodesTreeBuilder</span><span class="Apple-converted-space"> </span>*Builder,</div><div class="" style="margin: 0px; line-height: normal;">     <span class="Apple-converted-space"> </span><span class="" style="color: rgb(187, 44, 162);">typename</span><span class="Apple-converted-space"> </span><span class="" style="color: rgb(112, 61, 170);">std</span>::<span class="" style="color: rgb(112, 61, 170);">enable_if</span><<span class="" style="color: rgb(79, 129, 135);">has_getDecl</span><U>::value,<span class="Apple-converted-space"> </span><span class="" style="color: rgb(187, 44, 162);">int</span>>::type =<span class="Apple-converted-space"> </span><span class="" style="color: rgb(39, 42, 216);">0</span>)<span class="Apple-converted-space"> </span><span class="" style="color: rgb(187, 44, 162);">const</span><span class="Apple-converted-space"> </span>{</div><div class="" style="margin: 0px; line-height: normal;">   <span class="Apple-converted-space"> </span><span class="" style="color: rgb(187, 44, 162);">return</span><span class="Apple-converted-space"> </span><span class="" style="color: rgb(49, 89, 93);">matchesDecl</span>(Node.getDecl(), Finder, Builder);</div><div class="" style="margin: 0px; line-height: normal;">  }</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 class="" style="word-wrap: break-word;"><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 class="" style="word-wrap: break-word;">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 class="" style="word-wrap: break-word;"><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 class="" style="word-wrap: break-word;"><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 class="" style="word-wrap: break-word;"><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 class="" style="word-wrap: break-word;">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 class="" style="word-wrap: break-word;"><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 class="" 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;"><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 class="" 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;"><br class=""></div><div class="" 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;">Updated patch included.</div><div class="" 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;"><br class=""></div><div class="" 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;">Cheers,</div><div class="" 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;">Pete</div><div class="" 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;"><br class=""></div><div class="" 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;"></div><span class=""><reverse.patch></span><div class="" 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;"><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 class="" style="word-wrap: break-word;">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 class="" style="word-wrap: break-word;"><div class=""></div></div><br class=""></blockquote></div><br class=""></div></div></blockquote></div><br class="" 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;"><span class="" 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;">_______________________________________________</span><br class="" 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;"><span class="" 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;">llvm-commits mailing list</span><br class="" 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;"><a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank" class="" 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;">llvm-commits@cs.uiuc.edu</a><br class="" 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;"><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank" class="" 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;">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="" 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;"><span 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; 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; 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=""><span 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; 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; 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=""><a href="mailto:llvm-commits@cs.uiuc.edu" 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="">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; 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=""><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" 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="">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a></div></blockquote></div><br class=""></div></body></html>