Boost logo

Boost Users :

Subject: Re: [Boost-users] [Thread] Constructing a move-only object asyncronously
From: Alexander Lamaison (awl03_at_[hidden])
Date: 2013-03-19 19:22:42


"Vicente J. Botet Escriba" <vicente.botet_at_[hidden]> writes:

> Le 19/03/13 20:30, Alexander Lamaison a écrit :
>> "Vicente J. Botet Escriba" <vicente.botet_at_[hidden]> writes:
>>
>>> Le 19/03/13 19:40, Alexander Lamaison a écrit :
>>>> I'm trying to create a move-only object asyncronously using Boost.Thread
>>>> unique_future but I'm running into trouble:
>>>>
>>>> error C2248: 'A::A' : cannot access private member declared in class 'A'
>>>> c:\users\awl03\documents\visual studio
>>>> 2005\projects\boost_1_51_0\boost\thread\future.hpp 493
>>>>
>>>> I've tried all sorts of ways to work around this but always end up with
>>>> some variation or other of this error message. What am I doing wrong?
>>>>
>> snip
>>
>>> you need to use version 4 to got this functionality.
>> I assume this requires Boost 1.53?
>>
>>> I have modified your example to use boost::future (*) and use
>>> packaged_task with a signature parameter (**). With this change it to
>>> works for the following toolsets.
>> Thanks! Can you give me an idea of what changed in v4 to enable this?
>> I've looked through the history but nothing stands out.
>>
>> I tried to make it work using just class thread rather than anything in
>> <future.hpp>, but I couldn't work out how for a non-default
>> constructible class.
>>
>>
> I have just tried your example defining
>
> #define BOOST_THREAD_USES_MOVE
>
> and it works also.

Perfect. Thanks :)

I'm assuming this solves the problem because the previous
thread-internal move emulation didn't realise class A was movable and so
tried to copy it. Is that right?

Alex

-- 
Swish - Easy SFTP for Windows Explorer (http://www.swish-sftp.org)

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