warnings with boost::bind
Hello, I have a question. I use boost::bind with the following class: class B { int data; } class A { bool SetData(const B&){return true;}; } now when I make somewhere the following: A a; boost::bind<bool>(&A::SetData,&a); I get a warning 8>D:\boost\boost_1_34_1\boost/bind.hpp(1575) : warning C4180: qualifier applied to function type has no meaning; ignored 8> D:\boost\boost_1_34_1\boost/bind.hpp(1609) : see reference to class template instantiation 'boost::_bi::add_cref<Pm,I>' being compiled 8> with 8> [ 8> Pm=bool (__thiscall Microtec::Program::* )(const Microtec::TrackingInfo &), 8> I=1 8> ] 8> .\Program.cpp(2385) : see reference to class template instantiation 'boost::_bi::dm_result<Pm,A1>' being compiled 8> with 8> [ 8> Pm=bool (__thiscall Microtec::Program::* )(const Microtec::TrackingInfo &), 8> A1=bool 8> ] I think it is for the const reference. Is this a problem? Is there some way to avoid it (okay the way with pragma I know)? I use boost 1.34.1 and MSVC2005 Regards
Another thing that I have seen now. The compiler crashes when I want to assign it to: boost::function<bool (const A&)> func=boost::bind<bool>(&A::SetData,&a); What is wrong? Hansi schrieb:
Hello,
I have a question. I use boost::bind with the following class:
class B { int data; }
class A { bool SetData(const B&){return true;}; }
now when I make somewhere the following:
A a; boost::bind<bool>(&A::SetData,&a);
I get a warning
8>D:\boost\boost_1_34_1\boost/bind.hpp(1575) : warning C4180: qualifier applied to function type has no meaning; ignored 8> D:\boost\boost_1_34_1\boost/bind.hpp(1609) : see reference to class template instantiation 'boost::_bi::add_cref<Pm,I>' being compiled 8> with 8> [ 8> Pm=bool (__thiscall Microtec::Program::* )(const Microtec::TrackingInfo &), 8> I=1 8> ] 8> .\Program.cpp(2385) : see reference to class template instantiation 'boost::_bi::dm_result<Pm,A1>' being compiled 8> with 8> [ 8> Pm=bool (__thiscall Microtec::Program::* )(const Microtec::TrackingInfo &), 8> A1=bool 8> ]
I think it is for the const reference. Is this a problem? Is there some way to avoid it (okay the way with pragma I know)?
I use boost 1.34.1 and MSVC2005
Regards
and what is the right way? boost::function<bool (const A&)> func=boost::bind<bool>(&A::SetData,&a,_1); and after that func(b); Igor R schrieb:
Another thing that I have seen now. The compiler crashes when I want to assign it to:
boost::function<bool (const A&)> func=boost::bind<bool>(&A::SetData,&a);
What is wrong?
MSVC crashes on args mismatch in bind. In your case SetData's should be of type B, not A.
participants (2)
-
Hansi
-
Igor R