I am using tbb with the intel c++ compiler (win7, msvc2010).
I am writting certain classes to be used by tbb algorithms. Typically these (algorithms) work like this:
The user provides with a class that is the body of the algorithm (say, ClassBody) to be run, and "attaches" it to the tbb algorithm.
The latter breaks up some user-provided-range over which the algorithm will run on different threads and some thread splitting policy (roughly at least,,), which however is independent of the ClassBody ( other than the user's choice at design time).
It seems to me that the compiler should be able to identify the implementation of the virtual function (lives inside the ClassBody) and early-bind (is this the right expression?) to it. In the case of a simple loop, this should be the expected behavior ( I think/hope, am I wrong ?).
Can you please confirm that there would be no performance penalty by such a design ? O/wise one would need to make the ClassBody a template which, apart from the coding complications, would result in a larger code footprint.
Thank you for your help,