I agree with this, but to help with a comprehensive answer to the OP’s question, I’d add that there are cases where ValueTree& does make sense.
I had been following that advice from the docs that you quoted, to:
Create ValueTree objects on the stack, and don’t be afraid to copy them around…
But then I got tripped up in a case where I had two classes, each with a ValueTree member, where I had set them to share data via a simple assignment by value (e.g.
valueTreeA = valueTreeB). Then I wanted to change the ValueTree reference from within one of the classes to a different ValueTree –– and (with fuzzy thinking) assumed that the ValueTree in the other class would follow that changed reference too. Nope.
For that, you need one of the classes’
ValueTree members to instead be a
ValueTree&, and then of course set that reference in the initializer list.