Boost logo

Boost :

Subject: Re: [boost] Boost.Bind and boost.ref propagation
From: Peter Dimov (pdimov_at_[hidden])
Date: 2011-01-07 17:24:47


Felipe Magno de Almeida wrote:
...
> int main()
> {
> int i = 0;
> boost::bind(::foo(), boost::ref(i))();
> }
>
> I would expect the T type to be boost::reference_wrapper<int>, but it is
> actually int.
> It is not int& as well.
>
> How do I get to propagate the boost::reference_wrapper through boost.bind
> to a template?

You can't, bind unwraps the reference_wrapper internally. Use either
std::ref or your own reference wrapper.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk