<div dir="ltr">Using the code snippet below as an example,...<br><br>#include &lt;vector&gt;<br>#include &lt;algorithm&gt;<br>#include &lt;functional&gt;<br>#include &quot;boost/lambda/lambda.hpp&quot;<br>#include &quot;boost/lambda/bind.hpp&quot;<br>
#include &lt;boost/function.hpp&gt;<br><br>struct S { int methodOfS( ); };<br><br>int main( )<br>{<br>&nbsp; typedef std :: vector&lt;S *&gt; Vec;<br>&nbsp; using namespace boost :: lambda;<br><br>&nbsp; boost :: function&lt;int( S * )&gt; fn = bind( &amp; S :: methodOfS, _1 );<br>
&nbsp; Vec v;<br>&nbsp; Vec :: iterator match;<br><br>&nbsp; match = find_if( v.begin( ), v.end( ), bind( fn, _1 ) != fn( * v.begin( ) ) ); // OK<br><br>&nbsp; match = find_if( v.begin( ), v.end( ), fn( _1 ) != fn( * v.begin( ) ) ); // Fail<br>
}<br><br clear="all">I find the line marked &#39;OK&#39; compiles, but not the line marked &#39;Fail&#39;. Isn&#39;t the<br>very point of Boost.Bind to enable this kind of syntax? Is there a better<br>way to write it than my &#39;Fail&#39; line, but which will still compile?<br>
<br>Thanks, Rob.<br>-- <br>ACCU - Professionalism in programming - <a href="http://www.accu.org">http://www.accu.org</a>
</div>