Subject: Re: [Boost-bugs] [Boost C++ Libraries] #8596: With C++0x enabled, boost::packaged_task stores a reference to function objects, instead of a copy
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-05-20 15:39:23
#8596: With C++0x enabled, boost::packaged_task stores a reference to function
objects, instead of a copy
-----------------------------------------------------------+----------------
Reporter: Kees-Jan Dijkzeul <kees-jan.dijkzeul@â¦> | Owner: viboes
Type: Bugs | Status: assigned
Milestone: To Be Determined | Component: thread
Version: Boost 1.53.0 | Severity: Problem
Resolution: | Keywords:
-----------------------------------------------------------+----------------
Comment (by Kees-Jan Dijkzeul <kees-jan.dijkzeul@â¦>):
I see. It was unclear to me that you already accepted my ticket as a bug.
In that case, I probably overreacted. I apologize. It is true, though,
that I have high expectations of you guys. You yourselves contribute to
that in large part by mostly living up to them :-)
On the other hand, I was kind of proud having analysed this issue as far
as I did. Being assigned more work without it being made explicitly clear
that I was on to something and that it was for my own immediate benefit is
kind of daunting :-)
As for unblocking me: Your patch (and several variations I tried) triggers
a build error, either because boost::forward() cannot handle what I throw
at it, or because the task_object constructor expects only an rvalue, but
not an lvalue.
Taking a different approach, I observed that the packaged_task seems to
store a reference only because I pass it one. Adding a static cast like
so:
{{{
return
boost::packaged_task<int>(static_cast<boost::function<int()>(fn));
}}}
also seems to work around the problem. You can consider me unblocked :-)
Thanks very much for your support!
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/8596#comment:5> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:13 UTC