Tidy reverse range-based for?

Anybody here have a neat solution for iterating an OwnedArray and Array in reverse via range-based for loops?

Looks like Boost provides boost::adaptors::reverse, but we’re not using Boost…

And just thinking out loud - I believe this would require OwnedArray and Array to provide rbegin and rend.

I think you could write your own iterator wrapping class that generates the required (modified) begin() and end(), but it’s not particularly simple.

Don’t think you need boost any more.

You can probably modify this to make yourself a little wrapper.


Indeed, I did search StackOverflow first. That’s where I realised Boost provided something to reverse iterate using range-based for, but JUCE does not.