Boost logo

Boost Users :

Subject: Re: [Boost-users] Anyone see anything like this??
From: Peter Dimov (pdimov_at_[hidden])
Date: 2009-10-15 17:37:59


Noah Roberts wrote:
> In mem_fn.hpp (not sure what is doing this but my bet is bind or

It is bind.

> function) there is a function dm<R,T>::call<U> that looks like so:
>
> template<class U> R const & call(U & u, void const *) const
> {
> return (get_pointer(u)->*f_);
> }

...

> 1>d:\boostvs39\include\boost\bind\mem_fn.hpp(334) : error C4716:
> 'boost::_mfi::dm<void __thiscall(unsigned
> int),esi::units::unit_settings>::call<esi::pipeflo::document::unit_pool
> * const>' : must return a value

dm<> is the data member implementation, that is, what mem_fn returns when
passed a pointer to a data member. You're binding a member function, in this
case one with the signature void (unit_settings::*)(unsigned)...

> std::make_pair( boost::bind(&unit_settings::get_labels<pressure>,
> &units)
> , boost::bind(&unit_settings::set_selection
> <pressure>, &units) )

... and the problem is that you haven't supplied the _1:

    boost::bind( &unit_settings::set_selection<pressure>, &units, _1 )

and the data member overload gets used instead because it happens to accept
the argument list (&unit_settings::set_selection<pressure>, &units).

Annoying, I know. But relatively rare. :-)


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