Boost logo

Boost :

Subject: Re: [boost] [ref] incompatibility with c++0x
From: Andy Venikov (avenikov_at_[hidden])
Date: 2010-07-21 16:57:41


David Abrahams wrote:
> At Wed, 21 Jul 2010 15:45:08 -0400,
<snip>

>> I know that boost::reference_wrapper is not the same as
>> std::reference_wrapper, but still it would be nice to have some uniformity.
>
> I guess it usually doesn't matter because you should use boost::ref(x)
> to create these objects anyway?
>

True, but I did hit an issue with that recently.
I had a generic function wrapper whose return type and an inner function
to call was controlled by the user. Furthermore, it's not required that
the return type of the inner function be the same as the return type of
the wrapper as long as it's /*implicitly*/ convertible.

So, when the user specified std::references_wrapper as the wrapper's
return type (assuming that the inner function returns just a reference
to a type), it worked. When switched to boost::reference_wrapper - it
stopped working. For our needs we just dropped the /*implicit*/
requirement and the wrapper just forcibly converts the return of the
inner function to it's own return type. But still...

Thanks,
     Andy.


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