On Tue, Apr 5, 2011 at 2:27 PM, Peter Dimov <pdimov@pdimov.com> wrote:

  using boost::lambda::bind;

should be a better choice.


Hello Peter

Yes, that was my first thought too. But this code still has ambiguity issues.

#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
#include <boost/function.hpp>
#include <boost/range.hpp>
#include <vector>
#include <numeric>

// and also this...
#include <boost/bind.hpp>

struct X
{
    int f( ) const { return 1; }
};

int sum( int a, int b ) { return a + b; }

int main( )
{
    using boost::lambda::bind;

    boost::lambda::placeholder1_type x;
    boost::lambda::placeholder2_type y;

    std::vector<X> v;

    boost::function<int(int, int)> my_sum = bind( sum, x, y );

    std::accumulate( boost::begin( v ), boost::end( v ), 0, bind( my_sum, x, bind( &X::f, y ) ) );
}

Thx

- Rob.