#include &lt;iostream&gt;<br>#include &lt;boost/bind.hpp&gt;<br>#include &lt;boost/function.hpp&gt;<br><br>class test1<br>{<br>public:<br>&nbsp;&nbsp; &nbsp;template&lt;typename S&gt;<br>&nbsp;&nbsp; &nbsp;double handle(S s)<br>&nbsp;&nbsp; &nbsp;{<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;s(1);<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;std::cout&lt;&lt;"test1\n";<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;return 1;<br>&nbsp;&nbsp; &nbsp;}<br>&nbsp;&nbsp; &nbsp;template&lt;typename F&gt;<br>&nbsp;&nbsp; &nbsp;void handle1(F f){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;boost::bind(&amp;test1::handle&lt;F&gt;,this,f)();<br>&nbsp;&nbsp;&nbsp; &nbsp; <br>&nbsp;&nbsp;&nbsp; }<br><br>};<br>class test2<br>{<br>public:<br>&nbsp;&nbsp;&nbsp; double handle(int i)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; std::cout&lt;&lt;"test2\n";<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return i;<br>&nbsp;&nbsp;&nbsp; }<br>};<br>int _tmain(int argc, _TCHAR* argv[])<br>{<br>&nbsp;&nbsp;&nbsp; test2 t2;<br>&nbsp;&nbsp;&nbsp; test1 t1;<br>&nbsp;&nbsp;&nbsp; t1.handle1(boost::bind(&amp;test2::handle,t2,_1));<br>&nbsp;&nbsp;&nbsp; return 0;<br>}<br><br>in test1::handle1 complie fail on vs2010 and gcc 4.4.1 <br>vs 2010 error:error C2664: "R boost::_mfi::mf1&lt;R,T,A1&gt;::operator ()&lt;test1&gt;(const U &amp;,A1) const": can't convert "double"to "boost::_bi::bind_t&lt;R,F,L&gt;" .<br>but boost::bind(&amp;test1::handle&lt;F&gt;,this,f)(); f is not double,f is bind_t and double only return_type.<br><br>by the way,boost::bind(&amp;test1::handle&lt;F&gt;,this,boost::ref(f))(); can work.<br>&nbsp;<div>	</div>	 <br><!-- urlfiles --><br><br><!-- footer --><br>

