From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-04-04 17:33:08


Barchenkov, Alexei (IT) wrote:
> Rewording from a previous post:
>
> Are there any issues with binding a boost:ref to a free templated
> function? On gcc32 this generates an error:
>
> class Test { };
>
> template <class T> void foo(T arg_) { }
>
> int main(int)
> {
> Test t;
> boost::reference_wrapper<Test> tr(t);
> boost::function<void()> fun1 =
> boost::bind(&::foo<boost::reference_wrapper<Test> >, tr);
> }

The problem is that tr is ref( t ) and is interpreted by bind as a request
to store a reference to t.

boost::bind( &foo< Test& >, tr ) should work, if this helps.