I have a huge set of small objects that work differently, but with a common interface.
They have to stay in the same container.
I cannot use templates, because I need run-time polymorphism.
Run time efficiency is critical
Can anybody tell me which of these options is the most efficient one (in both time and space)?
- switch
- virtual functions
- function objects:
class C {
// interface...
FO *kernel; // function object
};
vector<C> vc; // this one...
vector<C*> vpc; // ...or this one
- Any other option?
Thanks a lot!