OONumerics User : |
From: Hari Sundar (hsundar_at_[hidden])
Date: 2006-03-26 22:53:27
Hi,
I implemented a simple dynamic polymorphism scheme that because of the cost
involved with virtual function calls makes my code very slow ...
Conceptually I have a function within my parent class like this ...
for (int i=0; i<BIG_N; i++) {
// some init
// call virtual function ...
this->func(in, out);
}
the body of func() is different for diff derived classes. I want to change
this to static polymorphism to increase the efficiency of my code. I could
template the parent class on the function func() for the different classes,
but the problem is that func requires access to a number of member variables
of the parent class and I am not sure whether passing a number of arguments
(most of them pointers) is the best way to do this.
Do people have any experience with this kind of stuff ? what would be the
best way to do something like this ... where the data is stored within the
parent class and the derived classes are mainly providing different
functions that process this data differently.
thanks,
~Hari