20 Jan 12:40
Re: Futures Review - minor implementation details
Anthony Williams <anthony.ajw <at> gmail.com>
2009-01-20 11:40:44 GMT
2009-01-20 11:40:44 GMT
"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"
> Is
> future.swap(other.future);
> other.future.reset();
> 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.
> And once shared_ptr implements movable you could use
> future = move(other.future);
> Isn't it?
Yes.
Anthony
--
--
Anthony Williams | Just Software Solutions Ltd
Custom Software Development | http://www.justsoftwaresolutions.co.uk
Registered in England, Company Number 5478976.
Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
RSS Feed