id summary reporter owner description type status milestone component version severity resolution keywords cc 1067 Function needs to use pass-by-reference internally Douglas Gregor Douglas Gregor "Boost.Function uses pass-by-value internally for the function object. While it is unspecified how many times the function object would be copied, we should still minimize this amount. The following code snippet illustrates how many copy constructions are performed. struct Functor { Functor(void) { std::cout << ""Functor constructor ("" << this << ')' << std::endl; } Functor(const Functor&) { std::cout << ""Functor copy constructor ("" << this << ')' << std::endl; } ~Functor(void) { std::cout << ""Functor destructor ("" << this << ')' << std::endl; } void operator()(void) const { std::cout << ""Hello world!"" << std::endl; } std::string memfunc(void) const { return std::string(""hello world!!!!!!""); } }; int main(void) { Functor func; boost::function0 f(func); return 0; }" Bugs closed Boost 1.35.0 function Boost 1.34.0 Optimization fixed