So, iiuc, copying a
ValueTree means that the copy will refer to the same underlying data as the original
ValueTree, but it will have no listeners (so the original
ValueTree's listeners are not copied). That’s maybe a bit unintuitive at first, but OK – it’s a useful property.
But here’s something really confusing: what are the move semantics of a
ValueTree? If I move-from a
ValueTree, will the new tree also have no listeners? I can’t figure that out by looking at the JUCE code.
This is crucial because I have a class – let’s call it
Widget – that has an internal
ValueTree member, and is listening to that. (for example,
CachedValue is doing the same thing, I think it’s a reasonably common pattern).
Now I need to have a
Widget needs to have a non-throwing move constructor.
How do I correctly implement this for
Widget, without producing
Widgets that are broken because they don’t listen to their internal
ValueTree anymore? (I noticed that
CachedValue has an implicitly declared move constructor, isn’t that broken, too?)
Note also that
noexcept, therefore it can’t be used in a move constructor.