Boost logo

Boost Users :

Subject: [Boost-users] [Phoenix][Range] What's wrong here...
From: Robert Jones (robertgbjones_at_[hidden])
Date: 2013-01-17 06:28:34


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>( ) );
}



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net