Suppose I have a class handler with some subclasses, such as a handler, SomeTypeHandler, AnotherTypeHandler. The class handler defines the descriptor method as a common interface for all subclasses. The logic of "process", of course, is completely different for different handlers.
So what I need to do is pass the value of any descriptor method. Certain classes can then drop "whatever" to the type they expect.
Basically what I need is something like a Java Object: D class
The first thing I tried was void*
, but apparently you can't do B* someB = dynamic_cast<B*>(theVoidPointer)
, so you're out of luck.
My second idea was to use boost::any
. however, the requirement to use boost :: any is that the value should be copied, but this does not apply to my data.
Any ideas to make this work?
thanks
EDIT: Notice that I know that I can use the SomeData class without any members, and let my data be subclasses of this, but I'm looking for a more general approach that does not require me to create my own wrapper class.
source share