To accept a functor as a parameter, when should you:
-
accept a
std::function, which adds an indirection, vs. -
make your function a
template<class Func>and accept aFunc, which can bind directly to whatever is passed?
std::function vs template
Thanks to C++11 we received the
std::functionfamily of functor wrappers. Unfortunately, I keep hearing [...] that they are horribly slow. [... Is the right recommendation] thatfunctions can be used as de facto standard of passing functors, and in places where high performance is expected templates should be used?

Add a Comment
Comments are closed.