Perhaps this is a safe type hole in the conversion of the bind â function. boost :: bind does not return std :: function, but a function object is of a very complex type. When
boost::bind(&A::boo,a,_1);
as shown above, the return object is of type
boost::_bi::bind_t< int, boost::_mfi::mf1<int,A,int>, boost::_bi::list2<boost::_bi::value<A*>, boost::arg<1> > >
std :: function only checks that the supplied function object is "compatible", in this case, whether it is callable with int as the first argument and a pointer to char as the second argument. After examining the * boost :: bind_t * template, we see that it really has the corresponding function call operator:
template<class A1, class A2> result_type operator()(A1 & a1, A2 & a2)
Inside this function, the second argument ends with a silent drop. This is by design. From the documentation: Any additional arguments are silently ignored (...)
source share