I am developing a framework to simplify creation of embedded software applications.
Resources are typically limited in this type of environment, so I need to make it very efficient in its use of memory space.
One goal is to be able to reference any variable by a <typeNumber, instanceNumber> value pair.
I have no problem creating objects that support an abstract list of instances of any given type.
I can successfully use operator to access any instance with its type-specific behavior.
I can likewise make an abstract list of of those objects that support type instance lists.
However, it is is a 2-step process to access the data and its type-specific behavior.
It seems that whatever I try, I ultimately come to a single function call that must return any type. It seems that C++ does not support this.
I suspect that RTTI might solve my problem, but I am trying to avoid using it, because I'd like my framework to work in systems that do not support it. (Actually, some say they support RTTI, but do not support exception handling, which RTTI uses.)
I'd also like to avoid any type of hard-coded switch block with fixed type-casting because I'd like to be able to add types to the list dynamically
Can anyone suggest an alternative?