G
glen stark
I have a templated function
template<class T> void update_E(T& updateable)
{
....
}
What I would like to do is store a vector of updateable objects, and for
each of them call the update function. What and how many updateable
objects area actually created is determined at runtime.
Using polymorphism I would make an interface iUpdateable, and a bunch of
subclasses, and store a vector of iUpdateable pointers.
Somehow this seems klunky to me, and I'm wondering if there's a
cleverer way of doing this. I don't need polymorphis or inheritance
except to allow storage of multiple types. I've heard of something
called "static polymorphism". Would that apply here?
This will be called many times in a loop, so if I can avoid rtti that
would be ideal, and worth some hassle.
Thanks,
Glen
template<class T> void update_E(T& updateable)
{
....
}
What I would like to do is store a vector of updateable objects, and for
each of them call the update function. What and how many updateable
objects area actually created is determined at runtime.
Using polymorphism I would make an interface iUpdateable, and a bunch of
subclasses, and store a vector of iUpdateable pointers.
Somehow this seems klunky to me, and I'm wondering if there's a
cleverer way of doing this. I don't need polymorphis or inheritance
except to allow storage of multiple types. I've heard of something
called "static polymorphism". Would that apply here?
This will be called many times in a loop, so if I can avoid rtti that
would be ideal, and worth some hassle.
Thanks,
Glen