vicente.botet | 20 Jan 19:05
Picon

Re: Futures Review - minor implementation details

----- Original Message ----- 
From: "Anthony Williams" <anthony.ajw <at> gmail.com>
To: <boost <at> lists.boost.org>
Sent: Tuesday, January 20, 2009 12:40 PM
Subject: Re: [boost] Futures Review - minor implementation details

> 
> "vicente.botet" <vicente.botet <at> wanadoo.fr> writes:
> 
>> Hi Anthony,
>>
>> Some minor implementation details:
>> Why there is not other.future reset in
>>         shared_future(shared_future && other)
>>         {
>>             future.swap(other.future);
>>         }
>>         shared_future(unique_future<R> && other)
>>         {
>>             future.swap(other.future);
>>         }
>>
>> How the move is made?
> 
> These are the constructors. The "future" member is initially NULL, so
> the swap sets "other.future" to NULL whilst transferring the value
> from "other.future" to "this->future"

OK, I see.

>> Is 
>>             future.swap(other.future);
>>             other.future.reset();  (1)
>> more efficient than
>>             future.reset(other.future);
>>             other.future.reset();
>> ? Otherwise you can change it in:
> 
> The former avoids incrementing any reference counts. The
> latter has to increase the reference count on *other.future just to
> decrease it again with the reset.

I see.

Thanks,
Vicente

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


Gmane