Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

cancellation_slot::emplace

Installs a handler into the slot, constructing the new object directly.

template<
    typename CancellationHandler,
    typename... Args>
CancellationHandler & emplace(
    Args &&... args);

Destroys any existing handler in the slot, then installs the new handler, constructing it with the supplied args.

The handler is a function object to be called when the signal is emitted. The signature of the handler must be

void handler(boost::asio::cancellation_type_t);
Parameters

args

Arguments to be passed to the CancellationHandler object's constructor.

Return Value

A reference to the newly installed handler.

Remarks

Handlers installed into the slot via emplace are not required to be copy constructible or move constructible.


PrevUpHomeNext