Boost logo

Boost Users :

Subject: Re: [Boost-users] warnings with boost::bind
From: Hansi (hansipet_at_[hidden])
Date: 2009-03-31 03:58:21


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


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