1>E:\Program Files\Microsoft Visual Studio 9.0\VC\include\boost/bind/bind.hpp(69) : error C2825: 'F': must be a class or namespace when followed by '::'
1> E:\Program Files\Microsoft Visual Studio 9.0\VC\include\boost/bind/bind_template.hpp(15) : see reference to class template instantiation 'boost::_bi::result_traits<R,F>' being compiled
1> with
1> [
1> R=boost::_bi::unspecified,
1> F=bool (__thiscall HttpSendRecv_boost::* )(stringdouble,stringdouble)
1> ]
1> .\Class_HTTP.cpp(152) : see reference to class template instantiation 'boost::_bi::bind_t<R,F,L>' being compiled
1> with
1> [
1> R=boost::_bi::unspecified,
1> F=bool (__thiscall HttpSendRecv_boost::* )(stringdouble,stringdouble),
1> L=boost::_bi::list4<boost::arg<1>,boost::arg<2>,boost::arg<3>,boost::_bi::value<stringdouble>>
1> ]
1>E:\Program Files\Microsoft Visual Studio 9.0\VC\include\boost/bind/bind.hpp(69) : error C2039: 'result_type' : is not a member of '`global namespace''
1>E:\Program Files\Microsoft Visual Studio 9.0\VC\include\boost/bind/bind.hpp(69) : error C2146: syntax error : missing ';' before identifier 'type'
1>E:\Program Files\Microsoft Visual Studio 9.0\VC\include\boost/bind/bind.hpp(69) : error C2208: 'boost::_bi::type' : no members defined using this type
1>E:\Program Files\Microsoft Visual Studio 9.0\VC\include\boost/bind/bind.hpp(69) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Здравствуйте, st0nx, Вы писали:
S>Здравствуйте, Аноним, Вы писали:
А>>Здравствуйте, st0nx
S>>> if(std::find_if(cookie.begin(),cookie.end(),(boost::bind(&HttpSendRecv_boost::findvector,_1,_2,_3,buf))) == cookie.end()) S>>> { S>>> cookie.push_back(buf); S>>> }
А>>Попробуйте так:
А>>if(std::find_if(cookie.begin(),cookie.end(),(boost::bind(&HttpSendRecv_boost::findvector,this,buf,_1))) == cookie.end()) А>>{ А>> cookie.push_back(buf); А>>}
S>Спасибо все получилось! А не могли бы вы рассказать почему именно так?
В алгоритм std::find_if нужно передать функтор который должен принимать один параметр: stringdouble,
а функция findvector, является членом класса, следовательно неявно принимает еще и указатель на объект this.
вот и получается: bind(&HttpSendRecv_boost::findvector, this, buf, _1)(stringdouble)
&HttpSendRecv_boost::findvector: указатель на функцию
this — указатель на объект класса, в котором эта функция
buf — первый аргумент
_1 — то что очталось