RefCountedPointer Objects


I just changed a nasty class I had to a base class and subs. But now I can’t find the syntax to cast the class back to a sub-class and call a method.

I have this: ‘MeshFrameBase::Ptr deliveredFrame’ and need to call the getPixelBuffer() method of a specific sub-class (that base class doesn’t have, it’s platform specific).

I can’t do:

Or any variations, or any kind of constructor I can think of. Am I a bit outside the box here, or is there some C++ Kung Fu I can use?



OK, the only way I could find was this:

[code] MeshFrameBase* bsFrame = deliveredFrame;
MeshFrameCVPixelBufferRef* sourceFrame = dynamic_cast<MeshFrameCVPixelBufferRef*>(bsFrame);


Is that about the size of it? Anything nicer?



What about :

After all, the template Ptr will return a MeshFrameBase* if you use the MeshFrameBase* cast operator, and then, it’s standard dynamic casting.


Yeah, that got it, thanks.