This works fine for me with GCC4.5:
#include <boost/bind.hpp> #include <boost/function.hpp> int main() { boost::function<void(bool)> fncPtr(boost::bind<void>([](bool){/* something */}, _1)); }
It does not need a parameter type. These types of parameters can be templates in any case (for some functors), therefore, in general, it cannot depend on them. He needs only a return type.
By the way, this even works for me when I go through <void, bool> , but only when lambdas don't have captures. I think this might work for me, because GCC4.5 supports lambdas conversion to work with pointer types when lambdas does not have a capture condition. <void, bool> will do a bind on the candidate, which will take a pointer to a function, and do a lambda conversion to this. Your compiler apparently does not yet support this special conversion (but this requires FDIS).
So, just go through only <void> and it should work.
source share