Boost logo

Boost Users :

From: Nebojsa Simic (nelle_at_[hidden])
Date: 2007-11-17 11:52:55


JOAQUIN LOPEZ MU?Z wrote:
> ----- Mensaje original -----

[...]

>
> 1. The expression
>
> boost::bind(bloodyBindable,idxResponse,::_1,fnAddStats)
>
> does a copy of the idxResponse index, which is not what you
> want (indices are actually not copyable, more info on why you can
> still get spurious index copies in certain compilers at
> http://lists.boost.org/boost-users/2007/10/31777.php ). So,
> to prevent this copying use boost::ref:
>
> boost::bind(bloodyBindable,boost::ref(idxResponse),::_1,fnAddStats)
>
> More info on the usage of Boost.Ref with Boost.Bind at
> http://boost.org/libs/bind/bind.html .

thanks for the tip, I already added the boost::ref ...

>
> 2. The reason why you can't do the binding directly and have to
> resort to the bloodyBindable proxy is that modify is *not* a member
> function, but a member function *template*. To do the binding you
> have to provide an instantiation of modify, like this:
>
> for_each_it(
> it,idxResponse.end(),
> boost::bind(
> &StatisticsByResponse::modify<boost::function<void(Statistics)>
>> ,
> boost::ref(idxResponse),::_1,fnAddStats));

I'm working with VS 2003 (Compiler Version 13.10.3077) and it does not
like nested templates, so I tried doing the following :

typedef boost::function<void(Statistics)> fnModifier;

for_each_it( it
    , idxResponse.end()
    , boost::bind( &StatisticsByResponse::modify<fnModifier>
        , boost::ref(idxResponse)
        , ::_1
        , fnAddW0
    )
  );

bind still cant find proper instantiation :
"could not deduce template argument for 'overloaded function type' from
'overloaded function type'"

Could this be a compiler issue ???

-- 
Nebojsa Simic

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