Nice try, and thanks for correcting my missing bind invocation, but still
no tomato!
#include
#include
#include
#include
#include
#include
#include
#include <list>
struct S { int i; };
bool pred_fn( int i, int j ) { return i >= j; }
void f( std::list<S> & l, int i )
{
using boost::phoenix::arg_names::_1;
using boost::phoenix::arg_names::_2;
boost::function pred_obj = _1 >= _2;
// OK
l.remove_if( bind( & S::i, _1 ) >= i );
// OK
l.remove_if( bind( pred_fn, bind( & S::i, _1 ), i ) );
// Not OK.
l.remove_if( bind( pred_obj, bind( & S::i, _1 ), i ) );
}
Results in this error...
In file included from
/home/rjones/local/gcc-4.6.2/lib/gcc/x86_64-unknown-linux-gnu/4.6.2/../../../../include/c++/4.6.2/list:65:0,
from function.cpp:8:
/home/rjones/local/gcc-4.6.2/lib/gcc/x86_64-unknown-linux-gnu/4.6.2/../../../../include/c++/4.6.2/bits/list.tcc:
In member function ‘void std::list<_Tp, _Alloc>::remove_if(_Predicate)
[with _Predicate = std::_Bind(boost::phoenix::actor >, 0l>,
boost::phoenix::actor >, 0l> > >, 2l> >,
int)>, _Tp = S, _Alloc = std::allocator<S>]’:
function.cpp:28:58: instantiated from here
/home/rjones/local/gcc-4.6.2/lib/gcc/x86_64-unknown-linux-gnu/4.6.2/../../../../include/c++/4.6.2/bits/list.tcc:401:6:
error: no match for call to ‘(std::_Bind(boost::phoenix::actor >, 0l>,
boost::phoenix::actor >, 0l> > >, 2l> >,
int)>) (S&)’
/home/rjones/local/gcc-4.6.2/lib/gcc/x86_64-unknown-linux-gnu/4.6.2/../../../../include/c++/4.6.2/functional:1130:11:
note: candidates are:
/home/rjones/local/gcc-4.6.2/lib/gcc/x86_64-unknown-linux-gnu/4.6.2/../../../../include/c++/4.6.2/functional:1201:2:
note: template _Result
std::_Bind<_Functor(_Bound_args ...)>::operator()(_Args&& ...) [with _Args
= {_Args ...}, _Result = _Result, _Functor = boost::function, _Bound_args =
{boost::phoenix::actor >, 0l>,
boost::phoenix::actor >, 0l> > >, 2l> >,
int}]
/home/rjones/local/gcc-4.6.2/lib/gcc/x86_64-unknown-linux-gnu/4.6.2/../../../../include/c++/4.6.2/functional:1215:2:
note: template _Result
std::_Bind<_Functor(_Bound_args ...)>::operator()(_Args&& ...) const [with
_Args = {_Args ...}, _Result = _Result, _Functor =
boost::function, _Bound_args =
{boost::phoenix::actor >, 0l>,
boost::phoenix::actor >, 0l> > >, 2l> >,
int}]
/home/rjones/local/gcc-4.6.2/lib/gcc/x86_64-unknown-linux-gnu/4.6.2/../../../../include/c++/4.6.2/functional:1229:2:
note: template _Result
std::_Bind<_Functor(_Bound_args ...)>::operator()(_Args&& ...) volatile
[with _Args = {_Args ...}, _Result = _Result, _Functor =
boost::function, _Bound_args =
{boost::phoenix::actor >, 0l>,
boost::phoenix::actor >, 0l> > >, 2l> >,
int}]
/home/rjones/local/gcc-4.6.2/lib/gcc/x86_64-unknown-linux-gnu/4.6.2/../../../../include/c++/4.6.2/functional:1243:2:
note: template _Result
std::_Bind<_Functor(_Bound_args ...)>::operator()(_Args&& ...) const
volatile [with _Args = {_Args ...}, _Result = _Result, _Functor =
boost::function, _Bound_args =
{boost::phoenix::actor >, 0l>,
boost::phoenix::actor >, 0l> > >, 2l> >,
int}]
gmake: *** [function.o] Error 1
Thoughts?
Thx, Rob.