2013/1/17 Robert Jones <robertgbjones@gmail.com>
Hi All

Can anyone tell me what's wrong with this? The error message is so huge I'm a bit overwhelmed!

I suspect type deduction is failing, but none of my efforts to correct it have worked.

Thx, Rob.

#include <boost/phoenix/bind.hpp>
#include <boost/phoenix/bind/bind_function_object.hpp>
#include <boost/phoenix/core.hpp>
#include <boost/phoenix/operator.hpp>
#include <boost/range/adaptor/adjacent_filtered.hpp>
#include <boost/range/algorithm/for_each.hpp>

void f( const double & ) { }

template <class Compare>
    void sorted( Compare cmp )
{
    using boost::adaptors::adjacent_filtered;
    using boost::phoenix::arg_names::_1;
    using boost::phoenix::arg_names::_2;

    std::vector<double> input = { 0.0, 1.0, 2.0, 3.0, 4.0 };

    // Ok
    for_each( input | adjacent_filtered( cmp ) , f );

    // Not Ok
    for_each( input | adjacent_filtered( bind( cmp, _1, _2 ) ) , f );
}

int main( )
{
    sorted( std::less<double>( ) );
}

Make sure your 'bind' comes from phoenix not std.