I'm having some trouble working this out - how to cast a ReferenceCountedObject to a var so I can set it as a property of a ValueTree.
I have an Array of RationalNum objects called ratios. I want to pass one in (referenced by index i) as a property of a ValueTree.
I have defined RationalNum as:
class RationalNum : public ReferenceCountedObject { public: RationalNum(double value); RationalNum(int numerator, int denominator); typedef ReferenceCountedObjectPtr<RationalNum> Ptr;
I'm obviously not understanding something fundamental about this, if someone can point me to a working example would be much appreciated!
Current code (which brings up a compiler error):
RationalNum::Ptr ratioPtr (ratios.getUnchecked(i)); myNode.setProperty (myNodeType, dynamic_cast <RationalNum*> (ratioPtr), nullptr);
Since I am introducing ValueTrees into my project I am considering moving the ratio values out of the RationalNum class altogether and storing them as a ValueTree instead.
Thanks