Why does bind have overhead?

I've read that bind can have significant overhead unless your parameters are small (because then it can use the small buffer optimization). But why does it have anymore overhead than copying the parameters and assigning a function pointer? I suspect support for something (maybe member function pointers + multiple inheritance?) is responsible but I'm not sure what. I tried looking through bind.hpp but trying to figure out what it's actually doing amongst all the compiler workarounds and different parameter versions it's difficult to tell what's going on.

AMDG Joseph Garvin wrote:
I've read that bind can have significant overhead unless your parameters are small (because then it can use the small buffer optimization).
I think that you're confusing bind with function. bind doesn't do any dynamic memory allocation, so the small buffer optimization doesn't make sense for it.
But why does it have anymore overhead than copying the parameters and assigning a function pointer? I suspect support for something (maybe member function pointers + multiple inheritance?) is responsible but I'm not sure what. I tried looking through bind.hpp but trying to figure out what it's actually doing amongst all the compiler workarounds and different parameter versions it's difficult to tell what's going on.
In Christ, Steven Watanabe
participants (2)
-
Joseph Garvin
-
Steven Watanabe