How (if possible) to use ranges-v3 for ValueTree child traversal

#1

Hi there,

I’ve recently started converting all loops to the ranges-v3 versions where possible finding it greatly reducing code lines. I was wondering if it was possible to use with ValueTrees especially in piping.

As far as I can tell, the default methods do not work:

using rv = ranges::view;
for (auto i : valueTree | rv::reverse)  { // Static error: valueTree not pipeable
}
// converting to range view also doesn't work
for (auto i : rv::all(valueTree) | rv::reverse) { // Same error as above
}
ranges::find(valueTree, someChildTree); // "std::"-like range methods  don't seem to work either.

If this requires JUCE team to get involved then I guess I’d like to submit this as a feature request (sooner than C++ 20 if it’s easy :slight_smile: ).

0 Likes