Whats the best approach to a fast
generic data type in C++. I have an event system that needs to be able to pass event information around the program.
sendEvent(123, "a String", aFloat, aVec3, etc); // sendEvent(EventID, EventArg, EventArg ...);
eventData.at(0).asFloat();
eventData.at(1).asInt(); // etc.
Until now I only needed float/int/ptr, and I handled this inside a union. but now I've got a few most structures and this is becoming a little more complex, so I'm revisiting it.
I had a dig through boost::any
but this is too slow, there could be alot of data flying around, but this idea seems like the right direction.
I had a rather naive shot with using void* data hold but that got very ugly quickly.