Boost logo

Boost Users :

Subject: Re: [Boost-users] [phoenix] Using with Boost.Function.
From: TONGARI (tongari95_at_[hidden])
Date: 2012-10-22 11:50:55


2012/10/22 Robert Jones <robertgbjones_at_[hidden]>

> 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/phoenix/bind/bind_function_object.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 ) );*
>

- l.remove_if( bind( pred, _1, i ) );
+ l.remove_if( bind( pred, bind( & S::i, _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