Why are all ValueTree::Listener functions pure virtual?


#1

As the title says :wink:
I’m asking this because I usually need to override just a function and I end up with copying and pasting a lot of code.
Thanks for reading!


#2

It’s because I figured it’d be too easy to forget to implement (or mis-type the name of) an important method if you weren’t forced to do them all. It has saved me from subtle bugs at least a couple of times, so a bit of extra typing is a small price to pay.

And TBH I like the fact that wherever you have a listener, you always have a list of all the possible events: it makes you more aware of everything that you might need to deal with.


#3

Alright! Thank you for the fast answer.