Boost logo

Boost Users :

Subject: [Boost-users] [phoenix] Using with Boost.Function.
From: Robert Jones (robertgbjones_at_[hidden])
Date: 2012-10-22 09:08:16


Can anyone tell me the correct incantation to get the 'Not OK' lines to
work?

Thx, Rob.

#include <boost/function.hpp>
#include <boost/phoenix/core.hpp>
#include <boost/phoenix/operator.hpp>
#include <boost/phoenix/bind/bind_member_variable.hpp>
#include <boost/phoenix/bind/bind_function.hpp>
#include <boost/function.hpp>
#include <list>

struct S { int i; };

void f( std::list<S> & l, int i )
{
    using boost::phoenix::arg_names::_1;
    using boost::phoenix::arg_names::_2;

    // OK
    l.remove_if( bind( & S::i, _1 ) >= i );

    *// Not OK.*
* boost::function<bool( int, int )> pred = _1 >= _2;*
* l.remove_if( bind( pred, _1, i ) );*
}



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