<div dir="ltr">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><br>* These functions shouldn't be 'static'<br>* 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>* 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><br>& 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><br>I think Saleem (cc'd) had an existing implementation of something like this that he might be willing to provide some insight from?<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 28, 2015 at 9:43 AM, Pete Cooper <span dir="ltr"><<a href="mailto:peter_cooper@apple.com" target="_blank">peter_cooper@apple.com</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">Hi David<div><br></div><div>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">http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20150720/289410.html</a>.</div><div><br></div><div>There are 2 versions.  The first uses rbegin()/rend(), the second constructs std::reverse_iterators around begin()/end().</div><div><br></div><div>I was surprised to find I didn’t need enable_if or any other such tricks.</div><div><br></div><div>I’ve updated a single use of the pattern ‘for auto x : make_range(rbegin(), rend())’ to the new reverse method.</div><div><br></div><div>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><br></div><div>Feedback welcome.</div><div><br></div><div>Cheers,</div><div>Pete</div><div><br></div><div></div></div><br><div style="word-wrap:break-word"><div></div></div><br></blockquote></div><br></div>