I'm in the process of implementing a platform independent wrapper for dynamically loaded libraries. Of course when I load functions from the libraries I need to store them as pointers for future use. I thought of using boost::function's for that instead of normal function pointers. Sure, that will increase compile time, but that's not what I am afraid of. Rather:
What is the overhead introduced by boost::function when calling the stored function? Is there one? How big is it?
I guess I won't have much overhead when calling such functions from time to time, however, how about functions that get called a lot? (extreme example, glVertex
on a loaded GL library). How much would it hurt performance?
Source-diving boost didn't answer much :>.
Also if it's compiler dependant, I'm mainly interested in GCC and MSVC.