
11 Mar
2012
11 Mar
'12
7:56 a.m.
I tried to create a template function that receives boost::function as parameter. Say like this: template <typename T1, typename T2> void proc(const boost::function<void(const T1&, T2&)> &p) { // ... } void f(const string& s1, string&s2) { // ... } Everything goes ok when I called proc( boost::function<void(const string&, string&)>(f) ). But when I try this: proc(boost::bind(f, _1, _2)); The compiler refused with the error: no matching function for call to ‘proc(boost::_bi::bind_t<boost::_bi::unspecified, F, boost::_bi::list2<boost::arg<1>, boost::arg<2> > >)’ Anyway to fulfill this design purpose? Thanks.