Boost logo

Boost Users :

From: Stephan Menzel (stephan.menzel_at_[hidden])
Date: 2019-09-02 06:29:50

Hi everyone,

as a long time asio user I often had needs to wrap up repeating patterns of
async calls for re-use. Normally I went for some kind of specialized object
that wraps smaller pieces but I recently came across a series of examples
which try to explain how own composed operations may be created.

Now, looking at the examples they are of course way over my head but since
own composed operations would be very much exactly what I need I thought
I'd give it a shot. But as I now look at this example here:
I notice something that I hope somebody can explain.

In the coroutine implementation it says:

yield delay_timer_->async_wait(std::move(self));
if (error)

yield boost::asio::async_write(socket_,
    boost::asio::buffer(*encoded_message_), std::move(self));

I'm puzzled about the double std::move() of self. In the comments above it
says that self is a reference to an intermediate completion handler. How
can this be moved twice?
Can anyone give me hint about what this means?

I would also appreciate any hints in general about own composed operations.
Perhaps there are other approaches that are a bit less intimidating?


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at