Boost logo

Boost Users :

Subject: Re: [Boost-users] question about using boost.function and boost.bind, V1.38
From: Igor R (boost.lists_at_[hidden])
Date: 2009-04-03 05:17:13


> // usage in a ctor initialisation list …, where m_button_monitor is of type
> ButtonMonitor,
>
> , m_button_monitor(boost::bind(boost::mem_fn(&CView::OnRun), this,
> ID_TOOLBUTTON_AUTO))
>
>
>
>
>
> //definition  1 of ButtonMonitor that fails
>
> // the error message by MS VC9SP1:
>
> // error C2664:
> 'programmer_board::ButtonMonitor::ButtonMonitor(boost::function<Signature>
> &)' :
>
> //cannot convert parameter 1 from 'boost::_bi::bind_t<R,F,L>' to
> 'boost::function<Signature> &'
>
> //
>
>         class ButtonMonitor
>
>         {
>
>         public:
>
>                 ButtonMonitor(boost::function<void()>& f)
>
>                         : m_f(f)

It seems that you try to initialize non-const reference with a temporary.


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