Boost logo

Boost :

From: Oleg Abrosimov (beholder_at_[hidden])
Date: 2006-07-21 09:24:22


Peter Dimov ?????:
> Oleg Abrosimov wrote:
>> Hello!
>>
>> In order to obtain a polymorphic behavior with boost::variant and
>> keep a reference semantic in corresponding visitor I've added the
>> following constructor to boost::reference_wrapper class:
>>
>> template<typename T1>
>> reference_wrapper(reference_wrapper<T1> const& rw):
>> t_(rw.get_pointer()) {}
>
> This makes sense, but...
>
>> it can be tested with:
>>
>> int i = 1;
>> boost::reference_wrapper<double> = boost::ref(i);
>
> ... this doesn't; why should a reference to int be convertible to a
> reference to double?

my fault, sorry. it should be

class base {};
class child : public base {};

child c;
boost::reference_wrapper<base> bref = boost::ref(c);

>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>


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