Boost logo

Boost Users :

Subject: Re: [Boost-users] boost bind, issue moving from 1.57 to 1.60
From: Piotr Kowalski (koval.gnu_at_[hidden])
Date: 2016-06-16 20:27:04


Under Visual Studio C++ 2013 the example works fine after adding a
reference in function signature:
boost::function<bool(boost::shared_ptr<const Boom>&)>

This somehow prevents too much forwarding and losing the original value

2016-06-17 1:29 GMT+02:00 Gavin Lambert <gavinl_at_[hidden]>:

> On 17/06/2016 09:39, Jason Mancini wrote:
>
>> So this snippet comes from a sizable code base. Took a long time to
>> pinpoint then distill the issue down to the 6-line example! Pretty sure
>> that std::bind / std::function don't support this usage, or at least it
>> didn't work when I tried for a few minutes. Boost flavor seems a bit
>> more featured.
>>
>
> Yeah, boost::bind supports quite a few late-binding operators, which are
> handy to improve code brevity but can be a bit confusing to read. If
> you're using a C++11 compiler then it's probably better to use lambdas for
> these cases now.
>
> The actual offender is the bigger change in bind/bind.hpp from 1.59 to
>> 1.60 (not the trivial changes in args or placeholder). I can see they
>> added significant std::forward / rvalue support. If I set
>> BOOST_NO_CXX11_RVALUE_REFERENCES then also it continues to work. I
>> suspect we've hit a corner case issue with forward / rvalue and
>> boost::function / boost::shared_ptr.
>>
>
> Most likely, somewhere along the way it's moving the pointer and then
> returning the original instead of the new one.
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net