vicente.botet | 6 Jan 23:13
Picon

Re: Futures Review - minor implementation details

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?

Is 
            future.swap(other.future);
            other.future.reset();
more efficient than
            future.reset(other.future);
            other.future.reset();
? Otherwise you can change it in:

        shared_future& operator=(shared_future && other)
        {
            future.swap(other.future);
            other.future.reset();
            return *this;
        }
        shared_future& operator=(boost::detail::thread_move_t<shared_future> other)
        {
            future.swap(other->future);
            other->future.reset();
            return *this;
        }
        shared_future& operator=(boost::detail::thread_move_t<unique_future<R> > other)
        {
            future.swap(other->future);
            other->future.reset();
            return *this;
        }

And once shared_ptr implements movable you could use 
    future = move(other.future);
Isn't it?

Vicente

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


Gmane