Boost logo

Boost :

Subject: Re: [boost] [core] Breaking change to boost::ref in 1.56
From: Peter Dimov (lists_at_[hidden])
Date: 2014-07-14 06:01:40


Andrey Semashev wrote:
> Would you expect this code to work:
>
> struct my_class
> {
> void bar();
> };
>
> struct my_class_const
> {
> void bar() const;
> };
>
> template< typename T >
> void foo(T const& t)
> {
> typedef typename boost::unwrap_reference<T>::type class_type;
> boost::bind(&class_type::bar, boost::ref(t))();
> }
>
> foo(my_class_const());
> my_class x;
> foo(boost::ref(x));

Unless I'm doing something wrong, this code seems to work with the old
boost::ref, it also works with the new boost::ref without the collapsing
overloads. I'm not sure what your point is; are you arguing that the code
must fail?


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