Perhaps the topic of std::bind
and std::function
is not clear enough to me - then, please, clarify. I'm trying to implement a thread pool (like this), but to avoid std::function
and std::bind
performance penalty due to heap allocations for the asynchronous function parameters stored somewhere in std::function
or std::bind
. Here they explain how to provide a custom allocator to std::function
. However, as I understand, custom allocator (for performance) should be provided to std::bind
too. If not, then why? If yes, how?
EDIT1: if that matters, the custom allocator is going to allocate from a memory pool.
EDIT2: the compiler is MSVC++2017, so C++11/14/17 should (partially) work.