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