Boost logo

Boost Users :

From: Pete Hodgson (spam_at_[hidden])
Date: 2006-07-05 14:02:19


Peter Dimov wrote:
...
>
> not1 doesn't work well with boost::mem_fn applied to shared_ptr, but you may
> try
>
> !boost::bind( &CEgg::IsHatched, _1 )
>
> instead.

I tried the following:

bool SomeEggsHaveHatched()
{
        tEggsVector basketOfEggs;

        using boost::lambda::_1;

        tEggsVector::const_iterator it = std::find_if(
                basketOfEggs.begin(),
                basketOfEggs.end(),
                boost::bind( &CEgg::IsHatched, _1 ) );

        bool bSomeEggsHaveHatched = ( it != basketOfEggs.end() );
        return bSomeEggsHaveHatched;
}

but it won't compile, giving:

<------------------------------SNIP--------------------------------------->

c:\WORK\4DCapture_Soln\thirdparty\boost\boost\bind\mem_fn_template.hpp(90)
: error C2664: 'R boost::_mfi::cmf0<R,T>::call<const U>(const U &,const
T *) const' : cannot convert parameter 2 from 'const
boost::lambda::lambda_functor<T>' to 'const CEgg *'
         with
         [
             R=bool,
             T=CEgg,
             U=boost::lambda::placeholder1_type
         ]
         and
         [
 
T=boost::lambda::lambda_functor_base<boost::lambda::other_action<boost::lambda::addressof_action>,boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder<1>>,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type>>
         ]
         No user-defined-conversion operator available that can perform
this conversion, or the operator cannot be called
         c:\WORK\4DCapture_Soln\thirdparty\boost\boost\bind.hpp(193) :
see reference to function template instantiation 'R
boost::_mfi::cmf0<R,T>::operator
()<boost::lambda::lambda_functor<boost::lambda::placeholder<1>>>(const U
&) const' being compiled
         with
         [
             R=bool,
             T=CEgg,
             U=boost::lambda::placeholder1_type
         ]
 
c:\WORK\4DCapture_Soln\thirdparty\boost\boost\bind\bind_template.hpp(33)
: see reference to function template instantiation 'R
boost::_bi::list1<A1>::operator
()<boost::_bi::bind_t<R,F,L>::result_type,F,boost::_bi::list1<boost::shared_ptr<T>
&>>(boost::_bi::type<boost::_bi::bind_t<R,F,L>::result_type>,F,A &)'
being compiled
         with
         [
 
R=boost::_bi::bind_t<bool,boost::_mfi::cmf0<bool,CEgg>,boost::_bi::list1<boost::_bi::list_av_1<boost::lambda::placeholder1_type>::B1>>::result_type,
             A1=boost::_bi::list_av_1<boost::lambda::placeholder1_type>::B1,
             F=boost::_mfi::cmf0<bool,CEgg>,
 
L=boost::_bi::list1<boost::_bi::list_av_1<boost::lambda::placeholder1_type>::B1>,
             T=CEgg,
 
A=boost::_bi::list1<std::allocator<boost::shared_ptr<CEgg>>::value_type &>
         ]
         c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\algorithm(64) : see reference to function template
instantiation 'boost::_bi::bind_t<R,F,L>::result_type
boost::_bi::bind_t<R,F,L>::operator
()<std::allocator<_Ty>::value_type>(A1 &)' being compiled
         with
         [
             R=bool,
             F=boost::_mfi::cmf0<bool,CEgg>,
 
L=boost::_bi::list1<boost::_bi::list_av_1<boost::lambda::placeholder1_type>::B1>,
             _Ty=boost::shared_ptr<CEgg>,
             A1=std::allocator<boost::shared_ptr<CEgg>>::value_type
         ]
         c:\WORK\4DCapture_Soln\VideoCapture\PixelinkCaptureFacade.h(34)
: see reference to function template instantiation '_InIt std::f
ind_if<std::vector<_Ty>::iterator,boost::_bi::bind_t<R,F,L>>(_InIt,_InIt,_Pr)'
being compiled
         with
         [
             _InIt=std::vector<boost::shared_ptr<CEgg>>::iterator,
             _Ty=boost::shared_ptr<CEgg>,
             R=bool,
             F=boost::_mfi::cmf0<bool,CEgg>,
 
L=boost::_bi::list1<boost::_bi::list_av_1<boost::lambda::placeholder1_type>::B1>,
 
_Pr=boost::_bi::bind_t<bool,boost::_mfi::cmf0<bool,CEgg>,boost::_bi::list1<boost::_bi::list_av_1<boost::lambda::placeholder1_type>::B1>>
         ]

<------------------------------SNIP--------------------------------------->

Any clues as to what's going on here?


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